Skip to content
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

Fix no self in root peers in Diffusion tests #3761

Merged
merged 1 commit into from
May 23, 2022
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
Original file line number Diff line number Diff line change
Expand Up @@ -128,14 +128,14 @@ data Command = JoinNetwork DiffTime (Maybe NtNAddr)
deriving (Show, Eq)

-- | Generate DNS table
genDomainMap :: [RelayAccessPoint] -> Gen (Map Domain [IP])
genDomainMap raps = do
genDomainMap :: [RelayAccessPoint] -> IP -> Gen (Map Domain [IP])
genDomainMap raps selfIP = do
let domains = [ d | RelayAccessDomain d _ <- raps ]
ips = [ ip | RelayAccessAddress ip _ <- raps ]
m <- mapM (\d -> do
size <- chooseInt (1, 5)
ips' <- nub <$> vectorOf size (genIP ips)
return (d, ips')) domains
return (d, delete selfIP ips')) domains

return (Map.fromList m)

Expand Down Expand Up @@ -256,9 +256,10 @@ instance Arbitrary DiffusionScript where
bgaSlotDuration = secondsToDiffTime 1
numberOfNodes = length [ r | r@(RelayAccessAddress _ _) <- raps ]
quota = 20 `div` numberOfNodes
(RelayAccessAddress rapIP _) = rap
bgaSeed <- mkStdGen <$> arbitrary

dMap <- genDomainMap rapsWithoutSelf
dMap <- genDomainMap rapsWithoutSelf rapIP

-- These values approximately correspond to false positive
-- thresholds for streaks of empty slots with 99% probability,
Expand Down