Commit 0967d3d
committed
test(run,sync/git[timeout]) Reduce flake risk in deadline tests
why: Several tests had wall-clock budgets sized for the 0.5 s SIGTERM
grace and 0.1 s selector poll defaults, leaving ~2.2 s of headroom
above the nominal timeout. On loaded CI runners (cold Python startup
of 0.5-0.7 s on ARM Actions, slow filesystems), that headroom narrows
to single digits. Separately, the early-stderr-close test relies on
``os.close(sys.stderr.fileno())`` which has POSIX-specific semantics
not portable to Windows, and the 500-ref regression test invoked
``git update-ref`` 500 times -- inflating suite duration without
sharpening the assertion.
what:
- Add a ``fast_timeout_constants`` fixture that monkeypatches
``_TIMEOUT_KILL_GRACE_SECONDS`` and ``_TIMEOUT_POLL_INTERVAL_SECONDS``
to 0.05 s so the wall-clock spread above the nominal deadline stays
predictable across runners.
- Apply the fixture to every deadline-firing test; tighten the
upper-bound assertion in
``test_run_raises_command_timeout_when_deadline_exceeded`` from 2.5
to 2.0 with a comment showing the spread arithmetic.
- Skip ``test_run_timeout_handles_early_stderr_close_without_hanging``
on Windows; document the POSIX dependency in the skip reason.
- Replace the 500-iteration ``run(['git', 'update-ref', ...])`` loop
with a single ``git update-ref --stdin`` call so the test setup
costs one fork+exec instead of 500. The behavioural assertion
(remote() returns under 5 s with 500 refs) is unchanged.1 parent 306d69f commit 0967d3d
2 files changed
Lines changed: 59 additions & 20 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
12 | 12 | | |
13 | 13 | | |
14 | 14 | | |
| 15 | + | |
15 | 16 | | |
16 | 17 | | |
17 | 18 | | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
18 | 35 | | |
19 | 36 | | |
20 | 37 | | |
| |||
46 | 63 | | |
47 | 64 | | |
48 | 65 | | |
49 | | - | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
50 | 69 | | |
51 | 70 | | |
52 | 71 | | |
| |||
59 | 78 | | |
60 | 79 | | |
61 | 80 | | |
62 | | - | |
63 | | - | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
64 | 86 | | |
65 | 87 | | |
66 | 88 | | |
67 | | - | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
68 | 92 | | |
69 | 93 | | |
70 | 94 | | |
| |||
86 | 110 | | |
87 | 111 | | |
88 | 112 | | |
89 | | - | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
90 | 117 | | |
91 | 118 | | |
92 | 119 | | |
| |||
151 | 178 | | |
152 | 179 | | |
153 | 180 | | |
154 | | - | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
155 | 184 | | |
156 | 185 | | |
157 | 186 | | |
| |||
186 | 215 | | |
187 | 216 | | |
188 | 217 | | |
189 | | - | |
| 218 | + | |
| 219 | + | |
| 220 | + | |
190 | 221 | | |
191 | 222 | | |
192 | 223 | | |
| |||
203 | 234 | | |
204 | 235 | | |
205 | 236 | | |
| 237 | + | |
206 | 238 | | |
207 | 239 | | |
208 | 240 | | |
| |||
224 | 256 | | |
225 | 257 | | |
226 | 258 | | |
| 259 | + | |
| 260 | + | |
| 261 | + | |
| 262 | + | |
227 | 263 | | |
228 | 264 | | |
229 | 265 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
6 | 6 | | |
7 | 7 | | |
8 | 8 | | |
| 9 | + | |
9 | 10 | | |
10 | 11 | | |
11 | 12 | | |
| |||
1683 | 1684 | | |
1684 | 1685 | | |
1685 | 1686 | | |
1686 | | - | |
| 1687 | + | |
| 1688 | + | |
| 1689 | + | |
1687 | 1690 | | |
1688 | 1691 | | |
1689 | 1692 | | |
1690 | 1693 | | |
1691 | | - | |
1692 | | - | |
1693 | | - | |
1694 | | - | |
1695 | | - | |
1696 | | - | |
1697 | | - | |
1698 | | - | |
1699 | | - | |
1700 | | - | |
1701 | | - | |
1702 | | - | |
| 1694 | + | |
| 1695 | + | |
| 1696 | + | |
| 1697 | + | |
| 1698 | + | |
| 1699 | + | |
| 1700 | + | |
| 1701 | + | |
| 1702 | + | |
| 1703 | + | |
| 1704 | + | |
| 1705 | + | |
1703 | 1706 | | |
1704 | 1707 | | |
1705 | 1708 | | |
| |||
0 commit comments