Expand description
Docker-based SMB test servers for integration testing.
Provides TestServers for starting Samba containers on demand,
with factory methods that return connected SmbClient instances.
Enable the testing feature flag to use this module.
§Three-layer testing model
Layer 1: Rust integration tests – Use TestServers to get
pre-connected clients in #[tokio::test] functions.
Layer 2: E2E tests – Use write_compose_files to extract
embedded Docker infrastructure, then run docker compose up from
your test framework (Playwright, Cypress, etc.).
Layer 3: Manual QA – Extract compose files once, run containers manually, browse virtual servers in your app during development.
§Example
use std::sync::LazyLock;
use smb2::testing::TestServers;
static SERVERS: LazyLock<TestServers> = LazyLock::new(|| {
TestServers::start_blocking().unwrap()
});
let mut guest = SERVERS.guest_client().await.unwrap();
let shares = guest.list_shares().await.unwrap();Structs§
- Test
Servers - Docker-based SMB test servers for integration testing.
Enums§
- Error
- Errors from the test infrastructure (Docker, process, health checks).
Functions§
- auth_
port - Port for the auth-required container.
- both_
port - Port for the mixed auth container.
- deepnest_
port - Port for the deep-nesting container.
- flaky_
port - Port for the flaky container.
- guest_
port - Port for the guest-access container.
- linux_
port - Port for the Linux container.
- longnames_
port - Port for the long-names container.
- many_
shares_ port - Port for the 50-shares container.
- manyfiles_
port - Port for the many-files container.
- maxreadsize_
port - Port for the max-read-size container.
- readonly_
port - Port for the read-only container.
- slow_
port - Port for the slow container.
- synology_
port - Port for the Synology-like container.
- unicode_
port - Port for the unicode container.
- windows_
port - Port for the Windows-like container.
- write_
compose_ files - Write all embedded Docker files to the given directory.
Type Aliases§
- Result
- Result type for test infrastructure operations.