Improve recorder tests to check indices are removed (#125164)
parent
c4cfff4b3f
commit
d8382c6de2
|
@ -35,6 +35,7 @@ from homeassistant.components.recorder.queries import (
|
|||
from homeassistant.components.recorder.tasks import EntityIDPostMigrationTask
|
||||
from homeassistant.components.recorder.util import (
|
||||
execute_stmt_lambda_element,
|
||||
get_index_by_name,
|
||||
session_scope,
|
||||
)
|
||||
from homeassistant.core import HomeAssistant
|
||||
|
@ -333,6 +334,10 @@ async def test_migrate_events_context_ids(
|
|||
== migration.EventsContextIDMigration.migration_version
|
||||
)
|
||||
|
||||
# Check the index which will be removed by the migrator no longer exists
|
||||
with session_scope(hass=hass) as session:
|
||||
assert get_index_by_name(session, "states", "ix_states_context_id") is None
|
||||
|
||||
|
||||
@pytest.mark.parametrize("enable_migrate_context_ids", [True])
|
||||
@pytest.mark.usefixtures("db_schema_32")
|
||||
|
@ -531,6 +536,10 @@ async def test_migrate_states_context_ids(
|
|||
== migration.StatesContextIDMigration.migration_version
|
||||
)
|
||||
|
||||
# Check the index which will be removed by the migrator no longer exists
|
||||
with session_scope(hass=hass) as session:
|
||||
assert get_index_by_name(session, "states", "ix_states_context_id") is None
|
||||
|
||||
|
||||
@pytest.mark.parametrize("enable_migrate_event_type_ids", [True])
|
||||
@pytest.mark.usefixtures("db_schema_32")
|
||||
|
|
Loading…
Reference in New Issue