feat: add automation wait commands
This commit is contained in:
parent
448a831a98
commit
e49b945259
5 changed files with 261 additions and 7 deletions
|
|
@ -258,6 +258,18 @@ fn geth_status_against_running_daemon() {
|
|||
|
||||
let output = run_geth(home.path(), &["status"]);
|
||||
let json_output = run_geth(home.path(), &["--json", "status"]);
|
||||
let wait_output = run_geth(
|
||||
home.path(),
|
||||
&[
|
||||
"--json",
|
||||
"wait",
|
||||
"daemon",
|
||||
"--timeout-ms",
|
||||
"1000",
|
||||
"--interval-ms",
|
||||
"10",
|
||||
],
|
||||
);
|
||||
let _ = daemon.kill();
|
||||
let _ = daemon.wait();
|
||||
|
||||
|
|
@ -305,6 +317,11 @@ fn geth_status_against_running_daemon() {
|
|||
assert_eq!(status_json["store_synchronous"], "normal");
|
||||
assert_eq!(status_json["store_status"], "ok");
|
||||
assert!(status_json["native_backends"].is_array());
|
||||
|
||||
let wait_json = command_json(&wait_output);
|
||||
assert_eq!(wait_json["type"], "wait");
|
||||
assert_eq!(wait_json["target"], "daemon");
|
||||
assert_eq!(wait_json["ready"], true);
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
|
@ -362,6 +379,31 @@ fn json_errors_include_stable_code_for_common_failures() {
|
|||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn wait_daemon_reports_json_timeout_without_daemon() {
|
||||
let home = tempfile::tempdir().expect("tempdir");
|
||||
let output = run_geth(
|
||||
home.path(),
|
||||
&[
|
||||
"--json",
|
||||
"wait",
|
||||
"daemon",
|
||||
"--timeout-ms",
|
||||
"1",
|
||||
"--interval-ms",
|
||||
"1",
|
||||
],
|
||||
);
|
||||
|
||||
assert!(!output.status.success());
|
||||
let report =
|
||||
serde_json::from_slice::<serde_json::Value>(&output.stdout).expect("decode wait report");
|
||||
assert_eq!(report["type"], "wait");
|
||||
assert_eq!(report["target"], "daemon");
|
||||
assert_eq!(report["ready"], false);
|
||||
assert!(report["attempts"].as_u64().expect("attempts") >= 1);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn peer_ping_uses_daemon_owned_iroh_endpoint() {
|
||||
if skip_iroh_integration_tests() {
|
||||
|
|
|
|||
Loading…
Reference in a new issue