mirror of
https://github.com/home-assistant/core.git
synced 2025-08-05 13:45:12 +02:00
Improve recorder tests to check indices are removed (#125164)
This commit is contained in:
@@ -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")
|
||||
|
Reference in New Issue
Block a user