Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: remove potential flakiness from a snapshot_hosts test (#10317)
The test `snapshot_hosts::invalid_signature_not_broadcast` sends out a message containing three instances of `SnapshotHostInfo`, one of which has an invalid signature, and then verifies that this message is rejected. There is a subtelty here that I didn't take into account when I wrote this test. When the `PeerManager` receives a message with multiple `SnapshotHostInfos`, it can accept the valid instances, even in the case where there are other invalid instances in the message. Because of this the test could fail - `PeerManager` could accept `ok_info_a` or `ok_info_b` and then the final assert would fail. Whether it accepts them or not depends on the timing, as the instances are processed on multiple threads and the processing stops at the first invalid instance. Because of that the test could be flaky. Let's fix it by filtering out `ok_info_a` and `ok_info_b` in the final check. This way even if the `PeerManager` accepts them, it won't break the test. The code is the same as in `snapshot_hosts::too_many_shards_not_broadcast()`.
- Loading branch information