open-standards/joule-code/joule-code-rs/crates/joule-moq-interop/scripts/local.sh
Transaction Science 219f785544 joule-moq-interop: local.sh waits for its relay to exit
Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-21 13:02:45 -04:00

33 lines
1.3 KiB
Shell
Executable file

#!/bin/bash
# joule-moq-interop against joule-moq-relay on this host: every test at each draft, and
# wai-receipts across drafts. No network beyond loopback.
# scripts/local.sh <target-dir>
set -u
T=${1:-target}
"$T/debug/joule-moq-relay" --dev > /tmp/joule-moq-relay-local.log 2>&1 &
R=$!
# The relay is gone before this script is: a next run binds the same port.
trap 'kill $R 2>/dev/null; wait $R 2>/dev/null' EXIT
sleep 1
URL=moqt://127.0.0.1:4443/moq
rc=0
for d in 22 18 16; do
echo "== draft $d"
"$T/debug/joule-moq-interop" --relay $URL --draft $d --tls-disable-verify || rc=1
"$T/debug/joule-moq-interop" --relay $URL --draft $d --tls-disable-verify --test wai-receipts || rc=1
done
for pair in "16 22" "22 16" "18 16" "16 18"; do
set -- $pair
echo "== wai-receipts publisher $1, subscriber $2"
"$T/debug/joule-moq-interop" --relay $URL --draft $1 --sub-draft $2 --tls-disable-verify --test wai-receipts || rc=1
done
# The check must fail when the receipts or the objects are not what was signed.
for t in payload receipt in-flight; do
echo "== wai-receipts, tamper $t (must fail)"
if "$T/debug/joule-moq-interop" --relay $URL --draft 18 --tls-disable-verify --test wai-receipts --tamper $t; then
echo "FALSIFICATION FAILED: tamper $t passed"; rc=1
else
echo "tamper $t: refused, as it must be"
fi
done
exit $rc