pub struct PostgresTestContainer { /* private fields */ }Expand description
Handle to the suite’s shared PostgreSQL container.
Implementations§
Source§impl PostgresTestContainer
impl PostgresTestContainer
Sourcepub async fn start(suite: &TestContainerSuite) -> Self
pub async fn start(suite: &TestContainerSuite) -> Self
Starts (or reuses) the shared PostgreSQL container with postgres/postgres credentials.
§Panics
Panics when shared state, container startup, port discovery, readiness, stale-database cleanup, or connection shutdown fails.
Sourcepub fn admin_url(&self) -> &str
pub fn admin_url(&self) -> &str
Returns the admin URL pointing at the default postgres database.
Sourcepub fn container_identity(&self) -> &str
pub fn container_identity(&self) -> &str
Returns a stable identity for the running suite container.
The resolved admin URL includes the checkout-scoped host port and therefore changes when the reusable container belongs to a different suite instance.
Sourcepub async fn create_database(&self, name: &str) -> PostgresTestDatabase
pub async fn create_database(&self, name: &str) -> PostgresTestDatabase
Creates and registers an isolated database for a product test.
§Panics
Panics when the database name is invalid, shared state fails, or the admin connection,
CREATE DATABASE, or connection shutdown fails.
Sourcepub async fn create_database_from_template(
&self,
name: &str,
template: &str,
) -> PostgresTestDatabase
pub async fn create_database_from_template( &self, name: &str, template: &str, ) -> PostgresTestDatabase
Creates and registers an isolated database cloned from template.
Products still own the template contents, migrations, and seed data. This helper only
provides the product-neutral PostgreSQL database lifecycle and safe identifier handling.
§Panics
Panics when either database name is invalid, shared state fails, or the admin connection,
CREATE DATABASE ... TEMPLATE ..., or connection shutdown fails.
Creates a suite-scoped database for a product-owned reusable fixture.
Unlike Self::create_database, this resource survives the producer process. Products
must use a separate locked fixture-state protocol to validate or invalidate its contents.
Drops a suite-scoped fixture database and unregisters it.
§Panics
Panics when the name is invalid or database cleanup, connection, or shutdown fails.
Registers a suite-scoped product fixture that must outlive the producer process.
This is for product-owned migrated template databases. Products must pair it with their
own fingerprint-based invalidation and call Self::forget_shared_resource after
dropping a superseded fixture.
Removes a suite-scoped product fixture after it was explicitly cleaned up.
Auto Trait Implementations§
impl Freeze for PostgresTestContainer
impl !RefUnwindSafe for PostgresTestContainer
impl Send for PostgresTestContainer
impl Sync for PostgresTestContainer
impl Unpin for PostgresTestContainer
impl !UnwindSafe for PostgresTestContainer
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
T in a tonic::Request§impl<T> IntoResult<T> for T
impl<T> IntoResult<T> for T
type Err = Infallible
fn into_result(self) -> Result<T, <T as IntoResult<T>>::Err>
§impl<L> LayerExt<L> for L
impl<L> LayerExt<L> for L
§fn named_layer<S>(&self, service: S) -> Layered<<L as Layer<S>>::Service, S>where
L: Layer<S>,
fn named_layer<S>(&self, service: S) -> Layered<<L as Layer<S>>::Service, S>where
L: Layer<S>,
Layered].