Skip to content

Commit

Permalink
Remove flakiness from test_peer_info test
Browse files Browse the repository at this point in the history
  • Loading branch information
xgreenx committed Oct 4, 2024
1 parent dc98ec6 commit 05d811d
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions tests/tests/node_info.rs
Original file line number Diff line number Diff line change
Expand Up @@ -92,8 +92,18 @@ async fn test_peer_info() {
// This is just a mock of what we should be able to do with GQL API.
let client = producer.node.bound_address;
let client = FuelClient::from(client);
let peers = client.connected_peers_info().await.unwrap();
assert_eq!(peers.len(), 2);
let mut peers;

// It takes some time before all validators are connected.
loop {
peers = client.connected_peers_info().await.unwrap();

if peers.len() == 2 {
break;
}
tokio::time::sleep(Duration::from_secs(1)).await;

This comment has been minimized.

Copy link
@rymnc

rymnc Oct 5, 2024

Member

i think if there is a big with the internal code, this loop will continue indefinitely, and might result in the workflow timing out, I would suggest to have a finite amount of sleeps, we can be pessimistic and set it to a large number if required

}

let info = peers
.iter()
.find(|info| info.id.to_string() == validator_peer_id.to_base58())
Expand Down

0 comments on commit 05d811d

Please sign in to comment.