mirror of
https://github.com/langbot-app/LangBot.git
synced 2026-06-12 00:36:03 +00:00
feat(test): add PostgreSQL migration slow integration tests (G-003)
- Add tests/integration/persistence/test_migrations_postgres.py - All tests marked with @pytest.mark.slow - Tests skip when TEST_POSTGRES_URL is not set (no local PostgreSQL) - Database isolation via clean_tables and clean_alembic_version fixtures - Update CI workflow to use pytest instead of inline Python script - Remove TODO(G-003) comment - Update tests/README.md with PostgreSQL test documentation Covered scenarios: - Baseline stamp sets revision - Upgrade from baseline to head - Upgrade idempotent - Get current on unstamped DB returns None Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
@@ -244,8 +244,27 @@ SQLite migration tests can be run locally without any external dependencies:
|
||||
uv run pytest tests/integration/persistence/test_migrations.py -q --tb=short
|
||||
```
|
||||
|
||||
CI workflow `.github/workflows/test-migrations.yml` runs SQLite tests using pytest.
|
||||
PostgreSQL migration tests still use inline Python script (will be migrated to pytest in G-003).
|
||||
PostgreSQL migration tests require an external PostgreSQL database:
|
||||
|
||||
```bash
|
||||
# PostgreSQL migration tests (requires PostgreSQL service)
|
||||
# Tests are marked as slow and skipped if TEST_POSTGRES_URL is not set
|
||||
TEST_POSTGRES_URL=postgresql+asyncpg://user:pass@localhost:5432/test_db \
|
||||
uv run pytest tests/integration/persistence/test_migrations_postgres.py -q --tb=short
|
||||
|
||||
# Or skip by default (no PostgreSQL available)
|
||||
uv run pytest tests/integration/persistence/test_migrations_postgres.py -q --tb=short
|
||||
# Output: SKIPPED (TEST_POSTGRES_URL not set)
|
||||
```
|
||||
|
||||
Note: PostgreSQL tests are **not** included in fast integration gate because they:
|
||||
- Require external PostgreSQL service
|
||||
- Are marked with `@pytest.mark.slow`
|
||||
- Need `TEST_POSTGRES_URL` environment variable
|
||||
|
||||
CI workflow `.github/workflows/test-migrations.yml` runs:
|
||||
- SQLite tests in `test-migrations-sqlite` job (fast, no external services)
|
||||
- PostgreSQL tests in `test-migrations-postgres` job (uses PostgreSQL service container)
|
||||
|
||||
### Running pipeline integration tests locally
|
||||
|
||||
@@ -367,8 +386,8 @@ Check that you're mocking at the right level and using `AsyncMock` for async fun
|
||||
## Future Enhancements
|
||||
|
||||
- [x] Add integration tests for database migrations (SQLite)
|
||||
- [ ] Add PostgreSQL migration integration tests (G-003)
|
||||
- [ ] Add integration tests for full pipeline execution
|
||||
- [x] Add PostgreSQL migration integration tests (G-003)
|
||||
- [x] Add integration tests for full pipeline execution
|
||||
- [x] Add API smoke integration tests
|
||||
- [ ] Add E2E tests
|
||||
- [ ] Add performance benchmarks
|
||||
|
||||
Reference in New Issue
Block a user