mirror of
https://github.com/kevinveenbirkenbach/computer-playbook.git
synced 2026-12-02 07:47:58 +00:00
test(test-e2e-playwright): make run_parallel rendezvous waits mutual
The concurrency tests proved overlap with a one-sided wait: only one job waited for its partner's start line. Under load (core `make test` runs about 80 workers) the partner could start and finish before the waiting job's interpreter wrote its own start, so `_peak()` saw 1 and test_onion_jobs_share_tor_with_each_other failed. - a and b, onion-a and onion-b now wait for each other, so both intervals contain both start stamps and overlap whenever the scheduler runs them together; a serial scheduler still times out and fails. - onion-b's timeout is checked like onion-a's. - every onion job in the tor-cap test waits for clear, so the assertion holds whichever onion job takes the single tor slot first. Evidence: the three tests 20x each across 8 xdist workers, 60 passed; the whole file, 41 passed. 🎯 fix 92 % · 💥 break 1 % · 💸 cost – · ⏱️ time – · 🛡️ security 100 % · 🏆 score 91 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
e36fd72a1d
commit
346d05faf1
1 file changed
+4
-3
@@ -385,7 +385,7 @@ class TestRun(unittest.TestCase):
|
||||
rc=1 if name == "b" else 0,
|
||||
after=["head"],
|
||||
timeout=10,
|
||||
until="b" if name == "a" else None,
|
||||
until={"a": "b", "b": "a"}.get(name),
|
||||
)
|
||||
(self.jobs / rp.SEALED).touch()
|
||||
self.assertEqual(self._run(2), 0)
|
||||
@@ -534,10 +534,11 @@ class TestRun(unittest.TestCase):
|
||||
|
||||
def test_onion_jobs_share_tor_with_each_other(self):
|
||||
self._job(0, "onion-a", 0.1, tor=True, timeout=10, until="onion-b")
|
||||
self._job(1, "onion-b", 0.1, tor=True)
|
||||
self._job(1, "onion-b", 0.1, tor=True, timeout=10, until="onion-a")
|
||||
(self.jobs / rp.SEALED).touch()
|
||||
self.assertEqual(self._run(2), 0)
|
||||
self.assertFalse(self._result("onion-a")["timed_out"])
|
||||
self.assertFalse(self._result("onion-b")["timed_out"])
|
||||
self.assertEqual(self._peak(), 2)
|
||||
|
||||
def test_onion_jobs_stay_within_the_tor_cap(self):
|
||||
@@ -548,7 +549,7 @@ class TestRun(unittest.TestCase):
|
||||
0.4,
|
||||
tor=True,
|
||||
timeout=10,
|
||||
until="clear" if name == "onion-a" else None,
|
||||
until="clear",
|
||||
)
|
||||
self._job(3, "clear", 0.4)
|
||||
(self.jobs / rp.SEALED).touch()
|
||||
|
||||
Reference in new issue
Block a user