From 6248ec1cc2621a21af29f29d0f1a06e488728511 Mon Sep 17 00:00:00 2001 From: Alan Shaw Date: Tue, 6 Aug 2019 13:42:15 +0100 Subject: [PATCH] fix: swarm.peers latency value when unknown (#2336) go-ipfs returns "n/a" when latency is unknown. This change restores compatibility. License: MIT Signed-off-by: Alan Shaw --- package.json | 2 +- src/core/components/swarm.js | 2 +- test/core/interface.spec.js | 27 ++++++++++++++++++++++----- test/http-api/interface.js | 27 ++++++++++++++++++++++----- 4 files changed, 46 insertions(+), 12 deletions(-) diff --git a/package.json b/package.json index bede8b3f7a..f85c52a0f3 100644 --- a/package.json +++ b/package.json @@ -190,7 +190,7 @@ "execa": "^2.0.3", "form-data": "^2.5.0", "hat": "0.0.3", - "interface-ipfs-core": "~0.107.3", + "interface-ipfs-core": "^0.109.1", "ipfsd-ctl": "^0.43.0", "libp2p-websocket-star": "~0.10.2", "ncp": "^2.0.0", diff --git a/src/core/components/swarm.js b/src/core/components/swarm.js index 4869cf2032..d41ebca9a3 100644 --- a/src/core/components/swarm.js +++ b/src/core/components/swarm.js @@ -34,7 +34,7 @@ module.exports = function swarm (self) { peer: peer.id } if (verbose) { - tupple.latency = 'unknown' + tupple.latency = 'n/a' } peers.push(tupple) diff --git a/test/core/interface.spec.js b/test/core/interface.spec.js index a091dd0ea4..e1dba42bbe 100644 --- a/test/core/interface.spec.js +++ b/test/core/interface.spec.js @@ -17,10 +17,20 @@ describe('interface-ipfs-core tests', function () { tests.bootstrap(defaultCommonFactory) tests.config(defaultCommonFactory, { - skip: [{ - name: 'should set a number', - reason: 'Failing - needs to be fixed' - }] + skip: [ + { + name: 'should set a number', + reason: 'Failing - needs to be fixed' + }, + { + name: 'should output changes but not save them for dry run', + reason: 'TODO unskip when https://github.com/ipfs/js-ipfs/pull/2165 is merged' + }, + { + name: 'should set a config profile', + reason: 'TODO unskip when https://github.com/ipfs/js-ipfs/pull/2165 is merged' + } + ] }) tests.dag(defaultCommonFactory) @@ -119,7 +129,14 @@ describe('interface-ipfs-core tests', function () { } })) - tests.object(defaultCommonFactory) + tests.object(defaultCommonFactory, { + skip: [ + { + name: 'should respect timeout option', + reason: 'js-ipfs doesn\'t support timeout yet' + } + ] + }) tests.pin(defaultCommonFactory) diff --git a/test/http-api/interface.js b/test/http-api/interface.js index cedeccee06..48f708f747 100644 --- a/test/http-api/interface.js +++ b/test/http-api/interface.js @@ -17,10 +17,20 @@ describe('interface-ipfs-core over ipfs-http-client tests', () => { tests.bootstrap(defaultCommonFactory) tests.config(defaultCommonFactory, { - skip: [{ - name: 'should set a number', - reason: 'Failing - needs to be fixed' - }] + skip: [ + { + name: 'should set a number', + reason: 'Failing - needs to be fixed' + }, + { + name: 'should output changes but not save them for dry run', + reason: 'TODO unskip when https://github.com/ipfs/js-ipfs/pull/2165 is merged' + }, + { + name: 'should set a config profile', + reason: 'TODO unskip when https://github.com/ipfs/js-ipfs/pull/2165 is merged' + } + ] }) tests.dag(defaultCommonFactory, { @@ -122,7 +132,14 @@ describe('interface-ipfs-core over ipfs-http-client tests', () => { } })) - tests.object(defaultCommonFactory) + tests.object(defaultCommonFactory, { + skip: [ + { + name: 'should respect timeout option', + reason: 'js-ipfs doesn\'t support timeout yet' + } + ] + }) tests.pin(defaultCommonFactory)