mirror of
https://github.com/home-assistant/core.git
synced 2025-07-23 13:17:32 +00:00
Improve recorder tests to check indices are removed (#125164)
This commit is contained in:
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.tasks import EntityIDPostMigrationTask
|
||||||
from homeassistant.components.recorder.util import (
|
from homeassistant.components.recorder.util import (
|
||||||
execute_stmt_lambda_element,
|
execute_stmt_lambda_element,
|
||||||
|
get_index_by_name,
|
||||||
session_scope,
|
session_scope,
|
||||||
)
|
)
|
||||||
from homeassistant.core import HomeAssistant
|
from homeassistant.core import HomeAssistant
|
||||||
@ -333,6 +334,10 @@ async def test_migrate_events_context_ids(
|
|||||||
== migration.EventsContextIDMigration.migration_version
|
== 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.parametrize("enable_migrate_context_ids", [True])
|
||||||
@pytest.mark.usefixtures("db_schema_32")
|
@pytest.mark.usefixtures("db_schema_32")
|
||||||
@ -531,6 +536,10 @@ async def test_migrate_states_context_ids(
|
|||||||
== migration.StatesContextIDMigration.migration_version
|
== 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.parametrize("enable_migrate_event_type_ids", [True])
|
||||||
@pytest.mark.usefixtures("db_schema_32")
|
@pytest.mark.usefixtures("db_schema_32")
|
||||||
|
Loading…
x
Reference in New Issue
Block a user