diff --git a/tests/test_wave234.py b/tests/test_wave234.py index cfc4064..1eaea22 100644 --- a/tests/test_wave234.py +++ b/tests/test_wave234.py @@ -6,6 +6,7 @@ import json import os +import statistics import subprocess import sys import tempfile @@ -62,10 +63,13 @@ def _run(self, payload): return r, (time.time() - t0) * 1000 def test_envelope_and_cap_and_latency(self): - r, ms = self._run({"session_id": "sess1", "prompt": "hi"}) - self.assertIn("[TRIDENT L=45", r.stdout) - self.assertEqual(open(os.path.join(self.dir, "trident-inject-cap-sess1")).read(), "1900") - self.assertLess(ms, 250) # <100ms budget; CI slack for cold jq + samples = [] + for _ in range(3): + r, ms = self._run({"session_id": "sess1", "prompt": "hi"}) + self.assertIn("[TRIDENT L=45", r.stdout) + self.assertEqual(open(os.path.join(self.dir, "trident-inject-cap-sess1")).read(), "1900") + samples.append(ms) + self.assertLess(statistics.median(samples), 250) # <100ms budget; CI slack for host noise def test_stale_wallet_silent(self): w = os.path.join(self.dir, "wallet.json")