Skip to content

Fix CLI integration test capture race for config-file port assertion - #14

Merged
mamonth merged 1 commit into
mainfrom
fix/cli-config-port-race
Sep 8, 2026
Merged

mamonth merged 1 commit into
mainfrom
fix/cli-config-port-race

Conversation

@mamonth

@mamonth mamonth commented Sep 8, 2026

Copy link
Copy Markdown
Owner

TestCLIConfigFilePresent, TestCLIConfigMultipleSchemas and TestCLIAsyncAPIAccepted read the mock subprocess stderr with an inline reader that stops as soon as the accumulated buffer contains "Mock server started". Because slog emits the port attribute on the same line, after that needle (msg="Mock server started" port=N), the reader can return at a 1024-byte chunk boundary that splits the line, so the trailing port=NNNNN is never read and assert.Contains(output, "port=NNNNN") fails. This is the same CI startup race the captureUntil helper was introduced for in 6188e42, but these three tests were left on the old racy pattern.

Replace the inline reader + select with captureUntil for deterministic output capture. Change is test-only; verified with -count runs, full suite, lint, vet and GitNexus change analysis (LOW risk, no affected processes).

TestCLIConfigFilePresent, TestCLIConfigMultipleSchemas and
TestCLIAsyncAPIAccepted read the mock subprocess stderr with an inline
reader that stops as soon as the accumulated buffer contains "Mock server
started". Because slog emits the port attribute on the same line, after
that needle (msg="Mock server started" port=N), the reader can return at a
1024-byte chunk boundary that splits the line, so the trailing port=NNNNN
is never read and assert.Contains(output, "port=NNNNN") fails. This is
the same CI startup race the captureUntil helper was introduced for in
6188e42, but these three tests were left on the old racy pattern.

Replace the inline reader + select with captureUntil for deterministic
output capture. Change is test-only; verified with -count runs, full
suite, lint, vet and GitNexus change analysis (LOW risk, no affected
processes).
@mamonth
mamonth merged commit 1a0eb18 into main Sep 8, 2026
7 checks passed
@mamonth
mamonth deleted the fix/cli-config-port-race branch September 8, 2026 06:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant