crates/infrastructure/TESTS.md
This directory contains infrastructure integration tests that require external services.
All required services are defined in .docker/docker-compose.yml.
The integration tests require the following services to be running:
localhost:5432localhost:6379nautilus, Password pass, Database nautilushttp://localhost:5051 ([email protected] / admin)Use the following make targets to manage the services:
make init-services # Start containers and initialize database schema
make stop-services # Stop development services (preserves data)
make start-services # Start development services (without reinitializing database)
make purge-services # Remove everything including data volumes
make init-servicesmake stop-servicesmake start-servicesmake purge-services then make init-servicesOnce services are running (and NautilusTrader installed by uv or make):
# Run all infrastructure tests
uv run --no-sync pytest tests/integration_tests/infrastructure/
# Run specific test file
uv run --no-sync pytest tests/integration_tests/infrastructure/test_cache_database_redis.py
uv run --no-sync pytest tests/integration_tests/infrastructure/test_cache_database_postgres.py
The Rust integration tests are located in crates/infrastructure/tests/ and require the same services.
# Run all Rust integration tests (includes Redis and PostgreSQL tests)
make cargo-test-crate-nautilus-infrastructure
# Using cargo nextest directly with the standard profile
# Run all infrastructure tests with output visible for debugging
cargo nextest run --lib --no-fail-fast --cargo-profile nextest -p nautilus-infrastructure --features redis,postgres --no-capture
# Run only Redis integration tests
cargo nextest run --lib --no-fail-fast --cargo-profile nextest -p nautilus-infrastructure --features redis,postgres -E 'test(test_cache_redis)'
# Run only PostgreSQL integration tests
cargo nextest run --lib --no-fail-fast --cargo-profile nextest -p nautilus-infrastructure --features redis,postgres -E 'test(test_cache_postgres) or test(test_cache_database_postgres)'
Note: Both Redis and PostgreSQL feature flags are in given examples to avoid rebuild.
Rust infrastructure integration tests are marked with #[cfg(target_os = "linux")] and will only run on Linux.
They use the serial_test crate to ensure tests that access the same database don't run concurrently.