You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
42 lines
1.0 KiB
Python
42 lines
1.0 KiB
Python
"""Integration test: verify all tables exist after migration."""
|
|
|
|
import pytest
|
|
from sqlalchemy import text
|
|
|
|
EXPECTED_TABLES = [
|
|
"issuer_master",
|
|
"symbol_master",
|
|
"job_runs",
|
|
"documents",
|
|
"document_exhibits",
|
|
"exhibit_cache",
|
|
"events",
|
|
"event_parses",
|
|
"macro_series",
|
|
"macro_observations",
|
|
"short_sale_daily",
|
|
"feature_snapshots",
|
|
"order_plans",
|
|
"sync_checkpoints",
|
|
]
|
|
|
|
|
|
@pytest.mark.integration
|
|
@pytest.mark.asyncio
|
|
async def test_all_tables_exist(db_session):
|
|
"""All expected tables should exist after migration."""
|
|
result = await db_session.execute(
|
|
text("SELECT table_name FROM information_schema.tables WHERE table_schema = 'public'")
|
|
)
|
|
existing = {row[0] for row in result}
|
|
for table in EXPECTED_TABLES:
|
|
assert table in existing, f"Table {table!r} missing after migration"
|
|
|
|
|
|
@pytest.mark.integration
|
|
@pytest.mark.asyncio
|
|
async def test_db_health(db_session):
|
|
from libs.db.helpers import health_check
|
|
|
|
assert await health_check(db_session) is True
|