#!/bin/bash # Integration test runner for the morly relay. # # The layer above `make test-unit`: a real relay process, driven over HTTP and # WebSocket. It needs no browser and no frontend build. # # Usage: # ./test/run.sh # all integration tests # ./test/run.sh --build # rebuild the relay first # ./test/run.sh -k policy # only the policy tests # ./test/run.sh -k roundtrip -v # verbose round-trip tests # # Prerequisites: # pip install pytest websocket-client # # ORLY_STATIC_DIR points the relay at a frontend build (for the static-file # checks); unset, they are not in play. stress_metrics.py is a separate load # driver, not part of pytest - run it directly against a running relay. set -euo pipefail cd "$(dirname "$0")/.." ROOT="$PWD" MORLY_RELAY_BIN="${MORLY_RELAY_BIN:-$ROOT/morly}" BUILD=false PYTEST_ARGS=() for arg in "$@"; do case "$arg" in --build) BUILD=true ;; *) PYTEST_ARGS+=("$arg") ;; esac done if $BUILD; then make build fi if [ ! -x "$MORLY_RELAY_BIN" ]; then echo "error: relay binary not found at $MORLY_RELAY_BIN. Run with --build or: make build" >&2 exit 1 fi # A leftover store makes startup slower than the fixture's readiness wait and # leaves tests reading events an earlier run wrote. rm -rf /tmp/morly-test-data exec env MORLY_RELAY_BIN="$MORLY_RELAY_BIN" \ python3 -m pytest test/ \ --tb=short \ "${PYTEST_ARGS[@]}"