Skip to content

Commit

Permalink
Make server_runs_with_rpc_user_and_pass_as_env_vars test less flaky (o…
Browse files Browse the repository at this point in the history
  • Loading branch information
casey authored Oct 25, 2023
1 parent 01d83f1 commit f8ce0d2
Showing 1 changed file with 13 additions and 3 deletions.
16 changes: 13 additions & 3 deletions tests/server.rs
Original file line number Diff line number Diff line change
Expand Up @@ -296,9 +296,19 @@ fn server_runs_with_rpc_user_and_pass_as_env_vars() {

rpc_server.mine_blocks(1);

let response = reqwest::blocking::get(format!("http://127.0.0.1:{port}/blockcount")).unwrap();
assert_eq!(response.status(), StatusCode::OK);
assert_eq!(response.text().unwrap(), "2");
for i in 0.. {
let response = reqwest::blocking::get(format!("http://127.0.0.1:{port}/blockcount")).unwrap();
assert_eq!(response.status(), StatusCode::OK);
if response.text().unwrap() == "2" {
break;
}

if i == 400 {
panic!("server failed to sync");
}

thread::sleep(Duration::from_millis(25));
}

child.kill().unwrap();
}
Expand Down

0 comments on commit f8ce0d2

Please sign in to comment.