Overview
S2 Lite can run entirely in-memory without any external dependencies, making it an excellent emulator for integration testing. This eliminates the need for complex test infrastructure while ensuring your tests run against a real S2 implementation.Running S2 Lite In-Memory
Using Docker
The simplest way to run S2 Lite for testing is with Docker:Using the CLI
If you have the S2 CLI installed:Data stored in in-memory mode is lost when the process stops. This is perfect for tests that need a clean state.
Configuring Your Tests
To connect your tests to the local S2 Lite instance, configure the SDK endpoints:Example Test Setup
Rust
TypeScript
Go
Waiting for S2 Lite to be Ready
Before running tests, ensure S2 Lite is ready:Creating Test Basins
For tests, create basins with auto-creation of streams enabled:Best Practices
Use Unique Basin Names
Generate unique basin names per test or test suite to avoid conflicts:Clean Up Resources
While in-memory mode loses all data on restart, consider cleaning up basins and streams explicitly:Parallel Test Execution
Since each test can use unique basin names, tests can run in parallel without conflicts:CI/CD Integration
GitHub Actions
Docker Compose
Advanced: Local Disk Persistence
For tests that need persistence across restarts, use--local-root:
Local disk persistence is useful for debugging failed tests or testing recovery scenarios.