EphemeralTestDatabase class abstract interface

An ephemeral database for a test group or suite.

Backends differ: PostgreSQL is created empty on the project postmaster; SQLite records a per-group file path (the file appears when the server migrates). Callers apply schema and decide whether to drop.

Properties

hashCode int
The hash code for this object.
no setterinherited
name String
Identifier for this instance (PostgreSQL database name, or the token embedded in the SQLite file name).
no setter
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

drop() Future<void>
Tears down this database: DROP DATABASE for PostgreSQL, or deleting the SQLite file and its WAL/SHM/journal sidecars.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited

Static Methods

create({required String runMode, required String databaseName, required Directory serverDirectory, ServerpodConfig configOverride(ServerpodConfig)?}) Future<EphemeralTestDatabase?>
Provisions an ephemeral database for the project's configured backend.
resolveProjectDatabaseConfig({required String runMode, String? serverDirectory, ServerpodConfig configOverride(ServerpodConfig)?}) → DatabaseConfig?
Loads the project's database config the way Serverpod would (run mode, passwords, and an optional configOverride) but without any per-test name swap, so the shared postmaster is launched against the project database.
sqliteFilePath(String original, String databaseName) String
Per-group SQLite file path derived from original by inserting databaseName (e.g. db/test.dbdb/sp_test_<token>.db). Relative paths stay relative so the SQLite adapter can anchor them against the server directory.