lesavka/testing/tests/client_manual_sync_script_contract.rs

34 lines
1.4 KiB
Rust

//! 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}",
"Tethys capture failed before the sync probe could start",
"kill -0 \"${capture_pid}\"",
] {
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"
);
}