chore: overhaul the jobs test suite - #237
Merged
Merged
Conversation
Replace the per-test endure boilerplate with a Start helper that boots the container, waits for the rpc listener and tears down through t.Cleanup, plus WaitLog and WaitStats so a test waits for the record or the pipeline state it cares about instead of sleeping. The jobs file carried 26 fixed sleeps, including a flat 15s for the prefetch case and 25s for the protocol error. Those are now waits on the records they were standing in for, and the suite runs in about 20s. Split the assertions per behaviour: boot, push and process, pause and resume, stats for delayed and drained pipelines, the prefetch limit, the protocol error and the response handler error. The stats case polls the pipeline state rather than sleeping out the delay it pushed.
Both steps named a single test file, so the split would not run. Select by test name instead, drop -failfast, and fail the codecov job when the merged summary maps to no plugin source.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #237 +/- ##
==========================================
- Coverage 76.25% 75.86% -0.39%
==========================================
Files 6 6
Lines 518 518
==========================================
- Hits 395 393 -2
- Misses 91 93 +2
Partials 32 32 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
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.
First of the nine jobs drivers, and the pattern the rest will follow. Memory needs no broker, so the whole suite runs locally.
26 fixed sleeps in the jobs file, including a flat 15s for the prefetch case and 25s for the protocol error — the suite spent most of its time waiting rather than testing. The helper now offers:
Start(t, cfg, plugins, opts...)with an rpc readiness probe, replacing the 3s sleep every test opened withWaitLog(snippet, n)/RequireLogCount(snippet, n)— wait for the record a step produces, then assert the exact count, which also catches a driver that redeliversWaitStats(pred)— poll the pipeline state instead of sleeping out a delayed job's delayJobs tests now run in about 20s.
Split per behaviour: boot, push and process, pause and resume, stats for delayed and drained pipelines, the prefetch limit, the protocol error, and the response handler error.
Three things I had to correct by reading the originals rather than assuming, all worth knowing for the other eight drivers:
pipeline was stoppedanddestroy signal receivedare written during container shutdown, not byjobs.Pauseorjobs.Destroy— the pause record ispipeline was pausedpipeline was resumedonly appears after an explicitjobs.Resume; pipelines listed underconsume:logpipeline was startedat bootresponse handler errorrecords, not oneCI: both workflow steps named a single test file (
jobs_memory_test.go,kv_memory_test.go), so a split file simply would not run. They now select by test name over./.... Dropped-failfastand added the coverage guard to both.Not covered by this PR:
kv_memory_test.gois untouched. It fails on my machine because its http worker needs PHP'sext-sockets, which I do not have — I verified it fails identically on a clean checkout, and memory's CI is green on it, so it is a local limitation rather than a regression.