test(log): take the second server's port when it binds it - #301
Merged
Merged
Conversation
Both tests reserved two ports with `tas_free_port_span(2)`, ran a whole server lifecycle on the first, and only then bound the second. A span reserves by binding and closing, so `$port + 1` is unowned for the hundreds of milliseconds in between, and under `-j4` another test takes it: `Failed to acquire TCP listener for 127.0.0.1:58864 (bind)` out of `$server2->start()`. The failure was invisible because `usleep(` in the FILE section makes run-tests treat the test as flaky and retry it, and the retry reports only "passed on retry attempt" — the first attempt's output is gone. Each server now takes its port from `tas_free_port()` where it binds it. Evidence: 015 run in a loop beside a full `-j4` suite fails on the second copy before the change and survives 181 copies after it, with the suite itself reporting no warned and no failed tests.
Contributor
CoverageTotal lines: 83.00% → 82.94% (-0.06 pp)
|
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.
core/014-log-emit-on-start-stopandcore/015-log-multipart-debugeach start a second server after the first has run its whole lifecycle. Both tooktas_free_port_span(2)up front and gave the second server$port + 1. A span reserves by binding and closing, so that port is owned by nobody for the hundreds of milliseconds the first phase takes, and under-j4another test claims it. The secondstart()then throwsFailed to acquire TCP listener for 127.0.0.1:58864 (bind).This hid behind run-tests' retry:
usleep(in a FILE section makesis_flaky()true, so the test is retried on any first-attempt failure and the report says only "passed on retry attempt". The first attempt's output is never shown, which is why the two tests read as timing noise for as long as they did.Each server now calls
tas_free_port()at the point it binds.Evidence: the FILE section of 015 extracted and run in a loop beside a full
-j4suite fails on the second copy againstmainwith that bind error, and survives 181 copies with this change, the suite alongside it reporting 0 warned and 0 failed.