//! Contract tests for the manual upstream A/V sync harness. //! //! Scope: statically guard the workstation-side tunnel/bootstrap behavior. //! Targets: `scripts/manual/run_upstream_av_sync.sh`. //! Why: the manual probe should reach Theia through SSH even when the gRPC //! port is not exposed on the public SSH endpoint. const SYNC_SCRIPT: &str = include_str!("../../scripts/manual/run_upstream_av_sync.sh"); #[test] fn upstream_sync_script_tunnels_auto_server_addr_through_ssh() { for expected in [ "cleanup_server_tunnel", "pick_local_server_tunnel_port", "wait_for_server_tunnel", "start_server_tunnel", "ExitOnForwardFailure=yes", "127.0.0.1:${local_port}:127.0.0.1:${remote_port}", "RESOLVED_LESAVKA_SERVER_ADDR=\"http://127.0.0.1:${SERVER_TUNNEL_LOCAL_PORT}\"", "tunneled to ${LESAVKA_SERVER_HOST}:127.0.0.1:${SERVER_TUNNEL_REMOTE_PORT}", "CAPTURE_READY_MARKER=\"__LESAVKA_CAPTURE_READY__\"", "LEAD_IN_SECONDS=${LEAD_IN_SECONDS:-0}", "PROBE_TIMEOUT_SECONDS=${PROBE_TIMEOUT_SECONDS:-$((PROBE_DURATION_SECONDS + PROBE_WARMUP_SECONDS + 20))}", "timeout --signal=INT \"${PROBE_TIMEOUT_SECONDS}\" \"${PROBE_BIN}\"", "sync probe timed out after ${PROBE_TIMEOUT_SECONDS}s", "VIDIOC_STREAMON.*Connection timed out", "the UVC host opened before MJPEG frames reached the gadget", "Tethys capture failed before the sync probe could start", "wait_for_capture_ready", "Timed out waiting for Tethys capture to become ready", "grep -q \"${CAPTURE_READY_MARKER}\"", "Lesavka UVC video device not found on Tethys; refusing to fall back to an unrelated webcam/capture card.", "resolve_alsa_audio_device", "PipeWire Lesavka source not found; falling back to ALSA device", "Lesavka audio source not found in PipeWire or ALSA; capture host does not currently expose the gadget microphone.", ] { assert!( SYNC_SCRIPT.contains(expected), "manual sync script should contain {expected}" ); } assert!( !SYNC_SCRIPT.contains( "RESOLVED_LESAVKA_SERVER_ADDR=\"http://${LESAVKA_SERVER_CONNECT_HOST}:${port}\"" ), "auto server resolution should not guess a public gRPC host when SSH is already required" ); }