Skip to content
This repository has been archived by the owner on Mar 10, 2020. It is now read-only.

Commit

Permalink
fix: change secondary node to Go
Browse files Browse the repository at this point in the history
  • Loading branch information
hugomrdias committed Dec 3, 2019
1 parent b37b2e7 commit a942fb9
Show file tree
Hide file tree
Showing 7 changed files with 12 additions and 16 deletions.
2 changes: 1 addition & 1 deletion src/bitswap/stat.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ module.exports = (common, options) => {
const node = await common.node()
await node.stop()

return expect(node.bitswap.stat()).to.eventually.be.rejected()
return expect(node.api.bitswap.stat()).to.eventually.be.rejected()
})
})
}
6 changes: 3 additions & 3 deletions src/bitswap/wantlist.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,9 @@ module.exports = (common, options) => {
before(async () => {
ipfsA = await common.setup()
ipfsB = await common.setup({ type: 'js' })
await ipfsA.swarm.connect(ipfsB.peerId.addresses[0])
// Add key to the wantlist for ipfsB
ipfsB.block.get(key, () => {})
await ipfsA.swarm.connect(ipfsB.peerId.addresses[0])
})

after(() => common.teardown())
Expand All @@ -33,15 +33,15 @@ module.exports = (common, options) => {
return waitForWantlistKey(ipfsB, key)
})

it('should get the wantlist by peer ID for a diffreent node', () => {
it('should get the wantlist by peer ID for a different node', () => {
return waitForWantlistKey(ipfsA, key, { peerId: ipfsB.peerId.id })
})

it('should not get the wantlist when offline', async () => {
const node = await common.node()
await node.stop()

return expect(node.bitswap.stat()).to.eventually.be.rejected()
return expect(node.api.bitswap.stat()).to.eventually.be.rejected()
})
})
}
3 changes: 1 addition & 2 deletions src/miscellaneous/resolve.js
Original file line number Diff line number Diff line change
Expand Up @@ -81,9 +81,8 @@ module.exports = (common, options) => {

it('should resolve IPNS link recursively', async function () {
this.timeout(20 * 1000)
const node = await common.setup({ type: 'js' })
const node = await common.setup({ type: 'go' })
await ipfs.swarm.connect(node.peerId.addresses[0])

const [{ path }] = await ipfs.add(Buffer.from('should resolve a record recursive === true'))
const { id: keyId } = await ipfs.key.gen('key-name', { type: 'rsa', size: 2048 })

Expand Down
3 changes: 1 addition & 2 deletions src/miscellaneous/stop.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,9 @@ module.exports = (common, options) => {
const ipfs = await common.node()

await ipfs.stop()

// Trying to stop an already stopped node should return an error
// as the node can't respond to requests anymore
return expect(ipfs.stop()).to.eventually.be.rejected()
return expect(ipfs.api.stop()).to.eventually.be.rejected()
})
})
}
4 changes: 2 additions & 2 deletions src/pubsub/peers.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@ module.exports = (common, options) => {
let subscribedTopics = []
before(async () => {
ipfs1 = await common.setup()
ipfs2 = await common.setup({ type: 'js' })
ipfs3 = await common.setup({ type: 'js' })
ipfs2 = await common.setup({ type: 'go' })
ipfs3 = await common.setup({ type: 'go' })

const ipfs2Addr = ipfs2.peerId.addresses.find((a) => a.includes('127.0.0.1'))
const ipfs3Addr = ipfs3.peerId.addresses.find((a) => a.includes('127.0.0.1'))
Expand Down
4 changes: 1 addition & 3 deletions src/pubsub/subscribe.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,9 @@ module.exports = (common, options) => {

before(async () => {
ipfs1 = await common.setup()
ipfs2 = await common.setup({ type: 'js' })
ipfs2 = await common.setup({ type: 'go' })
})

after(() => common.teardown())

beforeEach(() => {
topic = getTopic()
subscribedTopics = [topic]
Expand Down
6 changes: 3 additions & 3 deletions src/swarm/peers.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ module.exports = (common, options) => {

before(async () => {
ipfsA = await common.setup()
ipfsB = await common.setup({ type: 'js' })
ipfsB = await common.setup({ type: 'go' })
await ipfsA.swarm.connect(ipfsB.peerId.addresses[0])
await delay(60 * 1000) // wait for open streams in the connection available
})
Expand Down Expand Up @@ -85,7 +85,7 @@ module.exports = (common, options) => {

it('should list peers only once', async () => {
const nodeA = await common.setup()
const nodeB = await common.setup({ type: 'js' })
const nodeB = await common.setup({ type: 'go' })
await nodeA.swarm.connect(nodeB.peerId.addresses[0])
await delay(1000)
const peersA = await nodeA.swarm.peers()
Expand All @@ -105,7 +105,7 @@ module.exports = (common, options) => {
'/ip4/127.0.0.1/tcp/26546/ws'
])
const nodeA = await common.setup({ ipfsOptions: { config: configA } })
const nodeB = await common.setup({ type: 'js', ipfsOptions: { config: configB } })
const nodeB = await common.setup({ type: 'go', ipfsOptions: { config: configB } })
await nodeA.swarm.connect(nodeB.peerId.addresses[0])
await delay(1000)
const peersA = await nodeA.swarm.peers()
Expand Down

0 comments on commit a942fb9

Please sign in to comment.