Simplify testing infrastructure to use Testcontainers
Goal
Simplify the testing infrastructure by migrating from GitHub Actions services to Testcontainers, which will make tests easier to run locally and maintain.
Current State
The CI workflow currently uses GitHub Actions services for various providers. Here are the Docker images being used:
Database Providers
- Redis:
redis(latest) - PostgreSQL:
postgres(latest) - MariaDB/MySQL:
mariadb:10.6 - SQL Server:
mcr.microsoft.com/mssql/server:latest
Azure Services
- Azure Storage (Azurite):
mcr.microsoft.com/azure-storage/azurite:latest
Clustering Providers
- ZooKeeper:
zookeeper:3.9 - Consul: (uses local installation, not containerized yet)
AWS Providers
- DynamoDB:
amazon/dynamodb-local:latest
Streaming Providers
- NATS:
nats:latest(started with--js --http-port=8222flags)
Not Containerized
- Cassandra: Currently uses environment variable
CASSANDRAVERSIONwith versions 4.0, 4.1, 5.0 (needs investigation on how it's started) - Cosmos DB: Currently disabled (
if: ${{ false }}) - uses Azure Cosmos DB Emulator on Windows
Tasks
- [ ] Migrate Redis tests to Testcontainers
- [ ] Migrate PostgreSQL tests to Testcontainers
- [ ] Migrate MariaDB/MySQL tests to Testcontainers
- [ ] Migrate SQL Server tests to Testcontainers
- [ ] Migrate Azure Storage (Azurite) tests to Testcontainers
- [ ] Migrate ZooKeeper tests to Testcontainers
- [ ] Migrate Consul tests to Testcontainers #9707
- [ ] Migrate DynamoDB tests to Testcontainers
- [ ] Migrate NATS tests to Testcontainers
- [ ] Migrate Cassandra tests to Testcontainers (versions 4.0, 4.1, 5.0)
- [ ] Investigate and migrate Cosmos DB tests to Testcontainers (if feasible)
- [ ] Update documentation for running tests locally
- [ ] Remove GitHub Actions services configuration from CI workflow
Migration Plan
For each provider, we should:
- Replace GitHub Actions
serviceswith Testcontainers equivalents - Ensure tests can run both in CI and locally
- Maintain the same test coverage and configuration
- Update documentation for running tests locally
Benefits
- Local Development: Developers can run all provider tests locally without manual setup
- Consistency: Same container images used in CI and local development
- Maintainability: Easier to update versions and configurations
- Cross-platform: Works on Windows, Linux, and macOS (where Docker is available)
@ReubenBond thoughts on this?
If this works well with GitHub Actions and other CIs, then I'm all for it.
I don't see a testcontainers package for zookeeper
Ceeared https://github.com/testcontainers/testcontainers-dotnet/issues/1560 or we could use the generic container and handle this one last
I added the TestContainers packages to the .NET feed, they should be there now.