0
0
tests: 0004 renter from its requester (finding 65)
tests/modules/acc-0004/src/lib.rs+8−4
| @@ -1,6 +1,6 @@ | ||
// docs/acceptance/0004-vm-atirc-agent.md as a state machine: an agent VM rented by `run request --hold --agent` | ||
// (discovery), its ident.link chain, the owner's mesh node reaches it and it answers, then a fast release that deletes | ||
// the renter's records and tombstones both DIDs. Input {did (the renter), handle, name}. Result {pass, error?, phase, | ||
// the renter's records and tombstones both DIDs. Input {did (the account; the renter is its requester, from requester_association_written), handle, name}. Result {pass, error?, phase, | ||
// readings}. The host cleans up whatever this run started (requesters, invocations, kube objects), however it ends. | ||
use abi::{Call, Event, Handle, Run, entries}; | ||
use serde_json::{Value, json}; | ||
| @@ -39,7 +39,7 @@ fn run_0004(run: Run<Value>) -> Result<Handle, String> { | ||
.as_str() | ||
.ok_or("name is required")? | ||
.to_string(); | ||
let renter = run.args["did"] | ||
let account = run.args["did"] | ||
.as_str() | ||
.ok_or("did is required")? | ||
.to_string(); | ||
| @@ -48,6 +48,7 @@ fn run_0004(run: Run<Value>) -> Result<Handle, String> { | ||
} else { | ||
run.state | ||
}; | ||
let renter = st["renter"].as_str().unwrap_or_default().to_string(); | ||
let mut s = steps::S { st, now }; | ||
if let Some(h) = steps::market_event(&mut s, &run.event) { | ||
return Ok(h); | ||
| @@ -207,7 +208,10 @@ fn run_0004(run: Run<Value>) -> Result<Handle, String> { | ||
} | ||
"requester_agent_mesh_key_written" => st["f"]["key"] = json!(true), | ||
"exited" => st["f"]["exited"] = json!(true), | ||
"requester_association_written" => st["r2"] = data["subject"].clone(), | ||
"requester_association_written" => { | ||
st["r2"] = data["subject"].clone(); | ||
st["renter"] = data["did"].clone(); | ||
} | ||
"requester_agent_identity" => { | ||
let peer = data["peer"].as_str().unwrap_or_default(); | ||
let (identity, agent) = peer.split_once('@').unwrap_or_default(); | ||
| @@ -242,7 +246,7 @@ fn run_0004(run: Run<Value>) -> Result<Handle, String> { | ||
st["readings"]["r2"] = st["r2"].clone(); | ||
st["readings"]["agent"] = st["agent"].clone(); | ||
set(&mut st, "chain"); | ||
h = h.call(call("chain", "assert.agentChain", json!({ "renter": renter, "r2": st["r2"], "agent": st["agent"], "identity": st["identity"] }))); | ||
h = h.call(call("chain", "assert.agentChain", json!({ "renter": renter, "account": account, "r2": st["r2"], "agent": st["agent"], "identity": st["identity"] }))); | ||
} | ||
if phase == "released" && st["f"]["r2released"] == true && st["f"]["guestTomb"] == true | ||
{ | ||
tests/modules/assert/src/lib.rs+2−1
| @@ -151,6 +151,7 @@ fn tombstoned_handler(run: Run<Value>) -> Result<Handle, String> { | ||
| ||
fn agent_chain_handler(run: Run<Value>) -> Result<Handle, String> { | ||
let a = &run.args; | ||
let account = a["account"].as_str().or(a["renter"].as_str()).ok_or("account")?; | ||
let (renter, r2, agent, identity) = ( | ||
a["renter"].as_str().ok_or("renter")?, | ||
a["r2"].as_str().ok_or("r2")?, | ||
| @@ -247,7 +248,7 @@ fn agent_chain_handler(run: Run<Value>) -> Result<Handle, String> { | ||
} | ||
let w = &g["walk"]; | ||
need( | ||
w["roots"] == json!([renter]) | ||
w["roots"] == json!([account]) | ||
&& w["errors"].as_array().is_some_and(|e| e.is_empty()), | ||
format!("walk {w}"), | ||
); | ||