Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
43 changes: 42 additions & 1 deletion bench/relay.test.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#!/usr/bin/env python3
"""Exercise sampler-owned generator lifetime with deterministic fake counters."""
"""Exercise relay workload lifetimes with deterministic fake counters."""

import os
import random
Expand Down Expand Up @@ -56,6 +56,7 @@ def test_confirmed_loss_survives_reordering_recovery(self):


class Lifecycle(unittest.TestCase):
@unittest.skipUnless(sys.platform == "linux", "relay process metrics require Linux")
def test_sampler_stops_generator_after_collecting_both_processes(self):
with tempfile.TemporaryDirectory() as directory:
run = Path(directory)
Expand Down Expand Up @@ -107,6 +108,46 @@ def test_sampler_stops_generator_after_collecting_both_processes(self):
self.assertEqual(result["generator"]["cpu_cores"], 1)
self.assertEqual(result["host_window_start_ms"], result["throughput_window_start_ms"])

def test_generator_duration_limits_workload_without_sampler(self):
with tempfile.TemporaryDirectory() as directory:
run = Path(directory)
fake = run / "load.py"
fake.write_text("""#!/usr/bin/env python3
import argparse, json, pathlib
p = argparse.ArgumentParser()
p.add_argument('--duration', required=True)
p.add_argument('--output', type=pathlib.Path, required=True)
a, _ = p.parse_known_args()
assert a.duration == '10s'
a.output.write_text(''.join(json.dumps(dict(timestamp_ms=t, bytes_sent=t*10, bytes_recv=t*10,
frames_sent=t, frames_recv=t, groups_expected=1, groups_present=1, groups_lost=0,
latency_p50_ms=1, latency_p99_ms=1))+'\\n' for t in (0, 5000, 10000)))
""")
fake.chmod(0o755)
script = """set -euo pipefail
ROOT=$1 RUN=$2 LOAD_BIN=$3 HOST_BIN=false
source "$ROOT/bench/relay.sh"
# Exercise the non-Linux branch on Linux CI too.
uname() { printf 'Darwin\\n'; }
start_relay() { RELAY_PID=$$; RELAY_PORT=4500; }
stop_relay() { RELAY_PID=; }
run_workload fixture ignored video
"""
result = subprocess.run(
["bash", "-c", script, "test", str(ROOT), str(run), str(fake)],
capture_output=True,
text=True,
)
self.assertEqual(result.returncode, 0, result.stderr)
import json

report = json.loads((run / "relay/fixture/video/summary.json").read_text())
self.assertEqual(report["throughput_window_start_ms"], 5000)
self.assertEqual(report["throughput_window_end_ms"], 10000)
self.assertEqual(report["recv_fps"], 1000)
self.assertNotIn("cpu_cores", report)
self.assertNotIn("generator", report)


@unittest.skipUnless(sys.platform == "linux", "relay process metrics require Linux")
class PortOwnership(unittest.TestCase):
Expand Down
1 change: 0 additions & 1 deletion quest/m0/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@ since cutting segments from first-frame pts waits on nothing in m1.
- [CI cost and latency](/quest/m0/ci/README.md) - cloud CI runs only in a batched merge gate as one `just ci` pass per batch, expensive checks run nightly and gate `release`, caches move to R2, and runners are chosen last
- [More tests under load](/quest/m0/test-flakes-2/README.md) - load-only and queue failures, one quest per flake, fixed at the cause, since each one fails a whole batch
- [A waiter's record limit changes no behavior](/quest/m0/kio-waiter-records.md) - two moq-net tests stop failing when kio's waiters remember 16 lists, and the limit becomes a tuning knob worth 3.9% per delivered group
- [The relay bench test passes local checks on macOS](/quest/m0/relay-test-macos.md) - a Linux-only sampler test stops failing local macOS checks
- [Backport the relay and auth hardening to release](/quest/m0/backport-release-hardening.md) - `release`'s relay refuses dot-segment paths, serves its HTTP routes with main's response hardening, and withdraws advertisements a peer starves of send credit; its auth client refuses redirects
- [HLS export on a declared grid](/quest/m0/hls-media-grid.md) - the catalog's `hls` field and record tracks go away, and the export numbers segments on `media.join.interval` from media tracks
- [quest init keeps moq's nix-wrapped worktree hooks](/quest/m0/quest-worktree-hooks.md) - quest pin bumps keep the hooks that run moq's pinned `quest`
Expand Down
15 changes: 0 additions & 15 deletions quest/m0/relay-test-macos.md

This file was deleted.