Skip to content

Fix flakey bloomfilter test prop_calc_size_fpr_fpr #724

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
May 15, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 11 additions & 1 deletion bloomfilter/tests/bloomfilter-tests.hs
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,17 @@ prop_calc_size_fpr_fpr proxy (FPR fpr) (NumEntries numEntries) =
(fromIntegral (B.sizeHashes bsize))
~~~ fpr
where
(~~~) = withinTolerance 1e-6
(~~~) = withinTolerance tolerance
-- At small filter sizes (corresponding to high FPRs), we get significant
-- reductions in accuracy due to rounding the number of bits to an integer.
-- So we use greater tolerances for bigger FPRs.
-- Contrast with prop_calc_policy_fpr which does not do rounding to an
-- integer number of bits (it uses Double for bits per key), and thus can
-- use a very small tolerance.
tolerance | fpr <= 0.01 = 1e-6
| fpr <= 0.05 = 1e-5
| fpr <= 0.5 = 1e-4
| otherwise = 1e-3

-- | Compare @sizeForBits@ against @falsePositiveRate@ with some tolerance for deviations
prop_calc_size_fpr_bits :: BloomFilter bloom => Proxy bloom
Expand Down