Skip to content

Commit

Permalink
Merge #4480
Browse files Browse the repository at this point in the history
4480: Fix "insert peer invariant test" r=bolt12 a=bolt12

This test checks that newly added peer is never in the 20% worst performing peers (if there are at least 5 results). However we were not checking that the list had at least 5 results.

Fixes #4092 

Co-authored-by: Armando Santos <armando@well-typed.com>
  • Loading branch information
iohk-bors[bot] and bolt12 authored Apr 12, 2023
2 parents 11777f7 + 28ac0ad commit eddc225
Showing 1 changed file with 1 addition and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -278,7 +278,7 @@ prop_insert_peer script =
checkResult name peer joinedAt m =
(\peers -> counterexample (name ++ ": peer (" ++ show peer ++ ") member of "
++ show (peers, m'))
(Set.notMember peer peers))
(Set.size peers < 5 || Set.notMember peer peers))
. Set.fromList
. map fst
. take (size `div` 5)
Expand All @@ -293,7 +293,6 @@ prop_insert_peer script =
joinedAt
size = Map.size m


-- | Check that the results are always positive.
--
prop_metrics_are_bounded :: FixedScript -> Property
Expand Down

0 comments on commit eddc225

Please sign in to comment.