25 lines
2.1 KiB
Markdown
25 lines
2.1 KiB
Markdown
# Schema Evolution Testing
|
|
|
|
## Module
|
|
__Tests
|
|
|
|
## Status
|
|
IMPLEMENTED
|
|
|
|
## Description
|
|
Schema evolution test base for verifying database migration forward/backward compatibility in CI.
|
|
|
|
## Implementation Details
|
|
- **Schema Evolution Test Base**: `src/__Tests/__Libraries/StellaOps.Testing.SchemaEvolution/SchemaEvolutionTestBase.cs` -- abstract xUnit test base class for schema evolution tests; provides infrastructure to apply migrations forward and backward, verifying data integrity at each step.
|
|
- **Postgres Schema Evolution Test Base**: `src/__Tests/__Libraries/StellaOps.Testing.SchemaEvolution/PostgresSchemaEvolutionTestBase.cs` -- PostgreSQL-specific schema evolution test base using Testcontainers to spin up ephemeral databases for migration testing.
|
|
- **Schema Evolution Models**: `src/__Tests/__Libraries/StellaOps.Testing.SchemaEvolution/Models.cs` -- data models for schema evolution test state (migration version, schema snapshot, data integrity checks).
|
|
- **Postgres Integration Fixture**: `src/__Tests/__Libraries/StellaOps.Infrastructure.Postgres.Testing/PostgresIntegrationFixture.cs` -- Testcontainers-based PostgreSQL fixture for integration tests.
|
|
- **Migration Test Attribute**: `src/__Tests/__Libraries/StellaOps.Infrastructure.Postgres.Testing/MigrationTestAttribute.cs` -- xUnit attribute marking tests as migration tests requiring database setup.
|
|
|
|
## E2E Test Plan
|
|
- [ ] Create a `PostgresSchemaEvolutionTestBase` subclass, apply all migrations forward on an empty database, and verify the final schema matches the expected structure
|
|
- [ ] Apply a migration forward, insert test data, apply the next migration, and verify the data is preserved (forward compatibility)
|
|
- [ ] Apply all migrations forward, then roll back the last migration, and verify the data remains intact (backward compatibility)
|
|
- [ ] Verify the `MigrationTestAttribute` correctly identifies and runs migration-specific tests in the CI pipeline
|
|
- [ ] Run schema evolution tests for two different modules (e.g., Authority and Findings) in parallel on separate Testcontainers instances and verify no cross-contamination
|