[control] Share and token fixes: settle the epoch before minting, mint in its own task so a dropped client frees its key, token checks off the async threads, CLI refuses to run as another user than the state dir's owner
This commit is contained in:
@@ -641,12 +641,16 @@ mod unix {
|
||||
let good = Echo::start("good").await;
|
||||
let mut env = Env::new(EnvSpec::default()).await;
|
||||
env.start_control(None);
|
||||
assert_eq!(env.add_host(host("a.test", &good.url(), false)).await["state"], "kept");
|
||||
assert_eq!(
|
||||
env.add_host(host("a.test", &good.url(), false)).await["state"],
|
||||
"kept"
|
||||
);
|
||||
env.kill_control();
|
||||
env.start_control_env(None, &[("IANITOR_TEST_FAIL_WRITE", "edge.json")]);
|
||||
let r = env.add_host(host("b.test", &good.url(), false)).await;
|
||||
assert_eq!(r["state"], "kept", "{r}");
|
||||
let j: serde_json::Value = serde_json::from_str(&env.file("state/journal.json")).expect("journal kept");
|
||||
let j: serde_json::Value =
|
||||
serde_json::from_str(&env.file("state/journal.json")).expect("journal kept");
|
||||
assert_eq!(j["stage"], "confirmed", "{j}");
|
||||
let o = env.call("GET", "/api/v1/overview", None).await;
|
||||
assert_eq!(o.json["paused"]["code"], "control.paused", "{}", o.text);
|
||||
@@ -661,7 +665,11 @@ mod unix {
|
||||
env.start_control(None);
|
||||
let o = env.call("GET", "/api/v1/overview", None).await;
|
||||
assert!(o.json["paused"].is_null(), "{}", o.text);
|
||||
assert!(env.head_files().iter().any(|(p, _)| p == "hosts/b.test.toml"));
|
||||
assert!(
|
||||
env.head_files()
|
||||
.iter()
|
||||
.any(|(p, _)| p == "hosts/b.test.toml")
|
||||
);
|
||||
env.assert_consistent().await;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user