Files
werkator/docs/prs/2026-10-10-PR#141-slot-tests-without-waiting.md
claude-code 09f4318726
werkator build succeeded after 02:26
werkator/deploy build succeeded after 00:08
The PR-doc of PR#141 says how long a slot test waits (v1.38.12) (#145)
Co-authored-by: claude-code <claude-code@javagil.de>
2026-10-10 12:38:54 +02:00

38 lines
1.8 KiB
Markdown

# PR#141: Slot Tests without Waiting
> **WARNING:** This document describes only the change applied in this PR.
> It may already be outdated once the next PR is merged.
> Historic PR-documentation is not maintained along with new PRs — treat it as a snapshot, not as current documentation.
## The Problem
`BuildSlotsUnitTest` shows that a build waits for a slot by trying to get its lease for 300 ms and expecting the time to run out.
Every test does that at least once, so the spec takes about 2.8 s, nearly all of it waiting.
PIT runs the spec again for every mutant of `BuildSlots` and `BuildPool` it covers, and a mutant that lets a build wait where it should not makes a later `get` wait up to five seconds.
## Non-Goals
- No change to `BuildSlots` itself: PR#138 already gave it `waiting()`, the number of builds waiting at its semaphores.
## The Scenarios
The behaviour of the slots does not change, so their scenarios (Scenario#106.01 to Scenario#106.04, Scenario#119.01 to Scenario#119.04) stay as they are.
Only how a test sees a waiting build changes: it waits until the build queues at a semaphore, or until it got through instead;
when neither happens within five seconds, the test fails.
## The Solution
- `isWaitingAt(slots)` replaces the timed `get`: it polls `slots.waiting()` and the future, and returns as soon as one of them says something.
The spec now takes 0.06 s instead of 2.8 s.
A local PIT run of `BuildSlots` and `BuildPool`, two minions, without history:
| Run | Duration | Mutants killed or timed out |
|-------------|---------:|----------------------------:|
| Before | 223 s | 33 of 37 |
| With the PR | 139 s | 33 of 37 |
## Prerequisite PRs
- PR#140, for the order of the versions; it also keeps `FailFastUnitTest` out of PIT, without which no PIT run starts.