Skip to content

Commit 49fba1b

Browse files
committed
fix(cli): eliminate flaky subprocess integration tests
Remove vm_slow_progress_before_ready from the subprocess-based structured output tests. The 1.8s artificial delay (3x 600ms sleeps) left only ~0.7s headroom within the 5s OPENSHELL_PROVISION_TIMEOUT, causing sporadic TLS handshake failures on loaded Linux machines. Root cause analysis: - The CertificateRequired TLS alert occurs when the provision timeout fires mid-handshake, causing the client to drop the connection before presenting its certificate. - tokio::process::Command is NOT the cause: it is a thin async wrapper around std::process::Command that delegates environment setup, process spawning, and I/O identically. - The single-threaded tokio runtime is NOT the cause: testing with multi_thread flavor produces identical timing. - TempDir lifetime is sound: the directory lives until .output().await returns, so certs exist for the subprocess's entire lifetime. - Cert path resolution is deterministic: the subprocess resolves XDG_CONFIG_HOME/openshell/gateways/openshell/mtls/ correctly. The subprocess tests exist to verify that the real CLI binary produces clean stdout (no ANSI chrome, spinners, or progress text leaking into structured output). This invariant does not depend on slow progress events; the ProgressOutput::Silent branch that swallows progress events is already covered by the in-process test sandbox_create_keeps_waiting_while_vm_progress_arrives. Fixes NVIDIA#2501 Signed-off-by: Roland Huß <[email protected]>
1 parent deced87 commit 49fba1b

1 file changed

Lines changed: 4 additions & 14 deletions

File tree

‎crates/openshell-cli/tests/sandbox_create_lifecycle_integration.rs‎

Lines changed: 4 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1944,15 +1944,10 @@ async fn run_cli_sandbox_create(
19441944
}
19451945

19461946
#[tokio::test]
1947-
async fn sandbox_create_json_stdout_is_parseable_with_progress_events() {
1947+
async fn sandbox_create_json_stdout_is_parseable() {
19481948
let server = run_server().await;
1949-
server
1950-
.openshell
1951-
.state
1952-
.vm_slow_progress_before_ready
1953-
.store(true, Ordering::SeqCst);
19541949

1955-
let result = run_cli_sandbox_create(&server, "json-progress", &["--output=json"]).await;
1950+
let result = run_cli_sandbox_create(&server, "json-clean", &["--output=json"]).await;
19561951
assert!(
19571952
result.status.success(),
19581953
"sandbox create failed:\n{}",
@@ -1964,15 +1959,10 @@ async fn sandbox_create_json_stdout_is_parseable_with_progress_events() {
19641959
}
19651960

19661961
#[tokio::test]
1967-
async fn sandbox_create_yaml_stdout_is_parseable_with_progress_events() {
1962+
async fn sandbox_create_yaml_stdout_is_parseable() {
19681963
let server = run_server().await;
1969-
server
1970-
.openshell
1971-
.state
1972-
.vm_slow_progress_before_ready
1973-
.store(true, Ordering::SeqCst);
19741964

1975-
let result = run_cli_sandbox_create(&server, "yaml-progress", &["--output=yaml"]).await;
1965+
let result = run_cli_sandbox_create(&server, "yaml-clean", &["--output=yaml"]).await;
19761966
assert!(
19771967
result.status.success(),
19781968
"sandbox create failed:\n{}",

0 commit comments

Comments
 (0)