Struct libcnb_test::IntegrationTestContext
source · [−]pub struct IntegrationTestContext<'a> {
pub pack_stdout: String,
pub pack_stderr: String,
pub image_name: String,
pub app_dir: PathBuf,
/* private fields */
}Expand description
Context for a currently executing integration test.
Fields
pack_stdout: StringStandard output of pack, interpreted as an UTF-8 string.
pack_stderr: StringStandard error of pack, interpreted as an UTF-8 string.
image_name: StringThe name of the image this integration test created.
app_dir: PathBufThe directory of the app this integration test uses.
This is a copy of the app_dir directory passed to IntegrationTest::new and unique to
this integration test run. It is safe to modify the directory contents inside the test.
Implementations
sourceimpl<'a> IntegrationTestContext<'a>
impl<'a> IntegrationTestContext<'a>
sourcepub fn start_container<F: FnOnce(ContainerContext<'_>)>(
&self,
exposed_ports: &[u16],
f: F
)
pub fn start_container<F: FnOnce(ContainerContext<'_>)>(
&self,
exposed_ports: &[u16],
f: F
)
Starts a new container with the image from the integration test.
The given exposed_ports are mapped to random ports on the host machine. Use
ContainerContext::address_for_port to obtain the local port for a mapped port.
Panics
- When the container could not be created
- When the container could not be started
Trait Implementations
Auto Trait Implementations
impl<'a> !RefUnwindSafe for IntegrationTestContext<'a>
impl<'a> Send for IntegrationTestContext<'a>
impl<'a> Sync for IntegrationTestContext<'a>
impl<'a> Unpin for IntegrationTestContext<'a>
impl<'a> !UnwindSafe for IntegrationTestContext<'a>
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcepub fn borrow_mut(&mut self) -> &mut T
pub 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