pub struct MockSshServerContainer { /* private fields */ }Expand description
Mock SSH server container for fast testing
This implementation doesn’t start a real container but provides the same interface as a real SSH server. Use this for tests that only need to verify configuration, timeouts, or client behavior without actual SSH connectivity.
Implementations§
Source§impl MockSshServerContainer
impl MockSshServerContainer
Sourcepub fn start_with_config(
config: SshServerConfig,
) -> Result<Self, SshServerError>
pub fn start_with_config( config: SshServerConfig, ) -> Result<Self, SshServerError>
Create a mock SSH server container with custom configuration
This doesn’t start any actual container, making it very fast for tests that don’t need real SSH connectivity.
§Arguments
config- Configuration for the mock container
§Returns
A mock container configured with the provided settings.
§Errors
This function is infallible but returns a Result to match the interface
of RealSshServerContainer::start_with_config().
§Example
use torrust_tracker_deployer_lib::testing::integration::ssh_server::{
MockSshServerContainer, SshServerConfig
};
let config = SshServerConfig::builder()
.username("customuser")
.password("custompass")
.build();
let container = MockSshServerContainer::start_with_config(config).unwrap();Sourcepub fn start() -> Result<Self, SshServerError>
pub fn start() -> Result<Self, SshServerError>
Create a mock SSH server container with default configuration
This is a convenience method that uses default configuration values.
§Returns
A mock container configured with default test credentials.
§Errors
This function is infallible but returns a Result to match the interface
of RealSshServerContainer::start().
§Example
use torrust_tracker_deployer_lib::testing::integration::ssh_server::MockSshServerContainer;
let container = MockSshServerContainer::start().unwrap();Sourcepub fn ssh_port(&self) -> u16
pub fn ssh_port(&self) -> u16
Get the SSH port mapped by the container
Returns the host port that maps to the container’s SSH port (22).
Trait Implementations§
Auto Trait Implementations§
impl Freeze for MockSshServerContainer
impl RefUnwindSafe for MockSshServerContainer
impl Send for MockSshServerContainer
impl Sync for MockSshServerContainer
impl Unpin for MockSshServerContainer
impl UnsafeUnpin for MockSshServerContainer
impl UnwindSafe for MockSshServerContainer
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
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> ⓘ
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 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>
T in a tonic::Request