diff --git a/bench/relay.test.py b/bench/relay.test.py index d0c4236d0ca..a3110543aa8 100644 --- a/bench/relay.test.py +++ b/bench/relay.test.py @@ -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 @@ -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) @@ -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): diff --git a/quest/m0/README.md b/quest/m0/README.md index 6d1af5d8a8f..956f245b361 100644 --- a/quest/m0/README.md +++ b/quest/m0/README.md @@ -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` diff --git a/quest/m0/relay-test-macos.md b/quest/m0/relay-test-macos.md deleted file mode 100644 index 80b62a0d489..00000000000 --- a/quest/m0/relay-test-macos.md +++ /dev/null @@ -1,15 +0,0 @@ -# [XS] The relay bench test passes local checks on macOS - -## Goal - -`just check` passes on macOS: `bench/relay.test.py`'s `test_sampler_stops_generator_after_collecting_both_processes` runs only where the branch it drives runs. - -## Plan - -Found while validating [#7781](https://github.com/moq-dev/moq/pull/7781) on 2026-11-03; it fails the same way on `main`. -The test drives `bench/relay.sh`'s Linux-only sampler branch, where the generator runs until interrupted. -On macOS, `run_workload` takes the other branch, which passes `--duration 10s`, and the test's fake generator fails `assert '--duration' not in rest`. -Linux CI is unaffected. - -Restrict the test to Linux the way its sibling is (`skipUnless(sys.platform == "linux")` at `bench/relay.test.py:111`). -If no test covers the non-Linux branch, add a small one there rather than leave it unexercised.