Skip to content

test(computers): the site proxy tests wait for the connections they read to be logged - #804

Open
earakely-scale wants to merge 2 commits into
mainfrom
edgararakelyan/site-proxy-log-wait
Open

earakely-scale wants to merge 2 commits into
mainfrom
edgararakelyan/site-proxy-log-wait

Conversation

@earakely-scale

@earakely-scale earakely-scale commented Nov 19, 2026 •

Copy link
Copy Markdown
Collaborator

Three tests in tst/unit/env/envs/test_computer_site_proxy.py slept a fixed 0.3 s for the forward port to log its connections, then read stderr. The port writes each record as its connection ends, and the slow host's record first waits out the same 0.3 s upstream timeout. So on a loaded runner the log can be read before it's complete.

That happened on CodeBuild for #791 (an unrelated change). In test_both_proxies_log_a_connection_and_each_way_one_fails_in_the_same_json_lines, the forward port's log was missing its connection record, and the other 16,989 tests passed.

Change

  • A helper, _until_logged(capsys, count), reads stderr until the proxy has written the records the test checks, for up to 10 s.
  • The three tests call it in place of asyncio.sleep(0.3):
    • the live-hosts wildcard test, which waits for 2 records;
    • the egress test, which waits for 2;
    • the both-proxies test, which waits for 3.
  • Each test then reads whatever came after the wait too, so it checks the same full log as before.

Testing

  • The file passes: 73 tests, three runs in a row.
  • I couldn't reproduce the failure itself:
    • on the Mac, the three tests ran 20 times under full CPU load, with 0 failures on main and 0 with this change;
    • on a 16-core Linux VM, the whole file ran 15 times with -n 16 under full CPU load, again 0 failures either way.

So the evidence is the CodeBuild log and the reasoning above. The change waits for the records rather than for a fixed time, so it can only be slower when the log is late, never wrong.

🤖 Generated with Claude Code

RetriggerView in GreptileConfidence Score: 5/5

The PR appears safe to merge.

Summary

Three site-proxy tests now wait for expected log records instead of sleeping for a fixed time.

  • Site-proxy tests wait for the log records they check.

No new issues found in the changes since the previous review.

Reviews (2) · Last reviewed commit: "test(computers): name the site proxy tes..." · Reviewed by Greptile

…ead to be logged

Three tests slept a fixed 0.3 s for the forward port's connection records, which it writes as each connection ends;
the slow host's record waits out the 0.3 s upstream timeout itself, so on a loaded runner the log was read before it
was written. They now wait until the records they check are there, for up to 10 s.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@earakely-scale
earakely-scale requested a review from a team as a code owner November 19, 2026 05:01
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

This branch has not been deployed

No deployments
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