Repository navigation
test(backup): wait for the server in two flaky backup tests - #983
Closed
LeeroyHannigan wants to merge 2 commits into
Closed
LeeroyHannigan wants to merge 2 commits into
LeeroyHannigan wants to merge 2 commits into
Conversation
test_a_row_that_lands_during_the_moves_sync_exits_1 let the held CreateBackup insert go when the move printed that it syncs the configured store. It then depended on the sync's listing of 2,000 junk prefixes taking longer than the insert's commit. On a fast runner the sync read the other stores' rows first and found no row of the old root, so the report did not name the job's row. The test failed this way on main at 89b9427 and 9a1105b, and in the merge queue for #927 and #823. The move now writes to a pipe that the test stops reading at that line. The sync's report of the junk prefixes fills the pipe, so the move cannot reach its read of the other stores' rows before the test reads again. The test reads again once the job's row is in the catalog under the old root. The test reads the pipe with _read_until, which moves from tests/test_cli_migrate_concurrency.py to tests/lifecycle_helpers.py so both tests use one copy. Signed-off-by: Lee Hannigan <29015211+LeeroyHannigan@users.noreply.github.com>
test_a_tampered_data_file_fails_the_restore_before_any_item read the server log once, as soon as DescribeTable answered that the target was gone. The restore job writes its FAILED line after it removes the target, so on a fast runner the test read the log before the line was there and found no FAILED line. The test failed this way on main at bf5ea8f and 511d6c7. The test now uses _restore_fails, which the other failing-restore tests in the file use. It polls the log for the FAILED line for up to 15 s after the target is gone, and it checks that the target stays CREATING until it is removed. Signed-off-by: Lee Hannigan <29015211+LeeroyHannigan@users.noreply.github.com>
LeeroyHannigan
requested review from
amrith,
c33howard,
eliseong,
hitesh96db,
jcshepherd,
navareamol,
pdf-amzn and
robinnsc
as code owners
November 12, 2026 20:53
4 of 8 tasks
Collaborator
Author
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.
What
Two tests in
tests/test_backup_job.pyread the server's output before the server wrote what they check. Each test now waits for it.test_a_row_that_lands_during_the_moves_sync_exits_1:_read_untilmoves fromtests/test_cli_migrate_concurrency.pytotests/lifecycle_helpers.py, and both test modules use it.test_a_tampered_data_file_fails_the_restore_before_any_itemnow uses_restore_fails, as the other failing-restore tests in the file do. The helper polls the server log for the FAILED line for up to 15 s after the target is gone.Both tests check what they checked before. No production code changes.
Why
Both tests failed on main and in the merge queue.
Testing done
I ran the tests in a container as root, where root owns every parent directory of the backup root, as the filesystem backup store requires. The server was a release PostgreSQL build of this branch, against PostgreSQL 16.
With the 3 s wait, main's move test fails at the same assertion as in CI, and the report shows "Rows of other stores: (none)". The wait does not change the result on this branch. The move cannot read the other stores' rows until the test reads the pipe again.
A build with the landed-row report removed from
crates/app/src/cmd_backup.rsfailed the move test at that assertion in 2 of 2 runs. That run used the first version of this change, which had the same assertions.The tampered-file test failed on the SQLite shards in CI. I ran it on PostgreSQL, and CI runs it on both.
tests/test_cli_migrate_concurrency.pyis the other user of_read_until. Its 3 tests pass.Checklist
cargo test --workspace)cargo fmt --check)cargo clippy -- -W clippy::pedantic)Storagetrait, auth model, on-diskformat, or public CLI surface, an RFC has been accepted or is linked
below. Otherwise, an ADR captures the decision (link below).
ADR / RFC: n/a
By submitting this pull request, I confirm that my contribution is made under
the terms of the Apache License 2.0 and I agree to the Developer Certificate of
Origin (DCO). See CONTRIBUTING.md for details.