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

pubsub makes no guarantee on Windows and with go-ipfs #188

Merged
merged 2 commits into from
Mar 9, 2018
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
30 changes: 26 additions & 4 deletions js/src/pubsub.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,10 @@ const whilst = require('async/whilst')
const each = require('async/each')
const hat = require('hat')

// On Browsers it will be false, but the tests currently aren't run
// there anyway
let isWindows = process.platform && process.platform === 'win32'

function waitForPeers (ipfs, topic, peersToWait, callback) {
const i = setInterval(() => {
ipfs.pubsub.peers(topic, (err, peers) => {
Expand Down Expand Up @@ -67,6 +71,7 @@ module.exports = (common) => {
let ipfs1
let ipfs2
let ipfs3
let withGo

before(function (done) {
// CI takes longer to instantiate the daemon, so we need to increase the
Expand All @@ -90,7 +95,12 @@ module.exports = (common) => {
ipfs1 = nodes[0]
ipfs2 = nodes[1]
ipfs3 = nodes[2]
done()

ipfs1.id((err, id) => {
expect(err).to.not.exist()
withGo = id.agentVersion.startsWith('go-ipfs')
done()
})
})
})
})
Expand Down Expand Up @@ -497,7 +507,13 @@ module.exports = (common) => {
})
})

it('receive multiple messages', (done) => {
it('receive multiple messages', function (done) {
// TODO fix https://github.com/ipfs/interface-ipfs-core/pull/188#issuecomment-354673246
// and https://github.com/ipfs/go-ipfs/issues/4778
if (withGo && isWindows) {
this.skip()
}

const inbox1 = []
const inbox2 = []
const outbox = ['hello', 'world', 'this', 'is', 'pubsub']
Expand Down Expand Up @@ -566,11 +582,17 @@ module.exports = (common) => {
let sub1
let sub2

before(() => {
beforeEach(function () {
// TODO fix https://github.com/ipfs/interface-ipfs-core/pull/188#issuecomment-354673246
// and https://github.com/ipfs/go-ipfs/issues/4778
if (withGo && isWindows) {
this.skip()
}

topic = getTopic()
})

after(() => {
afterEach(() => {
ipfs1.pubsub.unsubscribe(topic, sub1)
ipfs2.pubsub.unsubscribe(topic, sub2)
})
Expand Down