pub struct StoppedProvisionedContainer {
pub timeouts: ContainerTimeouts,
}Expand description
Container configuration following state machine pattern
Following the pattern from Torrust Tracker MySQL driver, where different states
have different capabilities enforced at compile time.
Initial state - container is stopped/not started yet
Fields§
§timeouts: ContainerTimeoutsTimeout configurations for container operations
Implementations§
Source§impl StoppedProvisionedContainer
impl StoppedProvisionedContainer
Sourcepub fn with_timeouts(timeouts: ContainerTimeouts) -> Self
pub fn with_timeouts(timeouts: ContainerTimeouts) -> Self
Create a new stopped container with custom timeout configurations
§Arguments
timeouts- Custom timeout configuration for container operations
§Example
use torrust_tracker_deployer_lib::testing::e2e::containers::{StoppedProvisionedContainer, ContainerTimeouts};
use std::time::Duration;
let mut timeouts = ContainerTimeouts::default();
timeouts.ssh_ready = Duration::from_secs(60);
let container = StoppedProvisionedContainer::with_timeouts(timeouts);Sourcepub fn with_ssh_ready_timeout(ssh_ready_timeout: Duration) -> Self
pub fn with_ssh_ready_timeout(ssh_ready_timeout: Duration) -> Self
Create a new stopped container with custom SSH ready timeout
This is a convenience method for the most commonly customized timeout.
§Arguments
ssh_ready_timeout- How long to wait for SSH to become available
§Example
use torrust_tracker_deployer_lib::testing::e2e::containers::StoppedProvisionedContainer;
use std::time::Duration;
let container = StoppedProvisionedContainer::with_ssh_ready_timeout(
Duration::from_secs(60)
);Sourcepub async fn start(
self,
container_name: Option<String>,
ssh_port: u16,
additional_ports: &[u16],
) -> Result<RunningProvisionedContainer>
pub async fn start( self, container_name: Option<String>, ssh_port: u16, additional_ports: &[u16], ) -> Result<RunningProvisionedContainer>
Start the container and transition to running state
§Arguments
container_name- Optional name for the running container. If provided, the container will be named accordingly.ssh_port- The internal SSH port to expose from the containeradditional_ports- Additional TCP ports to expose (e.g., tracker API, HTTP tracker)
§Errors
Returns an error if:
- Docker image build fails
- Container fails to start
- Container networking setup fails
Trait Implementations§
Source§impl Debug for StoppedProvisionedContainer
impl Debug for StoppedProvisionedContainer
Auto Trait Implementations§
impl Freeze for StoppedProvisionedContainer
impl RefUnwindSafe for StoppedProvisionedContainer
impl Send for StoppedProvisionedContainer
impl Sync for StoppedProvisionedContainer
impl Unpin for StoppedProvisionedContainer
impl UnsafeUnpin for StoppedProvisionedContainer
impl UnwindSafe for StoppedProvisionedContainer
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
Mutably borrows from an owned value. Read more
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§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> ⓘ
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 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> ⓘ
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 moreSource§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
Wrap the input message
T in a tonic::Request