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(test): improve flakey random walk discovery test #574

Merged
merged 2 commits into from
Feb 28, 2020
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
13 changes: 8 additions & 5 deletions test/peer-discovery/index.node.js
Original file line number Diff line number Diff line change
Expand Up @@ -139,17 +139,21 @@ describe('peer discovery scenarios', () => {
},
dht: {
randomWalk: {
enabled: true,
enabled: false,
delay: 1000, // start the first query quickly
interval: 10000,
timeout: 1000
timeout: 5000
},
enabled: true
}
}
})

libp2p = new Libp2p(getConfig(peerInfo))
const localConfig = getConfig(peerInfo)
// Only run random walk on our local node
localConfig.config.dht.randomWalk.enabled = true
libp2p = new Libp2p(localConfig)

const remoteLibp2p1 = new Libp2p(getConfig(remotePeerInfo1))
const remoteLibp2p2 = new Libp2p(getConfig(remotePeerInfo2))

Expand All @@ -161,6 +165,7 @@ describe('peer discovery scenarios', () => {
})

await Promise.all([
libp2p.start(),
remoteLibp2p1.start(),
remoteLibp2p2.start()
])
Expand All @@ -173,8 +178,6 @@ describe('peer discovery scenarios', () => {
remoteLibp2p2.dial(remotePeerInfo1)
])

libp2p.start()

await deferred.promise
return Promise.all([
remoteLibp2p1.stop(),
Expand Down