test(e2e): add no-restart back-migration variant + refactor shared scaffolding#3388
test(e2e): add no-restart back-migration variant + refactor shared scaffolding#3388barakeinav1 wants to merge 1 commit into
Conversation
…affolding The existing `migration_service__should_handle_back_migration_a_to_b_to_a` kill+restart's A0 between the forward and back directions to model the disk-persisted-state scenario from #2121. That kill+restart is also the trigger for the upstream nearcore indexer panic surfaced via #3366, which flakes the test on branches that produce additional sandbox chain activity. This commit: - Adds `migration_service__should_handle_back_migration_a_to_b_to_a_no_restart`, a stable sibling that exercises the back-migration code path through A0's in-memory state transitions (no kill+restart, no restart-time indexer catch-up). - Factors the shared round-trip scaffolding (cluster setup, sanity asserts, forward, sign+ckd, back, kill B0, final asserts) into `run_back_migration_round_trip(port_seed, between)`. - Splits the kill+restart-specific block (keyshare snapshots, indexer-height snapshot, kill/start/health/indexer-wait, keyshare-preserved assert) into the `BetweenDirections::KillAndRestartA` arm. The new no-restart test uses `BetweenDirections::None`. The two #[tokio::test] entry points are now one-line wrappers that differ only in port seed and the between-directions variant. The kill+restart test stays the #2121 regression coverage; the no-restart test gives CI a non-flaky back-migration check while the upstream indexer panic is open.
Pull request overviewTest-only change in Changes:
Reviewed changesPer-file summary
FindingsNo blocking issues. The refactor is behaviour-preserving for the existing Non-blocking (nits, follow-ups):
✅ Approved |
There was a problem hiding this comment.
Pull request overview
Adds a stable no-restart back-migration E2E variant while keeping the existing kill+restart coverage, and refactors shared A→B→A migration setup into a common helper.
Changes:
- Introduces
BetweenDirectionsandrun_back_migration_round_trip(...)to share common test scaffolding. - Adds
migration_service__should_handle_back_migration_a_to_b_to_a_no_restart. - Adds a dedicated port seed for the new E2E test.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
crates/e2e-tests/tests/migration_service.rs |
Refactors back-migration test flow and adds the no-restart variant. |
crates/e2e-tests/tests/common.rs |
Adds a unique port seed for the new back-migration no-restart test. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Summary
Adds a second back-migration test that does not kill+restart A0 between the forward and back directions, and refactors the shared scaffolding so the two tests share their setup/teardown.
Why a no-restart variant
migration_service__should_handle_back_migration_a_to_b_to_a(existing) kill+restart's A0 to model the disk-persisted-state scenario investigated in #2121. That kill+restart is also the trigger for the upstream nearcore indexer panic surfaced via #3366 — see the diagnostic report for thechain/indexer/src/streamer/mod.rs:207expect("receipt must be present at this moment")panic. On branches that produce more sandbox chain activity than plain main, A0's post-restart indexer catch-up hits that panic and the test flakes.Until the upstream nearcore fix lands, this PR adds
migration_service__should_handle_back_migration_a_to_b_to_a_no_restart— a stable sibling that exercises the back-migration code path through A0's in-memory state transitions, with no kill+restart and no restart-time catch-up.What each test covers
…_a_to_b_to_a(existing)…_a_to_b_to_a_no_restart(new)Refactor
The two tests previously had ~85% identical bodies (cluster setup, sanity asserts, forward A→B, post-forward sign+ckd, back B→A, kill B0, final sign+ckd). I factored that into
run_back_migration_round_trip(port_seed, between)with a smallBetweenDirectionsenum (NonevsKillAndRestartA). Each#[tokio::test]is now a one-line wrapper that picks the port seed and variant.The kill+restart-specific block (keyshare snapshots, indexer-height snapshot, kill/start/health/indexer-wait, keyshare-preserved assert) lives inside the
KillAndRestartAmatch arm.Test plan
cargo check --tests -p e2e-testsclean