Runner failure engine tests: declare readiness, read both control stores

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
Meta Vens 2026-10-25 02:18:06 +01:00
commit 7ef31ee699

View file

@ -24784,7 +24784,10 @@ GAMECULT_RUNTIME_PRESENCE_IDENTITY = "/etc/gamecult/service/runtime-presence-ide
/// The unrouted recipe with two steps ahead of its build, and no external /// The unrouted recipe with two steps ahead of its build, and no external
/// input: the second step, `test-daemon`, is the one the fake docker fails. /// input: the second step, `test-daemon`, is the one the fake docker fails.
fn two_step_recipe() -> String { fn two_step_recipe() -> String {
let recipe = unrouted_recipe(); let recipe = unrouted_recipe().replace(
"capability = \"service.runtime\"",
&format!("capability = \"{ODIN_RENDEZVOUS_CAPABILITY}\""),
);
let (head, rest) = recipe let (head, rest) = recipe
.split_once("[[external_inputs]]") .split_once("[[external_inputs]]")
.expect("the recipe declares an external input"); .expect("the recipe declares an external input");
@ -24876,11 +24879,16 @@ GAMECULT_RUNTIME_PRESENCE_IDENTITY = "/etc/gamecult/service/runtime-presence-ide
for text in [error.as_str(), abort.error.as_str(), &format!("{ended:?}")] { for text in [error.as_str(), abort.error.as_str(), &format!("{ended:?}")] {
assert!(!text.contains(RUNNER_CANARY), "runner output reached a record: {text}"); assert!(!text.contains(RUNNER_CANARY), "runner output reached a record: {text}");
} }
let control = std::fs::read(&world.state_store)?; // The terminal transaction has moved to history.cc: both stores.
assert!( for store in [world.state_store.clone(), history_store_path(&world.state_store)] {
!control.windows(RUNNER_CANARY.len()).any(|window| window == RUNNER_CANARY.as_bytes()), let bytes = std::fs::read(&store)?;
"runner output reached control.cc" assert!(!bytes.is_empty(), "{} is empty", store.display());
); assert!(
!bytes.windows(RUNNER_CANARY.len()).any(|window| window == RUNNER_CANARY.as_bytes()),
"runner output reached {}",
store.display()
);
}
// Kept: in the private store, tails of both streams, and on status. // Kept: in the private store, tails of both streams, and on status.
let evidence = runner_evidence_store_path(&world.state_store); let evidence = runner_evidence_store_path(&world.state_store);
assert_eq!(std::fs::metadata(&evidence)?.permissions().mode() & 0o777, 0o600); assert_eq!(std::fs::metadata(&evidence)?.permissions().mode() & 0o777, 0o600);
@ -24976,15 +24984,17 @@ GAMECULT_RUNTIME_PRESENCE_IDENTITY = "/etc/gamecult/service/runtime-presence-ide
tick_until_ended(&world)?; tick_until_ended(&world)?;
// The store a rolled-back Idunn reads: it refuses any foreign type. // The store a rolled-back Idunn reads: it refuses any foreign type.
ControlSnapshot::read(&world.state_store)?; ControlSnapshot::read(&world.state_store)?;
let envelopes = let mut transactions = 0;
SingleFileMessagePackBackingStore::new(&world.state_store).pull_all_read_only_snapshot()?; for store in [world.state_store.clone(), history_store_path(&world.state_store)] {
assert!(!envelopes.is_empty()); for envelope in SingleFileMessagePackBackingStore::new(&store).pull_all_read_only_snapshot()? {
for envelope in &envelopes { assert!(!envelope.r#type.contains("runner_failure"), "{}", envelope.r#type);
assert!(!envelope.r#type.contains("runner_failure"), "{}", envelope.r#type); if envelope.r#type == DeploymentTransaction::TYPE {
if envelope.r#type == DeploymentTransaction::TYPE { transactions += 1;
assert_eq!(envelope.schema_id.as_deref(), Some("idunn.deployment_transaction.v4")); assert_eq!(envelope.schema_id.as_deref(), Some("idunn.deployment_transaction.v4"));
}
} }
} }
assert_eq!(transactions, 1, "the failed transaction is in neither store");
Ok(()) Ok(())
} }