feat: add alembic migrations and PostgreSQL CI support
Some checks failed
ci/woodpecker/pr/pipeline Pipeline failed
Some checks failed
ci/woodpecker/pr/pipeline Pipeline failed
- Add alembic dependency and initialize migration framework - Configure async alembic env.py for SQLAlchemy 2.0 - Create initial migration for PostORM table - Gate init_db() with SKIP_INIT_DB env var for CI/production - Add PostgreSQL service to Woodpecker CI pipeline - Create integration tests for migrations (TC-INT-001..002) - Create integration tests for SQLAlchemyPostRepository (TC-INT-003..009) - Add unit test for init_db skip behavior (TC-UNIT-901) - All 176 tests pass, coverage 72.59%
This commit is contained in:
18
tests/unit/infrastructure/database/test_connection.py
Normal file
18
tests/unit/infrastructure/database/test_connection.py
Normal file
@@ -0,0 +1,18 @@
|
||||
import os
|
||||
from unittest.mock import patch
|
||||
|
||||
import pytest
|
||||
|
||||
from app.infrastructure.database.connection import init_db
|
||||
|
||||
|
||||
class TestInitDB:
|
||||
@pytest.mark.asyncio
|
||||
async def test_init_db_skipped_when_skip_env_set(self) -> None:
|
||||
with patch.dict(os.environ, {"SKIP_INIT_DB": "1"}):
|
||||
await init_db()
|
||||
|
||||
@pytest.mark.asyncio
|
||||
async def test_init_db_runs_when_no_env(self) -> None:
|
||||
with patch.dict(os.environ, {}, clear=True):
|
||||
await init_db()
|
||||
Reference in New Issue
Block a user