test(sandbox): 将启动探测预算与过期检查分离

This commit is contained in:
2026-09-09 07:32:24 +08:00
parent 90d29d5641
commit 9ce36b1d92
+12 -3
View File
@@ -822,7 +822,10 @@ mod tests {
vault_id: uuid::Uuid::new_v4().to_string(), vault_id: uuid::Uuid::new_v4().to_string(),
platform: "windows".into(), platform: "windows".into(),
policy_version: "1".into(), policy_version: "1".into(),
expires_at_ms: 1000, // This probe checks argv/environment, not expiry. Keep its permit
// longer than the bounded process observation under parallel load.
// The dedicated expiry probe below still uses a two-second lease.
expires_at_ms: 120_000,
}; };
broker broker
.put( .put(
@@ -839,14 +842,20 @@ mod tests {
container_data: &folder, container_data: &folder,
scratch: &folder.join("Temp"), scratch: &folder.join("Temp"),
}; };
let launch_started = std::time::Instant::now();
let prepared = context let prepared = context
.prepare(&authority, &permit, &claims, &bound_entry, &broker, 2) .prepare(&authority, &permit, &claims, &bound_entry, &broker, 2)
.unwrap(); .unwrap();
let suspended = prepared.create_suspended(&profile, &bound_entry).unwrap(); let suspended = prepared.create_suspended(&profile, &bound_entry).unwrap();
let running = unsafe { suspended.resume().unwrap() }; let running = unsafe { suspended.resume().unwrap() };
let exit = running.wait(std::time::Duration::from_secs(5)).unwrap();
assert_eq!( assert_eq!(
running.wait(std::time::Duration::from_secs(5)).unwrap(), exit,
Some(0) Some(0),
"launch probe elapsed={:?} authorization={:?} active_processes={:?}",
launch_started.elapsed(),
running.check_authorization().err().map(|error| error.code),
running.active_test_processes().ok(),
); );
drop(running); drop(running);
// Actual native RPC: the child cannot name an identity or connect to // Actual native RPC: the child cannot name an identity or connect to