Struct libcnb_test::ContainerContext
source · [−]pub struct ContainerContext<'a> {
pub container_name: String,
/* private fields */
}
Fields
container_name: String
Implementations
sourceimpl<'a> ContainerContext<'a>
impl<'a> ContainerContext<'a>
sourcepub fn logs_now(&self) -> LogOutput
pub fn logs_now(&self) -> LogOutput
Gets the container’s log output until the current point in time.
Note: This method will only return logs until the current point in time. It will not block until the container stops. Since the output of this method depends on timing, directly asserting on its contents might result in flaky tests.
See: logs_wait
for a blocking alternative.
Panics
- When the log output could not be consumed/read.
sourcepub fn logs_wait(&self) -> LogOutput
pub fn logs_wait(&self) -> LogOutput
Gets the container’s log output until the container stops.
Note: This method will block until the container stops. If the container never stops by itself, your test will hang indefinitely. This is common when the container hosts an HTTP service.
See: logs_now
for a non-blocking alternative.
Panics
- When the log output could not be consumed/read.
sourcepub fn address_for_port(&self, port: u16) -> Option<SocketAddr>
pub fn address_for_port(&self, port: u16) -> Option<SocketAddr>
sourcepub fn shell_exec(&self, command: impl AsRef<str>) -> LogOutput
pub fn shell_exec(&self, command: impl AsRef<str>) -> LogOutput
Executes a shell command inside an already running container.
Panics
Trait Implementations
Auto Trait Implementations
impl<'a> !RefUnwindSafe for ContainerContext<'a>
impl<'a> Send for ContainerContext<'a>
impl<'a> Sync for ContainerContext<'a>
impl<'a> Unpin for ContainerContext<'a>
impl<'a> !UnwindSafe for ContainerContext<'a>
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> Instrument for T
impl<T> Instrument for T
sourcefn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
sourcefn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
sourceimpl<T> WithSubscriber for T
impl<T> WithSubscriber for T
sourcefn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> where
S: Into<Dispatch>,
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
sourcefn with_current_subscriber(self) -> WithDispatch<Self>
fn with_current_subscriber(self) -> WithDispatch<Self>
Attaches the current default Subscriber
to this type, returning a
WithDispatch
wrapper. Read more