From 848cc938b7f9fa72553a8aaa80c644cc8d5240f4 Mon Sep 17 00:00:00 2001 From: David Tsukernik Date: Thu, 12 Sep 2024 15:58:06 -0700 Subject: [PATCH] Fix typing issues --- snuba/admin/clickhouse/migration_checks.py | 2 +- snuba/admin/views.py | 2 +- snuba/migrations/runner.py | 2 +- .../test_migration_checks.py | 17 ++++++++++------- 4 files changed, 13 insertions(+), 10 deletions(-) diff --git a/snuba/admin/clickhouse/migration_checks.py b/snuba/admin/clickhouse/migration_checks.py index 0439d56956..8fdd9e495b 100644 --- a/snuba/admin/clickhouse/migration_checks.py +++ b/snuba/admin/clickhouse/migration_checks.py @@ -100,7 +100,7 @@ def __init__( ).get_migrations() migration_statuses = {} - for migration_id, status, _ in migrations: + for migration_id, status, _, _ in migrations: migration_statuses[migration_id] = { "migration_id": migration_id, "status": status, diff --git a/snuba/admin/views.py b/snuba/admin/views.py index 91136e1646..9942b55419 100644 --- a/snuba/admin/views.py +++ b/snuba/admin/views.py @@ -208,7 +208,7 @@ def migrations_groups_list(group: str) -> Response: "status": status.value, "blocking": blocking, } - for migration_id, status, blocking in runner_group_migrations + for migration_id, status, blocking, _ in runner_group_migrations ] ), 200, diff --git a/snuba/migrations/runner.py b/snuba/migrations/runner.py index 27089c2f1d..1c5b8c8db6 100644 --- a/snuba/migrations/runner.py +++ b/snuba/migrations/runner.py @@ -149,7 +149,7 @@ def show_all( migration_groups = get_active_migration_groups() migration_status = self._get_migration_status(migration_groups) - clickhouse_group_migrations = {} + clickhouse_group_migrations: MutableMapping[MigrationGroup, List[str]] = {} for group, migration_id in migration_status.keys(): clickhouse_group_migrations.setdefault(group, []).append(migration_id) diff --git a/tests/admin/clickhouse_migrations/test_migration_checks.py b/tests/admin/clickhouse_migrations/test_migration_checks.py index 7ad0790759..198ef35dca 100644 --- a/tests/admin/clickhouse_migrations/test_migration_checks.py +++ b/tests/admin/clickhouse_migrations/test_migration_checks.py @@ -29,9 +29,9 @@ def group_loader() -> GroupLoader: RUN_MIGRATIONS: Sequence[MigrationDetails] = [ - MigrationDetails("0001", Status.COMPLETED, True), - MigrationDetails("0002", Status.NOT_STARTED, True), - MigrationDetails("0003", Status.NOT_STARTED, True), + MigrationDetails("0001", Status.COMPLETED, True, True), + MigrationDetails("0002", Status.NOT_STARTED, True, True), + MigrationDetails("0003", Status.NOT_STARTED, True, True), ] @@ -62,9 +62,9 @@ def test_status_checker_run( REVERSE_MIGRATIONS: Sequence[MigrationDetails] = [ - MigrationDetails("0001", Status.COMPLETED, True), - MigrationDetails("0002", Status.IN_PROGRESS, True), - MigrationDetails("0003", Status.NOT_STARTED, True), + MigrationDetails("0001", Status.COMPLETED, True, True), + MigrationDetails("0002", Status.IN_PROGRESS, True, True), + MigrationDetails("0003", Status.NOT_STARTED, True, True), ] @@ -155,7 +155,10 @@ def test_run_migration_checks_and_policies( mock_policy = Mock() checker = mock_checker() mock_runner.show_all.return_value = [ - (MigrationGroup("events"), [MigrationDetails("0001", Status.COMPLETED, True)]) + ( + MigrationGroup("events"), + [MigrationDetails("0001", Status.COMPLETED, True, True)], + ) ] mock_policy.can_run.return_value = policy_result[0]