pub struct RealSshServerContainer { /* private fields */ }Expand description
Real SSH server container using Docker
This implementation starts an actual Docker container running SSH server for full integration testing. Use this when you need to test actual SSH protocol connectivity and command execution.
Implementations§
Source§impl RealSshServerContainer
impl RealSshServerContainer
Sourcepub async fn start_with_config(
config: SshServerConfig,
) -> Result<Self, SshServerError>
pub async fn start_with_config( config: SshServerConfig, ) -> Result<Self, SshServerError>
Start a real SSH server container with custom configuration
This starts an actual Docker container running SSH server using the provided configuration. The Docker image is built automatically from the Dockerfile. This ensures the tests are self-contained and work in CI environments.
§Arguments
config- Configuration specifying image name, credentials, ports, etc.
§Returns
A real container with SSH server running, or an error if Docker is not available or the image cannot be built/started.
§Errors
Returns an error if:
- The Dockerfile is not found at the configured path
- Docker build command fails
- Container startup fails
- Port mapping fails
Sourcepub async fn start() -> Result<Self, SshServerError>
pub async fn start() -> Result<Self, SshServerError>
Start a real SSH server container with default configuration
This is a convenience method that starts a container with default
configuration values from constants. For custom configuration,
use Self::start_with_config.
§Returns
A real container with SSH server running, or an error if Docker is not available or the image cannot be built/started.
§Errors
Returns an error if:
- The
docker/ssh-server/Dockerfileis not found - Docker build command fails
- Container startup fails
- Port mapping fails
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 !RefUnwindSafe for RealSshServerContainer
impl !UnwindSafe for RealSshServerContainer
impl Freeze for RealSshServerContainer
impl Send for RealSshServerContainer
impl Sync for RealSshServerContainer
impl Unpin for RealSshServerContainer
impl UnsafeUnpin for RealSshServerContainer
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