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

chore: update libp2p daemon with peer-store #36

Merged
merged 5 commits into from
Jun 8, 2020
Merged
Show file tree
Hide file tree
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
5 changes: 3 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,10 @@
"cross-env": "^7.0.0",
"dirty-chai": "^2.0.1",
"go-libp2p-dep": "~0.8.1",
"libp2p-daemon": "^0.3.1",
"libp2p-daemon-client": "^0.3.0",
"libp2p-daemon": "^0.4.0",
"libp2p-daemon-client": "^0.4.0",
"multiaddr": "^7.2.1",
"p-retry": "^4.2.0",
"rimraf": "^3.0.0"
},
"contributors": [
Expand Down
4 changes: 2 additions & 2 deletions test/dht/peer-routing/go2go.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,8 @@ describe('dht.peerRouting', () => {
await daemons[0].client.connect(identify2.peerId, identify2.addrs)

// peer 1 find peer 2
const peerInfo = await daemons[1].client.dht.findPeer(identify2.peerId)
const peerData = await daemons[1].client.dht.findPeer(identify2.peerId)

expect(peerInfo.multiaddrs.toArray()).to.have.deep.members(identify2.addrs)
expect(peerData.addrs).to.have.deep.members(identify2.addrs)
})
})
4 changes: 2 additions & 2 deletions test/dht/peer-routing/go2js.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,8 @@ describe('dht.peerRouting', () => {
await daemons[0].client.connect(identify2.peerId, identify2.addrs)

// peer 1 find peer 2
const peerInfo = await daemons[1].client.dht.findPeer(identify2.peerId)
const peerData = await daemons[1].client.dht.findPeer(identify2.peerId)

expect(identify2.addrs).to.include.deep.members(peerInfo.multiaddrs.toArray())
expect(identify2.addrs).to.include.deep.members(peerData.addrs)
})
})
10 changes: 4 additions & 6 deletions test/dht/peer-routing/js2go.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ const chai = require('chai')
chai.use(require('dirty-chai'))
chai.use(require('chai-checkmark'))
const expect = chai.expect
const pRetry = require('p-retry')

const spawnDaemons = require('../../utils/spawnDaemons')

Expand Down Expand Up @@ -36,12 +37,9 @@ describe('dht.peerRouting', () => {
// connect 0 => 2
await daemons[0].client.connect(identify2.peerId, identify2.addrs)

// daemons[0] will take some time to have the peers in the routing table
await new Promise(resolve => setTimeout(resolve, 1000))
// peer 1 find peer 2, retry up to 10 times to allow the routing table to refresh
const peerData = await pRetry(() => daemons[1].client.dht.findPeer(identify2.peerId), { retry: 10 })

// peer 1 find peer 2
const peerInfo = await daemons[1].client.dht.findPeer(identify2.peerId)

expect(identify2.addrs).to.include.deep.members(peerInfo.multiaddrs.toArray())
expect(identify2.addrs).to.include.deep.members(peerData.addrs)
})
})
10 changes: 4 additions & 6 deletions test/dht/peer-routing/js2js.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ const chai = require('chai')
chai.use(require('dirty-chai'))
chai.use(require('chai-checkmark'))
const expect = chai.expect
const pRetry = require('p-retry')

const spawnDaemons = require('../../utils/spawnDaemons')

Expand Down Expand Up @@ -36,12 +37,9 @@ describe('dht.peerRouting', () => {
// connect 0 => 2
await daemons[0].client.connect(identify2.peerId, identify2.addrs)

// daemons[0] will take some time to have the peers in the routing table
await new Promise(resolve => setTimeout(resolve, 1000))
// peer 1 find peer 2, retry up to 10 times to allow the routing table to refresh
const peerData = await pRetry(() => daemons[1].client.dht.findPeer(identify2.peerId), { retry: 10 })

// peer 1 find peer 2
const peerInfo = await daemons[1].client.dht.findPeer(identify2.peerId)

expect(peerInfo.multiaddrs.toArray()).to.have.deep.members(identify2.addrs)
expect(peerData.addrs).to.have.deep.members(identify2.addrs)
})
})