From 4d8a745853973820d431e03e8c442d76c1b4fdb7 Mon Sep 17 00:00:00 2001 From: Casey Rodarmor Date: Tue, 24 Oct 2023 22:38:08 -0700 Subject: [PATCH] Make server_runs_with_rpc_user_and_pass_as_env_vars test less flaky (#2580) --- tests/server.rs | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/tests/server.rs b/tests/server.rs index 843e1f5d95..106ef09462 100644 --- a/tests/server.rs +++ b/tests/server.rs @@ -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(); }