PostgresTestContainer

Struct PostgresTestContainer 

Source
pub struct PostgresTestContainer { /* private fields */ }
Expand description

Handle to the suite’s shared PostgreSQL container.

Implementations§

Source§

impl PostgresTestContainer

Source

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.

Source

pub fn admin_url(&self) -> &str

Returns the admin URL pointing at the default postgres database.

Source

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.

Source

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.

Source

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.

Source

pub async fn create_shared_database(&self, name: &str) -> PostgresTestDatabase

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.

Source

pub async fn drop_shared_database(&self, name: &str)

Drops a suite-scoped fixture database and unregisters it.

§Panics

Panics when the name is invalid or database cleanup, connection, or shutdown fails.

Source

pub fn remember_shared_resource(&self, resource: &str)

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.

Source

pub fn forget_shared_resource(&self, resource: &str)

Removes a suite-scoped product fixture after it was explicitly cleaned up.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T> Instrument for T

§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided [Span], returning an Instrumented wrapper. Read more
§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts 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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts 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

§

fn into_request(self) -> Request<T>

Wrap the input message T in a tonic::Request
§

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

§

fn named_layer<S>(&self, service: S) -> Layered<<L as Layer<S>>::Service, S>
where L: Layer<S>,

Applies the layer to a service and wraps it in [Layered].
§

impl<T> PolicyExt for T
where T: ?Sized,

§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns [Action::Follow] only if self and other return Action::Follow. Read more
§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns [Action::Follow] if either self or other returns Action::Follow. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<T> WithSubscriber for T

§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a [WithDispatch] wrapper. Read more