From 6aeca2f26384fdd546e3e0ba8cce04ae33a5a0d8 Mon Sep 17 00:00:00 2001 From: Richard Schneider Date: Sun, 31 Dec 2017 10:15:57 +1300 Subject: [PATCH 1/2] test: skip some tests because pubsub does not make any gaurantee on message deliery --- js/src/pubsub.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/js/src/pubsub.js b/js/src/pubsub.js index 433c73a47..c2ba4b9d4 100644 --- a/js/src/pubsub.js +++ b/js/src/pubsub.js @@ -575,7 +575,7 @@ module.exports = (common) => { ipfs2.pubsub.unsubscribe(topic, sub2) }) - it('send/receive 10k messages', function (done) { + it.skip('send/receive 10k messages', function (done) { this.timeout(2 * 60 * 1000) const msgBase = 'msg - ' From 8dccdc5fd71e57a1f723b32dad29ee6c5913c92a Mon Sep 17 00:00:00 2001 From: David Dias Date: Fri, 12 Jan 2018 14:19:21 +0000 Subject: [PATCH 2/2] fix: only skip if it is go-ipfs on Windows --- js/src/pubsub.js | 32 +++++++++++++++++++++++++++----- 1 file changed, 27 insertions(+), 5 deletions(-) diff --git a/js/src/pubsub.js b/js/src/pubsub.js index c2ba4b9d4..0b99530e1 100644 --- a/js/src/pubsub.js +++ b/js/src/pubsub.js @@ -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) => { @@ -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 @@ -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() + }) }) }) }) @@ -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'] @@ -566,16 +582,22 @@ 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) }) - it.skip('send/receive 10k messages', function (done) { + it('send/receive 10k messages', function (done) { this.timeout(2 * 60 * 1000) const msgBase = 'msg - '