Repository navigation
test: two flaky tests made reliable without weakening them - #260
Merged
Merged
Conversation
`a_change_reported_twice_makes_one_deadline_for_every_service` failed on the macOS runner with a service 153 ms past its deadline: the VM oversleeps. The regression it guards (#233, a pipeline that looked every 200 ms from when its thread began) is late by the same ~180 ms at every try; an oversleep is late now and then. A late try is now tried again, three times at most, with the same 100 ms bound. With the 200 ms poll put back, all three tries fail (a 181, 183, 181 ms late). `a_hub_answers_once_its_port_takes_connections` failed on ubuntu 6 ms after it began: the probe connected to the port before the hub, which waits 4 s for its `docker`, could have bound it. Something else had the port for a moment, and `hub status` then found nothing there. The tests' hub is up once its hub.json names its pid and port and the port takes a connection; a hub that exits first says so. `free_port` no longer hands two tests of the binary the same port. With the bind moved back before the setup, the test still fails as before. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Merged
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.
Two tests that turned pull requests red on unrelated changes. Tests only, so there is no CHANGELOG entry.
a_change_reported_twice_makes_one_deadline_for_every_service(daemon, candidate pipeline)Cause:
check (macos-14)failed with "a fired 153.00925ms after its deadline". The macOS runner is a VM and oversleeps. The test allowed 100 ms pastrepeat + DEBOUNCEon a single try.Fix: the regression this test guards (#233) is a pipeline that looks every 200 ms, counted from when its thread began. That regression is late by the same ~180 ms on every try, while an oversleep is late only now and then. The scenario is now its own function (
one_edit_reported_twice). A late try is run again, three times at most, and the 100 ms bound stays the same. "Never before the deadline" is still checked on every try. The fixed 300 ms sleep before checking that each pipeline is done is now a wait of up to 5 s.Checked against the regression: I put back
sleep(200 ms)in place ofsleep(left)and the test failed on all three tries:awas 181, 183 and 181 ms late,b1 to 3 ms.a_hub_answers_once_its_port_takes_connections(hub)Cause: in run 39976589586 (ubuntu) the test failed 6 ms after the test binary began, with
hub not running. The hub under test waits 4 s for its fakedockerbefore it binds, so the probe instart_env(the port takes a TCP connection) connected to something else that had the port for a moment.hub statusthen found nothing there.connect(), and the port was odd. I checked this with 60 000 connects to an unbound port here and none connected.bind(0), and the kernel can hand out a port it just gave away.Fix (tests only):
start_envcounts the hub as up only once the hub'shub.jsonnames the child's pid and the port, and the port takes a connection. The hub writes that file right after it binds.free_portno longer gives two tests of the binary the same port.Checked against the regression: I moved the bind back before the setup (the bug from #228) and the test still fails ("port … answers, but not as a devstack hub of this user").
Verification (Linux)
a_change_reported_twice…: passed 20/20, and 10/10 with all 16 cores kept busy byyes.--test hub(all 15 tests): passed 20/20.cargo fmt --checkandcargo clippy -p devstack-daemon -p devstack --all-targets -- -D warningsare clean.check (macos-14)run is the first evidence. The hub test is#[cfg(unix)]and also runs there.🤖 Generated with Claude Code