Skip to content

Commit 8e87db2

Browse files
committed
test(mxc): assert stable lifecycle completion
Signed-off-by: Prekshi Vyas <prekshiv@nvidia.com>
1 parent 4653d6c commit 8e87db2

1 file changed

Lines changed: 9 additions & 20 deletions

File tree

‎crates/openshell-driver-mxc/src/driver.rs‎

Lines changed: 9 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -3487,18 +3487,13 @@ mod lifecycle_tests {
34873487
let sb = with_policy(driver_sandbox_with_command("sb-pos", &share, cmd), policy);
34883488
backend.create_sandbox(&sb).await.expect("create accepted");
34893489

3490-
// Self-reported Ready=True (no supervisor) once the agent exec launches.
3491-
let ready = wait_for(&backend, "sb-pos", |s| {
3492-
ready_condition(s).is_some_and(|c| c.status == "True" && c.reason == "AgentRunning")
3493-
})
3494-
.await;
3495-
assert!(ready.is_some(), "sandbox should self-report Ready=True");
3496-
34973490
// A successful one-shot agent (exit 0) must STAY Ready, not demote to
34983491
// Error. Assert the terminal condition is Ready=True/AgentCompleted so the
34993492
// positive demo shows a green Ready phase, not a red Error.
35003493
let completed = wait_for(&backend, "sb-pos", |s| {
3501-
ready_condition(s).is_some_and(|c| c.status == "True" && c.reason == "AgentCompleted")
3494+
ready_condition(s).is_some_and(|condition| {
3495+
condition.status == "True" && condition.reason == "AgentCompleted"
3496+
})
35023497
})
35033498
.await;
35043499
assert!(
@@ -3540,13 +3535,15 @@ mod lifecycle_tests {
35403535
let sb = with_policy(driver_sandbox_with_command("sb-pc", &share, cmd), policy);
35413536
backend.create_sandbox(&sb).await.expect("create accepted");
35423537

3543-
let ready = wait_for(&backend, "sb-pc", |s| {
3544-
ready_condition(s).is_some_and(|c| c.status == "True" && c.reason == "AgentRunning")
3538+
let completed = wait_for(&backend, "sb-pc", |sandbox| {
3539+
ready_condition(sandbox).is_some_and(|condition| {
3540+
condition.status == "True" && condition.reason == "AgentCompleted"
3541+
})
35453542
})
35463543
.await;
35473544
assert!(
3548-
ready.is_some(),
3549-
"processContainer sandbox should self-report Ready=True"
3545+
completed.is_some(),
3546+
"processContainer sandbox should report Ready=True/AgentCompleted"
35503547
);
35513548
let recorded = crate::mxc::mock_recorded_config("sb-pc").expect("mock recorded config");
35523549
assert!(
@@ -3557,14 +3554,6 @@ mod lifecycle_tests {
35573554
assert_eq!(recorded["ui"]["clipboard"], "none");
35583555
assert_eq!(recorded["ui"]["injection"], false);
35593556

3560-
let completed = wait_for(&backend, "sb-pc", |sandbox| {
3561-
ready_condition(sandbox).is_some_and(|condition| condition.reason == "AgentCompleted")
3562-
})
3563-
.await;
3564-
assert!(
3565-
completed.is_some(),
3566-
"processContainer sandbox should report AgentCompleted"
3567-
);
35683557
assert!(
35693558
tmp.path().join("hello.txt").is_file(),
35703559
"in-policy write should materialize under processContainer"

0 commit comments

Comments
 (0)