test(migrations): Deflake test_reverse_idempotency_all#8038
Open
phacops wants to merge 1 commit into
Open
Conversation
test_reverse_idempotency_all snapshots `system.tables` before and after a reverse/fake-forward cycle and compares the two results for equality. The query had no ORDER BY, and `system.tables` has no guaranteed row order, so the comparison was order-sensitive: the reverse_twice() cycle in between (ON CLUSTER DDL re-registering tables in the distributed setup) could change the order rows are returned in without changing the set of tables, producing intermittent failures in the test_migrations_distributed CI job. Order both snapshots by create_table_query so the assertion reflects the set of tables and their definitions rather than the iteration order. A genuine difference in tables or definitions is still caught. Also replace `exc.value.args[0]` with `str(exc.value)` in test_check_inactive_replica: a pre-existing mypy error in this file that pre-commit only surfaces when the file is otherwise modified. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> Agent transcript: https://claudescope.sentry.dev/share/k51suCCzzW9KZZdJFGzOKnV-1ugFp1MOIK3FsEnHXSA
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
test_reverse_idempotency_allsnapshotssystem.tablesbefore and after a reverse/fake-forward cycle and compares the two results for equality. The snapshot query had noORDER BY, andsystem.tableshas no guaranteed row order, so the comparison was order-sensitive.In the distributed setup the
reverse_twice()cycle between the two snapshots issuesON CLUSTERDDL (CREATE … IF NOT EXISTS/DROP … IF EXISTS) which can re-register tables and change the order rows come back in without changing the set of tables. That produced intermittent failures in thetest_migrations_distributedCI job — e.g. on #7980, whose latest EAP migration drops and recreates three downsample materialized views on reverse, which is exactly the kind of churn that perturbs the row order. The reverse cycle itself is a no-op on the table set (fake-forward only updates status; the create/drop are guarded byIF [NOT] EXISTS), so the failures were spurious, not real state differences.This orders both snapshots by
create_table_queryso the assertion reflects the set of tables and their definitions rather than the iteration order. A genuine difference in tables or definitions is still caught.Also replaces
exc.value.args[0]withstr(exc.value)intest_check_inactive_replica— a pre-existing mypy error (BaseExcT_co_default has no attribute "args") in this file thatpre-commitonly surfaces once the file is otherwise modified.str(exc.value)is the equivalent message check and types cleanly.Agent transcript: https://claudescope.sentry.dev/share/5BgPWGjZzfAo_gfbl1kqFzjsOJKf5sz8T4u3s0en9OY