patches flaky test_push_votes_with_tower (#26554)

cargo test --package solana-gossip --release test_push_votes_with_tower

occasionally fails because with --release all votes are generated at
the same wallclock (milliseconds resolution) and so the new ones will
not necessarily override existing entries in the table.

The commit ensures that the new vote is pushed with a wallclock later
than existing entries.
This commit is contained in:
behzad nouri 2022-07-11 12:56:31 +00:00 committed by GitHub
parent ba785cf8ab
commit 128226c6cc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 3 additions and 0 deletions

View File

@ -3874,6 +3874,9 @@ RPC Enabled Nodes: 1"#;
tower.push(slot);
tower.remove(23);
let vote = new_vote_transaction(&mut rng, vec![slot]);
// New versioned-crds-value should have wallclock later than existing
// entries, otherwise might not get inserted into the table.
sleep(Duration::from_millis(5));
cluster_info.push_vote(&tower, vote);
let vote_slots = get_vote_slots(&cluster_info);
assert_eq!(vote_slots.len(), MAX_LOCKOUT_HISTORY);