Repository navigation
fix(test): isolate concurrent interop harness runs #4228
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
810bd68
553027d
11dbcb6
f9cb322
c3d439a
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
This file was deleted.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,24 @@ | ||
| import { expect, test } from "bun:test"; | ||
| import { launch, pause } from "./harness"; | ||
|
|
||
| test("pause activates its button when a canvas intercepts pointer input", async () => { | ||
| const browser = await launch(); | ||
| try { | ||
| const page = await browser.newPage(); | ||
| await page.setContent(` | ||
| <moq-watch-ui></moq-watch-ui> | ||
| <script> | ||
| const root = document.querySelector("moq-watch-ui").attachShadow({ mode: "open" }); | ||
| root.innerHTML = \`<button class="control" aria-label="Pause">Pause</button> | ||
| <canvas style="position: fixed; inset: 0; width: 100%; height: 100%"></canvas>\`; | ||
| root.querySelector("button").addEventListener("click", () => { | ||
| document.body.dataset.paused = "true"; | ||
| }); | ||
| </script> | ||
| `); | ||
| await pause(page); | ||
| expect(await page.locator("body").getAttribute("data-paused")).toBe("true"); | ||
| } finally { | ||
| await browser.close(); | ||
| } | ||
| }); |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -22,6 +22,12 @@ set working-directory := '.' | |
| default: | ||
| @just --justfile {{ justfile() }} --list test | ||
|
|
||
| # Port isolation across private temp roots and keyboard activation under a canvas. | ||
| # The browser check is not `*.test.ts`: plain `bun test` runs lack Playwright Chromium. | ||
| harness: | ||
| ./lib/harness.test.sh | ||
| bun test ./interop/clients/js/harness.browser.ts | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
In a clean checkout, Useful? React with 👍 / 👎. |
||
|
|
||
| # Cross-language media interop test, built from this checkout. Stands up a | ||
| # relay and runs the publisher x subscriber matrix. Default: rust only (fast | ||
| # sanity check). `interop --all` runs the full matrix: rust + python + go + | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,52 @@ | ||
| #!/usr/bin/env bash | ||
| # Independent shells must reserve different ports even with private temp roots. | ||
| set -euo pipefail | ||
|
|
||
| lib=$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd) | ||
| scratch=$(mktemp -d) | ||
| owner="" | ||
| trap '[[ -z "$owner" ]] || { kill "$owner" 2>/dev/null || true; wait "$owner" 2>/dev/null || true; }; rm -rf "$scratch"' EXIT | ||
| mkdir "$scratch/one" "$scratch/two" | ||
| mkfifo "$scratch/ready" "$scratch/release" | ||
| export MOQ_TEST_RUNS="$scratch/runs" | ||
| unset MOQ_TEST_PORTS | ||
|
|
||
| TMPDIR="$scratch/one" bash -euo pipefail -c ' | ||
| source "$1/harness.sh" | ||
| harness_begin ports >&2 | ||
| harness_port first | ||
| printf "%s\n" "$HARNESS_PORT" >"$2/ready" | ||
| read -r _ <"$2/release" | ||
| ' bash "$lib" "$scratch" & | ||
| owner=$! | ||
| read -r first <"$scratch/ready" | ||
| TMPDIR="$scratch/two" bash -euo pipefail -c ' | ||
| source "$1/harness.sh" | ||
| harness_begin ports >&2 | ||
| harness_port second | ||
| if [[ "$HARNESS_PORT" == "$2" ]]; then | ||
| echo "FAIL: separate TMPDIR shells both reserved $2" >&2 | ||
| exit 1 | ||
| fi | ||
| if harness_port pinned "$2"; then | ||
| echo "FAIL: pinned port ignored another shell reservation" >&2 | ||
| exit 1 | ||
| fi | ||
| ' bash "$lib" "$first" | ||
| printf 'done\n' >"$scratch/release" | ||
| wait "$owner" | ||
| owner="" | ||
| # Refuse an unexpected owner-controlled target under the predictable root. | ||
| ln -s "$scratch/one" "$scratch/ports-link" | ||
| MOQ_TEST_PORTS="$scratch/ports-link" bash -euo pipefail -c ' | ||
| source "$1/harness.sh" | ||
| harness_begin ports >&2 | ||
| if harness_port symlink; then | ||
| echo "FAIL: accepted a symlink reservation root" >&2 | ||
| exit 1 | ||
| else | ||
| status=$? | ||
| [[ "$status" == 2 ]] | ||
| fi | ||
| ' bash "$lib" | ||
| echo "cross-shell port reservations passed" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When two full matrices run from the same checkout, this change isolates only Go:
prepare_pythonstill runsjust py build, whoseuv sync,maturin develop, and editable install concurrently rewrite the same$WORKSPACE/.venvand generated Python bindings. Those runs can therefore still clobber each other even though this commit deletes the concurrency quest; move the Python environment and generated output underHARNESS_RUN, or keep the quest open until that remaining work is tracked and tested.AGENTS.md reference: quest/AGENTS.md:L97-L98
Useful? React with 👍 / 👎.