review: take the workload manager tests off the clock - #139
Merged
Merged
Conversation
TestRun runs under synctest so the 30 s manager timeout elapses on the fake clock; TestLogBroadcaster serves on an ephemeral port and waits for the subscriber to attach and detach instead of sleeping. The two tests together: 34 s -> 0.3 s.
The journal forwarder execs journalctl, and a real subprocess read is not durably blocked: on a host that has journalctl the bubble never idles and the fake clock never advances. An empty PATH fails the lookup before any subprocess starts, so the forwarder retries on the fake clock on every platform. The forwarder is mid-sleep when the run deadline fires, and synctest panics on blocked goroutines once the root goroutine exits, so the test drains two retry intervals after Run returns (-count=100 fails without the drain).
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
manager/workload/manager_test.go:TestRunruns undertesting/synctest, so the manager's 30 s run timeout elapses on the fake clock. PATH is emptied for the test so the journal forwarder'sjournalctllookup fails before any subprocess starts (a real subprocess read is not durably blocked and would stall the fake clock on a host that has journalctl), and the test drains two forwarder retry intervals afterRunreturns because synctest fails on blocked goroutines once the root goroutine exits.manager/workload/log_test.go:TestLogBroadcasterserves on an ephemeral loopback port and waits for the subscriber to attach and detach through the broadcaster's own registry instead of sleeping around the broadcast.Why
These were the last wall-clock waits in the agent tests. They cost 34 s per run and passed or failed on machine load rather than on behaviour.
Evidence
Gate on this branch: build, vet, full tests,
make lint,make fmt-checkandaslon both GOOS green; comment delta +0 −0.