M5-T09: add exposed_entities table and ExposableEntity provider framework
This commit is contained in:
@@ -144,7 +144,13 @@ def test_modbus_reading_recorded_at_index_exists(modbus_db):
|
||||
|
||||
|
||||
def test_downgrade_removes_modbus_tables(tmp_path: Path):
|
||||
"""downgrade -1 from head must drop both modbus tables cleanly."""
|
||||
"""Downgrading past the modbus migration must drop both modbus tables cleanly.
|
||||
|
||||
We downgrade to the explicit revision ``20260621_08_totp`` (the down_revision
|
||||
of the modbus tables migration), so the test stays correct as new revisions
|
||||
are added on top. Using an explicit target rather than ``-2`` avoids drift
|
||||
with chain growth (same fix pattern as T02 applied to the TOTP downgrade test).
|
||||
"""
|
||||
db_path = tmp_path / "downgrade_modbus_test.db"
|
||||
db_url = f"sqlite:///{db_path}"
|
||||
alembic_cfg = _make_app_alembic_config(db_url)
|
||||
@@ -157,8 +163,11 @@ def test_downgrade_removes_modbus_tables(tmp_path: Path):
|
||||
assert "modbus_reading" in inspector.get_table_names()
|
||||
engine.dispose()
|
||||
|
||||
# Downgrade one step removes the modbus migration.
|
||||
command.downgrade(alembic_cfg, "-1")
|
||||
# Downgrade to the explicit down_revision of the modbus tables migration
|
||||
# ("20260621_08_totp"), consistent with how T02 fixed the TOTP downgrade test.
|
||||
# Using an explicit target instead of "-2" ensures the test stays correct even
|
||||
# as new revisions are added on top of this one (no drift with chain growth).
|
||||
command.downgrade(alembic_cfg, "20260621_08_totp")
|
||||
|
||||
engine = create_engine(db_url, connect_args={"check_same_thread": False})
|
||||
inspector = inspect(engine)
|
||||
|
||||
Reference in New Issue
Block a user