From ae5a20030286ba26d0e17dc8cc095912d780f5e0 Mon Sep 17 00:00:00 2001 From: Hugo Dias Date: Fri, 11 Oct 2019 15:40:19 +0100 Subject: [PATCH 01/12] feat: add support for a simpler and async test setup --- package.json | 5 +++-- src/bitswap/stat.js | 19 +++++++++---------- src/bitswap/wantlist.js | 23 +++++++++++------------ src/block/get.js | 8 ++++++-- src/block/put.js | 8 ++++++-- src/block/rm.js | 16 +++++++--------- src/block/stat.js | 8 ++++++-- src/bootstrap/add.js | 8 ++++++-- src/bootstrap/list.js | 16 +++++++--------- src/bootstrap/rm.js | 16 +++++++--------- src/config/get.js | 16 +++++++--------- src/config/profiles/apply.js | 9 ++++++--- src/config/profiles/list.js | 9 ++++++--- src/config/replace.js | 9 ++++++--- src/config/set.js | 9 ++++++--- src/dag/get.js | 17 +++++++---------- src/dag/put.js | 8 ++++++-- src/dag/tree.js | 8 ++++++-- src/dht/find-peer.js | 8 ++++++-- src/dht/find-provs.js | 14 +++++++------- src/dht/get.js | 8 ++++++-- src/dht/provide.js | 8 ++++++-- src/dht/put.js | 8 ++++++-- src/dht/query.js | 8 ++++++-- src/files-mfs/cp.js | 8 ++++++-- src/files-mfs/flush.js | 8 ++++++-- src/files-mfs/ls-pull-stream.js | 8 ++++++-- src/files-mfs/ls-readable-stream.js | 8 ++++++-- src/files-mfs/ls.js | 8 ++++++-- src/files-mfs/mkdir.js | 8 ++++++-- src/files-mfs/mv.js | 8 ++++++-- src/files-mfs/read-pull-stream.js | 8 ++++++-- src/files-mfs/read-readable-stream.js | 8 ++++++-- src/files-mfs/read.js | 8 ++++++-- src/files-mfs/rm.js | 8 ++++++-- src/files-mfs/stat.js | 8 ++++++-- src/files-mfs/write.js | 8 ++++++-- src/files-regular/add-from-fs.js | 8 ++++++-- src/files-regular/add-from-stream.js | 8 ++++++-- src/files-regular/add-from-url.js | 8 ++++++-- src/files-regular/add-pull-stream.js | 8 ++++++-- src/files-regular/add-readable-stream.js | 8 ++++++-- src/files-regular/add.js | 8 ++++++-- src/files-regular/cat-pull-stream.js | 8 ++++++-- src/files-regular/cat-readable-stream.js | 8 ++++++-- src/files-regular/cat.js | 8 ++++++-- src/files-regular/get-pull-stream.js | 8 ++++++-- src/files-regular/get-readable-stream.js | 8 ++++++-- src/files-regular/get.js | 8 ++++++-- src/files-regular/ls-pull-stream.js | 8 ++++++-- src/files-regular/ls-readable-stream.js | 8 ++++++-- src/files-regular/ls.js | 8 ++++++-- src/files-regular/refs-local-tests.js | 10 ++++++++-- src/files-regular/refs-tests.js | 10 ++++++++-- src/key/export.js | 8 ++++++-- src/key/gen.js | 8 ++++++-- src/key/import.js | 8 ++++++-- src/key/list.js | 8 ++++++-- src/key/rename.js | 8 ++++++-- src/key/rm.js | 8 ++++++-- src/miscellaneous/dns.js | 8 ++++++-- src/miscellaneous/id.js | 8 ++++++-- src/miscellaneous/resolve.js | 8 ++++++-- src/miscellaneous/stop.js | 17 +++++++++++------ src/miscellaneous/version.js | 8 ++++++-- src/name-pubsub/cancel.js | 8 ++++++-- src/name-pubsub/state.js | 8 ++++++-- src/name-pubsub/subs.js | 8 ++++++-- src/name/publish.js | 8 ++++++-- src/name/resolve.js | 11 +++++++---- src/object/data.js | 8 ++++++-- src/object/get.js | 8 ++++++-- src/object/links.js | 8 ++++++-- src/object/new.js | 8 ++++++-- src/object/patch/add-link.js | 8 ++++++-- src/object/patch/append-data.js | 8 ++++++-- src/object/patch/rm-link.js | 8 ++++++-- src/object/patch/set-data.js | 8 ++++++-- src/object/put.js | 8 ++++++-- src/object/stat.js | 8 ++++++-- src/pin/add.js | 15 +++++++-------- src/pin/ls.js | 8 ++++++-- src/pin/rm.js | 15 +++++++-------- src/ping/ping-pull-stream.js | 8 ++++++-- src/ping/ping-readable-stream.js | 8 ++++++-- src/ping/ping.js | 8 ++++++-- src/pubsub/ls.js | 15 +++++++-------- src/pubsub/peers.js | 15 +++++++-------- src/pubsub/publish.js | 8 ++++++-- src/pubsub/subscribe.js | 10 ++++++++-- src/pubsub/unsubscribe.js | 8 ++++++-- src/repo/gc.js | 8 ++++++-- src/repo/stat.js | 8 ++++++-- src/repo/version.js | 8 ++++++-- src/stats/bitswap.js | 8 ++++++-- src/stats/bw-pull-stream.js | 8 ++++++-- src/stats/bw-readable-stream.js | 8 ++++++-- src/stats/bw.js | 8 ++++++-- src/stats/repo.js | 8 ++++++-- src/swarm/addrs.js | 8 ++++++-- src/swarm/connect.js | 8 ++++++-- src/swarm/disconnect.js | 8 ++++++-- src/swarm/local-addrs.js | 8 ++++++-- src/swarm/peers.js | 8 ++++++-- 104 files changed, 651 insertions(+), 301 deletions(-) diff --git a/package.json b/package.json index a563b6b7c..fe926c906 100644 --- a/package.json +++ b/package.json @@ -55,7 +55,7 @@ "ipld-dag-pb": "^0.18.1", "is-ipfs": "~0.6.1", "is-plain-object": "^3.0.0", - "it-pushable": "^1.2.1", + "it-pushable": "^1.3.1", "libp2p-crypto": "~0.16.0", "multiaddr": "^6.0.0", "multibase": "~0.6.0", @@ -75,7 +75,8 @@ "through2": "^3.0.0" }, "devDependencies": { - "aegir": "^20.0.0" + "aegir": "^20.3.2", + "ipfsd-ctl": "ipfs/js-ipfsd-ctl#feat/interface-tests" }, "contributors": [ "Alan Shaw ", diff --git a/src/bitswap/stat.js b/src/bitswap/stat.js index de99bc4a2..93f919de6 100644 --- a/src/bitswap/stat.js +++ b/src/bitswap/stat.js @@ -4,19 +4,20 @@ const { getDescribe, getIt, expect } = require('../utils/mocha') const { expectIsBitswap } = require('../stats/utils') -module.exports = (createCommon, options) => { +/** @typedef { import("ipfsd-ctl").TestsInterface } TestsInterface */ +/** + * @param {TestsInterface} common + * @param {Object} options + */ +module.exports = (common, options) => { const describe = getDescribe(options) const it = getIt(options) - const common = createCommon() describe('.bitswap.stat', () => { + this.timeout(60 * 1000) let ipfs - before(async function () { - // CI takes longer to instantiate the daemon, so we need to increase the - // timeout for the before step - this.timeout(60 * 1000) - + before(async () => { ipfs = await common.setup() }) @@ -28,9 +29,7 @@ module.exports = (createCommon, options) => { }) it('should not get bitswap stats when offline', async function () { - this.timeout(60 * 1000) - - const node = await createCommon().setup() + const node = await common.node() await node.stop() return expect(node.bitswap.stat()).to.eventually.be.rejected() diff --git a/src/bitswap/wantlist.js b/src/bitswap/wantlist.js index 63ca125d7..3a4e8a2ab 100644 --- a/src/bitswap/wantlist.js +++ b/src/bitswap/wantlist.js @@ -4,12 +4,17 @@ const { getDescribe, getIt, expect } = require('../utils/mocha') const { waitForWantlistKey } = require('./utils') -module.exports = (createCommon, options) => { +/** @typedef { import("ipfsd-ctl").TestsInterface } TestsInterface */ +/** + * @param {TestsInterface} common + * @param {Object} options + */ +module.exports = (common, options) => { const describe = getDescribe(options) const it = getIt(options) - const common = createCommon() - describe('.bitswap.wantlist', () => { + describe('.bitswap.wantlist', function () { + this.timeout(60 * 1000) let ipfsA let ipfsB const key = 'QmUBdnXXPyoDFXj3Hj39dNJ5VkN3QFRskXxcGaYFBB8CNR' @@ -21,11 +26,9 @@ module.exports = (createCommon, options) => { ipfsA = await common.setup() ipfsB = await common.setup() - + await ipfsA.swarm.connect(ipfsB.peerId.addresses[0]) // Add key to the wantlist for ipfsB ipfsB.block.get(key).catch(() => {}) - - await ipfsA.swarm.connect(ipfsB.peerId.addresses[0]) }) after(function () { @@ -35,22 +38,18 @@ module.exports = (createCommon, options) => { }) it('should get the wantlist', function () { - this.timeout(60 * 1000) return waitForWantlistKey(ipfsB, key) }) it('should get the wantlist by peer ID for a different node', function () { - this.timeout(60 * 1000) return waitForWantlistKey(ipfsA, key, { peerId: ipfsB.peerId.id, timeout: 60 * 1000 }) }) - it('should not get the wantlist when offline', async function () { - this.timeout(60 * 1000) - - const node = await createCommon().setup() + it('should not get the wantlist when offline', async () => { + const node = await common.node() await node.stop() return expect(node.bitswap.wantlist()).to.eventually.be.rejected() diff --git a/src/block/get.js b/src/block/get.js index e07e68d5d..576ab72a7 100644 --- a/src/block/get.js +++ b/src/block/get.js @@ -5,10 +5,14 @@ const multihash = require('multihashes') const CID = require('cids') const { getDescribe, getIt, expect } = require('../utils/mocha') -module.exports = (createCommon, options) => { +/** @typedef { import("ipfsd-ctl").TestsInterface } TestsInterface */ +/** + * @param {TestsInterface} common + * @param {Object} options + */ +module.exports = (common, options) => { const describe = getDescribe(options) const it = getIt(options) - const common = createCommon() describe('.block.get', () => { const data = Buffer.from('blorb') diff --git a/src/block/put.js b/src/block/put.js index ec8d3ffb1..b29daef63 100644 --- a/src/block/put.js +++ b/src/block/put.js @@ -6,10 +6,14 @@ const multihash = require('multihashes') const CID = require('cids') const { getDescribe, getIt, expect } = require('../utils/mocha') -module.exports = (createCommon, options) => { +/** @typedef { import("ipfsd-ctl").TestsInterface } TestsInterface */ +/** + * @param {TestsInterface} common + * @param {Object} options + */ +module.exports = (common, options) => { const describe = getDescribe(options) const it = getIt(options) - const common = createCommon() describe('.block.put', () => { let ipfs diff --git a/src/block/rm.js b/src/block/rm.js index e5fe1fe0e..327d02c70 100644 --- a/src/block/rm.js +++ b/src/block/rm.js @@ -4,21 +4,19 @@ const { getDescribe, getIt, expect } = require('../utils/mocha') const hat = require('hat') -module.exports = (createCommon, options) => { +/** @typedef { import("ipfsd-ctl").TestsInterface } TestsInterface */ +/** + * @param {TestsInterface} common + * @param {Object} options + */ +module.exports = (common, options) => { const describe = getDescribe(options) const it = getIt(options) - const common = createCommon() describe('.block.rm', () => { let ipfs - before(async function () { - // CI takes longer to instantiate the daemon, so we need to increase the - // timeout for the before step - this.timeout(60 * 1000) - - ipfs = await common.setup() - }) + before(async () => { ipfs = await common.setup() }) after(() => common.teardown()) diff --git a/src/block/stat.js b/src/block/stat.js index baa7a66ff..a048e9db7 100644 --- a/src/block/stat.js +++ b/src/block/stat.js @@ -4,10 +4,14 @@ const CID = require('cids') const { getDescribe, getIt, expect } = require('../utils/mocha') -module.exports = (createCommon, options) => { +/** @typedef { import("ipfsd-ctl").TestsInterface } TestsInterface */ +/** + * @param {TestsInterface} common + * @param {Object} options + */ +module.exports = (common, options) => { const describe = getDescribe(options) const it = getIt(options) - const common = createCommon() describe('.block.stat', () => { const data = Buffer.from('blorb') diff --git a/src/bootstrap/add.js b/src/bootstrap/add.js index c4a8440d6..1191e8e7d 100644 --- a/src/bootstrap/add.js +++ b/src/bootstrap/add.js @@ -6,10 +6,14 @@ const { getDescribe, getIt, expect } = require('../utils/mocha') const invalidArg = 'this/Is/So/Invalid/' const validIp4 = '/ip4/104.236.176.52/tcp/4001/ipfs/QmSoLnSGccFuZQJzRadHn95W2CrSFmZuTdDWP8HXaHca9z' -module.exports = (createCommon, options) => { +/** @typedef { import("ipfsd-ctl").TestsInterface } TestsInterface */ +/** + * @param {TestsInterface} common + * @param {Object} options + */ +module.exports = (common, options) => { const describe = getDescribe(options) const it = getIt(options) - const common = createCommon() describe('.bootstrap.add', function () { this.timeout(100 * 1000) diff --git a/src/bootstrap/list.js b/src/bootstrap/list.js index 033920571..eaef06f57 100644 --- a/src/bootstrap/list.js +++ b/src/bootstrap/list.js @@ -3,23 +3,21 @@ const { getDescribe, getIt, expect } = require('../utils/mocha') -module.exports = (createCommon, options) => { +/** @typedef { import("ipfsd-ctl").TestsInterface } TestsInterface */ +/** + * @param {TestsInterface} common + * @param {Object} options + */ +module.exports = (common, options) => { const describe = getDescribe(options) const it = getIt(options) - const common = createCommon() describe('.bootstrap.list', function () { this.timeout(100 * 1000) let ipfs - before(async function () { - // CI takes longer to instantiate the daemon, so we need to increase the - // timeout for the before step - this.timeout(60 * 1000) - - ipfs = await common.setup() - }) + before(async () => { ipfs = await common.setup() }) after(() => common.teardown()) diff --git a/src/bootstrap/rm.js b/src/bootstrap/rm.js index f8e200402..02f6f9feb 100644 --- a/src/bootstrap/rm.js +++ b/src/bootstrap/rm.js @@ -3,10 +3,14 @@ const { getDescribe, getIt, expect } = require('../utils/mocha') -module.exports = (createCommon, options) => { +/** @typedef { import("ipfsd-ctl").TestsInterface } TestsInterface */ +/** + * @param {TestsInterface} common + * @param {Object} options + */ +module.exports = (common, options) => { const describe = getDescribe(options) const it = getIt(options) - const common = createCommon() const invalidArg = 'this/Is/So/Invalid/' const validIp4 = '/ip4/104.236.176.52/tcp/4001/ipfs/QmSoLnSGccFuZQJzRadHn95W2CrSFmZuTdDWP8HXaHca9z' @@ -16,13 +20,7 @@ module.exports = (createCommon, options) => { let ipfs - before(async function () { - // CI takes longer to instantiate the daemon, so we need to increase the - // timeout for the before step - this.timeout(60 * 1000) - - ipfs = await common.setup() - }) + before(async () => { ipfs = await common.setup() }) after(() => common.teardown()) diff --git a/src/config/get.js b/src/config/get.js index 9470c1b67..3b219316e 100644 --- a/src/config/get.js +++ b/src/config/get.js @@ -4,22 +4,20 @@ const { getDescribe, getIt, expect } = require('../utils/mocha') const isPlainObject = require('is-plain-object') -module.exports = (createCommon, options) => { +/** @typedef { import("ipfsd-ctl").TestsInterface } TestsInterface */ +/** + * @param {TestsInterface} common + * @param {Object} options + */ +module.exports = (common, options) => { const describe = getDescribe(options) const it = getIt(options) - const common = createCommon() describe('.config.get', function () { this.timeout(30 * 1000) let ipfs - before(async function () { - // CI takes longer to instantiate the daemon, so we need to increase the - // timeout for the before step - this.timeout(60 * 1000) - - ipfs = await common.setup() - }) + before(async () => { ipfs = await common.setup() }) after(() => common.teardown()) diff --git a/src/config/profiles/apply.js b/src/config/profiles/apply.js index ca0b91262..6a399091c 100644 --- a/src/config/profiles/apply.js +++ b/src/config/profiles/apply.js @@ -2,11 +2,14 @@ 'use strict' const { getDescribe, getIt, expect } = require('../../utils/mocha') - -module.exports = (createCommon, options) => { +/** @typedef { import("ipfsd-ctl").TestsInterface } TestsInterface */ +/** + * @param {TestsInterface} common + * @param {Object} options + */ +module.exports = (common, options) => { const describe = getDescribe(options) const it = getIt(options) - const common = createCommon() describe('.config.profiles.apply', function () { this.timeout(30 * 1000) diff --git a/src/config/profiles/list.js b/src/config/profiles/list.js index ffe572388..67640fa06 100644 --- a/src/config/profiles/list.js +++ b/src/config/profiles/list.js @@ -2,11 +2,14 @@ 'use strict' const { getDescribe, getIt, expect } = require('../../utils/mocha') - -module.exports = (createCommon, options) => { +/** @typedef { import("ipfsd-ctl").TestsInterface } TestsInterface */ +/** + * @param {TestsInterface} common + * @param {Object} options + */ +module.exports = (common, options) => { const describe = getDescribe(options) const it = getIt(options) - const common = createCommon() describe('.config.profiles.list', function () { this.timeout(30 * 1000) diff --git a/src/config/replace.js b/src/config/replace.js index 67496a7d7..da17794b1 100644 --- a/src/config/replace.js +++ b/src/config/replace.js @@ -2,11 +2,14 @@ 'use strict' const { getDescribe, getIt, expect } = require('../utils/mocha') - -module.exports = (createCommon, options) => { +/** @typedef { import("ipfsd-ctl").TestsInterface } TestsInterface */ +/** + * @param {TestsInterface} common + * @param {Object} options + */ +module.exports = (common, options) => { const describe = getDescribe(options) const it = getIt(options) - const common = createCommon() describe('.config.replace', function () { this.timeout(30 * 1000) diff --git a/src/config/set.js b/src/config/set.js index 1e29d9234..5f88d3ce6 100644 --- a/src/config/set.js +++ b/src/config/set.js @@ -2,11 +2,14 @@ 'use strict' const { getDescribe, getIt, expect } = require('../utils/mocha') - -module.exports = (createCommon, options) => { +/** @typedef { import("ipfsd-ctl").TestsInterface } TestsInterface */ +/** + * @param {TestsInterface} common + * @param {Object} options + */ +module.exports = (common, options) => { const describe = getDescribe(options) const it = getIt(options) - const common = createCommon() describe('.config.set', function () { this.timeout(30 * 1000) diff --git a/src/dag/get.js b/src/dag/get.js index dc8ee9ee9..97788284d 100644 --- a/src/dag/get.js +++ b/src/dag/get.js @@ -9,21 +9,18 @@ const Unixfs = require('ipfs-unixfs') const CID = require('cids') const { getDescribe, getIt, expect } = require('../utils/mocha') -module.exports = (createCommon, options) => { +/** @typedef { import("ipfsd-ctl").TestsInterface } TestsInterface */ +/** + * @param {TestsInterface} common + * @param {Object} options + */ +module.exports = (common, options) => { const describe = getDescribe(options) const it = getIt(options) - const common = createCommon() describe('.dag.get', () => { let ipfs - - before(async function () { - // CI takes longer to instantiate the daemon, so we need to increase the - // timeout for the before step - this.timeout(60 * 1000) - - ipfs = await common.setup() - }) + before(async () => { ipfs = await common.setup() }) after(() => common.teardown()) diff --git a/src/dag/put.js b/src/dag/put.js index eb52106cb..b0d5edd33 100644 --- a/src/dag/put.js +++ b/src/dag/put.js @@ -8,10 +8,14 @@ const CID = require('cids') const multihash = require('multihashes') const { getDescribe, getIt, expect } = require('../utils/mocha') -module.exports = (createCommon, options) => { +/** @typedef { import("ipfsd-ctl").TestsInterface } TestsInterface */ +/** + * @param {TestsInterface} common + * @param {Object} options + */ +module.exports = (common, options) => { const describe = getDescribe(options) const it = getIt(options) - const common = createCommon() describe('.dag.put', () => { let ipfs diff --git a/src/dag/tree.js b/src/dag/tree.js index fe9826209..9451b936e 100644 --- a/src/dag/tree.js +++ b/src/dag/tree.js @@ -7,10 +7,14 @@ const DAGNode = dagPB.DAGNode const dagCBOR = require('ipld-dag-cbor') const { getDescribe, getIt, expect } = require('../utils/mocha') -module.exports = (createCommon, options) => { +/** @typedef { import("ipfsd-ctl").TestsInterface } TestsInterface */ +/** + * @param {TestsInterface} common + * @param {Object} options + */ +module.exports = (common, options) => { const describe = getDescribe(options) const it = getIt(options) - const common = createCommon() describe('.dag.tree', () => { let ipfs diff --git a/src/dht/find-peer.js b/src/dht/find-peer.js index 5c6c3b4e4..d0ab85ea5 100644 --- a/src/dht/find-peer.js +++ b/src/dht/find-peer.js @@ -3,10 +3,14 @@ const { getDescribe, getIt, expect } = require('../utils/mocha') -module.exports = (createCommon, options) => { +/** @typedef { import("ipfsd-ctl").TestsInterface } TestsInterface */ +/** + * @param {TestsInterface} common + * @param {Object} options + */ +module.exports = (common, options) => { const describe = getDescribe(options) const it = getIt(options) - const common = createCommon() describe('.dht.findPeer', function () { this.timeout(80 * 1000) diff --git a/src/dht/find-provs.js b/src/dht/find-provs.js index 9e3016666..1230279da 100644 --- a/src/dht/find-provs.js +++ b/src/dht/find-provs.js @@ -13,21 +13,21 @@ async function fakeCid () { return new CID(0, 'dag-pb', mh) } -module.exports = (createCommon, options) => { +/** @typedef { import("ipfsd-ctl").TestsInterface } TestsInterface */ +/** + * @param {TestsInterface} common + * @param {Object} options + */ +module.exports = (common, options) => { const describe = getDescribe(options) const it = getIt(options) - const common = createCommon() describe('.dht.findProvs', () => { let nodeA let nodeB let nodeC - before(async function () { - // CI takes longer to instantiate the daemon, so we need to increase the - // timeout for the before step - this.timeout(60 * 1000) - + before(async () => { nodeA = await common.setup() nodeB = await common.setup() nodeC = await common.setup() diff --git a/src/dht/get.js b/src/dht/get.js index 0fe6df9e4..c0651e454 100644 --- a/src/dht/get.js +++ b/src/dht/get.js @@ -4,10 +4,14 @@ const hat = require('hat') const { getDescribe, getIt, expect } = require('../utils/mocha') -module.exports = (createCommon, options) => { +/** @typedef { import("ipfsd-ctl").TestsInterface } TestsInterface */ +/** + * @param {TestsInterface} common + * @param {Object} options + */ +module.exports = (common, options) => { const describe = getDescribe(options) const it = getIt(options) - const common = createCommon() describe('.dht.get', function () { this.timeout(80 * 1000) diff --git a/src/dht/provide.js b/src/dht/provide.js index c4c6fafd6..63c6d73ef 100644 --- a/src/dht/provide.js +++ b/src/dht/provide.js @@ -4,10 +4,14 @@ const CID = require('cids') const { getDescribe, getIt, expect } = require('../utils/mocha') -module.exports = (createCommon, options) => { +/** @typedef { import("ipfsd-ctl").TestsInterface } TestsInterface */ +/** + * @param {TestsInterface} common + * @param {Object} options + */ +module.exports = (common, options) => { const describe = getDescribe(options) const it = getIt(options) - const common = createCommon() describe('.dht.provide', function () { this.timeout(80 * 1000) diff --git a/src/dht/put.js b/src/dht/put.js index 04a795c5a..a569e80d4 100644 --- a/src/dht/put.js +++ b/src/dht/put.js @@ -3,10 +3,14 @@ const { getDescribe, getIt } = require('../utils/mocha') -module.exports = (createCommon, options) => { +/** @typedef { import("ipfsd-ctl").TestsInterface } TestsInterface */ +/** + * @param {TestsInterface} common + * @param {Object} options + */ +module.exports = (common, options) => { const describe = getDescribe(options) const it = getIt(options) - const common = createCommon() describe('.dht.put', function () { this.timeout(80 * 1000) diff --git a/src/dht/query.js b/src/dht/query.js index 015147d48..7a0a82f34 100644 --- a/src/dht/query.js +++ b/src/dht/query.js @@ -4,10 +4,14 @@ const pTimeout = require('p-timeout') const { getDescribe, getIt, expect } = require('../utils/mocha') -module.exports = (createCommon, options) => { +/** @typedef { import("ipfsd-ctl").TestsInterface } TestsInterface */ +/** + * @param {TestsInterface} common + * @param {Object} options + */ +module.exports = (common, options) => { const describe = getDescribe(options) const it = getIt(options) - const common = createCommon() describe('.dht.query', function () { this.timeout(80 * 1000) diff --git a/src/files-mfs/cp.js b/src/files-mfs/cp.js index 400fe88ab..f53d55173 100644 --- a/src/files-mfs/cp.js +++ b/src/files-mfs/cp.js @@ -5,10 +5,14 @@ const hat = require('hat') const { fixtures } = require('../files-regular/utils') const { getDescribe, getIt, expect } = require('../utils/mocha') -module.exports = (createCommon, options) => { +/** @typedef { import("ipfsd-ctl").TestsInterface } TestsInterface */ +/** + * @param {TestsInterface} common + * @param {Object} options + */ +module.exports = (common, options) => { const describe = getDescribe(options) const it = getIt(options) - const common = createCommon() describe('.files.cp', function () { this.timeout(40 * 1000) diff --git a/src/files-mfs/flush.js b/src/files-mfs/flush.js index fb53808ce..6c284df60 100644 --- a/src/files-mfs/flush.js +++ b/src/files-mfs/flush.js @@ -4,10 +4,14 @@ const hat = require('hat') const { getDescribe, getIt, expect } = require('../utils/mocha') -module.exports = (createCommon, options) => { +/** @typedef { import("ipfsd-ctl").TestsInterface } TestsInterface */ +/** + * @param {TestsInterface} common + * @param {Object} options + */ +module.exports = (common, options) => { const describe = getDescribe(options) const it = getIt(options) - const common = createCommon() describe('.files.flush', function () { this.timeout(40 * 1000) diff --git a/src/files-mfs/ls-pull-stream.js b/src/files-mfs/ls-pull-stream.js index 72f6563f7..3506cd55f 100644 --- a/src/files-mfs/ls-pull-stream.js +++ b/src/files-mfs/ls-pull-stream.js @@ -5,10 +5,14 @@ const hat = require('hat') const { getDescribe, getIt, expect } = require('../utils/mocha') const pullToPromise = require('pull-to-promise') -module.exports = (createCommon, options) => { +/** @typedef { import("ipfsd-ctl").TestsInterface } TestsInterface */ +/** + * @param {TestsInterface} common + * @param {Object} options + */ +module.exports = (common, options) => { const describe = getDescribe(options) const it = getIt(options) - const common = createCommon() describe('.files.lsPullStream', function () { this.timeout(40 * 1000) diff --git a/src/files-mfs/ls-readable-stream.js b/src/files-mfs/ls-readable-stream.js index c32cfd709..262b341fa 100644 --- a/src/files-mfs/ls-readable-stream.js +++ b/src/files-mfs/ls-readable-stream.js @@ -5,10 +5,14 @@ const hat = require('hat') const { getDescribe, getIt, expect } = require('../utils/mocha') const getStream = require('get-stream') -module.exports = (createCommon, options) => { +/** @typedef { import("ipfsd-ctl").TestsInterface } TestsInterface */ +/** + * @param {TestsInterface} common + * @param {Object} options + */ +module.exports = (common, options) => { const describe = getDescribe(options) const it = getIt(options) - const common = createCommon() describe('.files.lsReadableStream', function () { this.timeout(40 * 1000) diff --git a/src/files-mfs/ls.js b/src/files-mfs/ls.js index 0cf36c661..0633d62d8 100644 --- a/src/files-mfs/ls.js +++ b/src/files-mfs/ls.js @@ -5,10 +5,14 @@ const hat = require('hat') const { fixtures } = require('../files-regular/utils') const { getDescribe, getIt, expect } = require('../utils/mocha') -module.exports = (createCommon, options) => { +/** @typedef { import("ipfsd-ctl").TestsInterface } TestsInterface */ +/** + * @param {TestsInterface} common + * @param {Object} options + */ +module.exports = (common, options) => { const describe = getDescribe(options) const it = getIt(options) - const common = createCommon() describe('.files.ls', function () { this.timeout(40 * 1000) diff --git a/src/files-mfs/mkdir.js b/src/files-mfs/mkdir.js index 4c2baf6b3..e7524ac2f 100644 --- a/src/files-mfs/mkdir.js +++ b/src/files-mfs/mkdir.js @@ -4,10 +4,14 @@ const hat = require('hat') const { getDescribe, getIt, expect } = require('../utils/mocha') -module.exports = (createCommon, options) => { +/** @typedef { import("ipfsd-ctl").TestsInterface } TestsInterface */ +/** + * @param {TestsInterface} common + * @param {Object} options + */ +module.exports = (common, options) => { const describe = getDescribe(options) const it = getIt(options) - const common = createCommon() describe('.files.mkdir', function () { this.timeout(40 * 1000) diff --git a/src/files-mfs/mv.js b/src/files-mfs/mv.js index fa54d598e..93ffd8e94 100644 --- a/src/files-mfs/mv.js +++ b/src/files-mfs/mv.js @@ -4,10 +4,14 @@ const hat = require('hat') const { getDescribe, getIt, expect } = require('../utils/mocha') -module.exports = (createCommon, options) => { +/** @typedef { import("ipfsd-ctl").TestsInterface } TestsInterface */ +/** + * @param {TestsInterface} common + * @param {Object} options + */ +module.exports = (common, options) => { const describe = getDescribe(options) const it = getIt(options) - const common = createCommon() describe('.files.mv', function () { this.timeout(40 * 1000) diff --git a/src/files-mfs/read-pull-stream.js b/src/files-mfs/read-pull-stream.js index 45b9af8dc..a34cf0c87 100644 --- a/src/files-mfs/read-pull-stream.js +++ b/src/files-mfs/read-pull-stream.js @@ -5,10 +5,14 @@ const hat = require('hat') const { getDescribe, getIt, expect } = require('../utils/mocha') const pullToPromise = require('pull-to-promise') -module.exports = (createCommon, options) => { +/** @typedef { import("ipfsd-ctl").TestsInterface } TestsInterface */ +/** + * @param {TestsInterface} common + * @param {Object} options + */ +module.exports = (common, options) => { const describe = getDescribe(options) const it = getIt(options) - const common = createCommon() describe('.files.readPullStream', function () { this.timeout(40 * 1000) diff --git a/src/files-mfs/read-readable-stream.js b/src/files-mfs/read-readable-stream.js index d8344ee17..acd14c2a4 100644 --- a/src/files-mfs/read-readable-stream.js +++ b/src/files-mfs/read-readable-stream.js @@ -5,10 +5,14 @@ const hat = require('hat') const { getDescribe, getIt, expect } = require('../utils/mocha') const getStream = require('get-stream') -module.exports = (createCommon, options) => { +/** @typedef { import("ipfsd-ctl").TestsInterface } TestsInterface */ +/** + * @param {TestsInterface} common + * @param {Object} options + */ +module.exports = (common, options) => { const describe = getDescribe(options) const it = getIt(options) - const common = createCommon() describe('.files.readReadableStream', function () { this.timeout(40 * 1000) diff --git a/src/files-mfs/read.js b/src/files-mfs/read.js index 91c6e533b..0d316f4be 100644 --- a/src/files-mfs/read.js +++ b/src/files-mfs/read.js @@ -5,10 +5,14 @@ const hat = require('hat') const { fixtures } = require('../files-regular/utils') const { getDescribe, getIt, expect } = require('../utils/mocha') -module.exports = (createCommon, options) => { +/** @typedef { import("ipfsd-ctl").TestsInterface } TestsInterface */ +/** + * @param {TestsInterface} common + * @param {Object} options + */ +module.exports = (common, options) => { const describe = getDescribe(options) const it = getIt(options) - const common = createCommon() describe('.files.read', function () { this.timeout(40 * 1000) diff --git a/src/files-mfs/rm.js b/src/files-mfs/rm.js index 9d13ca06b..84dfbdefc 100644 --- a/src/files-mfs/rm.js +++ b/src/files-mfs/rm.js @@ -4,10 +4,14 @@ const hat = require('hat') const { getDescribe, getIt, expect } = require('../utils/mocha') -module.exports = (createCommon, options) => { +/** @typedef { import("ipfsd-ctl").TestsInterface } TestsInterface */ +/** + * @param {TestsInterface} common + * @param {Object} options + */ +module.exports = (common, options) => { const describe = getDescribe(options) const it = getIt(options) - const common = createCommon() describe('.files.rm', function () { this.timeout(40 * 1000) diff --git a/src/files-mfs/stat.js b/src/files-mfs/stat.js index b0619ea16..6afb87e3d 100644 --- a/src/files-mfs/stat.js +++ b/src/files-mfs/stat.js @@ -5,10 +5,14 @@ const hat = require('hat') const { fixtures } = require('../files-regular/utils') const { getDescribe, getIt, expect } = require('../utils/mocha') -module.exports = (createCommon, options) => { +/** @typedef { import("ipfsd-ctl").TestsInterface } TestsInterface */ +/** + * @param {TestsInterface} common + * @param {Object} options + */ +module.exports = (common, options) => { const describe = getDescribe(options) const it = getIt(options) - const common = createCommon() describe('.files.stat', function () { this.timeout(40 * 1000) diff --git a/src/files-mfs/write.js b/src/files-mfs/write.js index f81a1a36b..d7e2c74ed 100644 --- a/src/files-mfs/write.js +++ b/src/files-mfs/write.js @@ -4,10 +4,14 @@ const hat = require('hat') const { getDescribe, getIt, expect } = require('../utils/mocha') -module.exports = (createCommon, options) => { +/** @typedef { import("ipfsd-ctl").TestsInterface } TestsInterface */ +/** + * @param {TestsInterface} common + * @param {Object} options + */ +module.exports = (common, options) => { const describe = getDescribe(options) const it = getIt(options) - const common = createCommon() describe('.files.write', function () { this.timeout(40 * 1000) diff --git a/src/files-regular/add-from-fs.js b/src/files-regular/add-from-fs.js index dc5f892df..bd058986d 100644 --- a/src/files-regular/add-from-fs.js +++ b/src/files-regular/add-from-fs.js @@ -7,10 +7,14 @@ const { getDescribe, getIt, expect } = require('../utils/mocha') const fs = require('fs') const os = require('os') -module.exports = (createCommon, options) => { +/** @typedef { import("ipfsd-ctl").TestsInterface } TestsInterface */ +/** + * @param {TestsInterface} common + * @param {Object} options + */ +module.exports = (common, options) => { const describe = getDescribe(options) const it = getIt(options) - const common = createCommon() describe('.addFromFs', function () { this.timeout(40 * 1000) diff --git a/src/files-regular/add-from-stream.js b/src/files-regular/add-from-stream.js index 9df66ee37..0dbedcc55 100644 --- a/src/files-regular/add-from-stream.js +++ b/src/files-regular/add-from-stream.js @@ -5,10 +5,14 @@ const { Readable } = require('readable-stream') const { getDescribe, getIt, expect } = require('../utils/mocha') const { fixtures } = require('./utils') -module.exports = (createCommon, options) => { +/** @typedef { import("ipfsd-ctl").TestsInterface } TestsInterface */ +/** + * @param {TestsInterface} common + * @param {Object} options + */ +module.exports = (common, options) => { const describe = getDescribe(options) const it = getIt(options) - const common = createCommon() describe('.addFromStream', function () { this.timeout(40 * 1000) diff --git a/src/files-regular/add-from-url.js b/src/files-regular/add-from-url.js index d1e68baaa..e6b093712 100644 --- a/src/files-regular/add-from-url.js +++ b/src/files-regular/add-from-url.js @@ -5,10 +5,14 @@ const pTimeout = require('p-timeout') const { getDescribe, getIt, expect } = require('../utils/mocha') const { echoUrl, redirectUrl } = require('../utils/echo-http-server') -module.exports = (createCommon, options) => { +/** @typedef { import("ipfsd-ctl").TestsInterface } TestsInterface */ +/** + * @param {TestsInterface} common + * @param {Object} options + */ +module.exports = (common, options) => { const describe = getDescribe(options) const it = getIt(options) - const common = createCommon() describe('.addFromURL', function () { this.timeout(40 * 1000) diff --git a/src/files-regular/add-pull-stream.js b/src/files-regular/add-pull-stream.js index 9606e2491..9b5c79d05 100644 --- a/src/files-regular/add-pull-stream.js +++ b/src/files-regular/add-pull-stream.js @@ -6,10 +6,14 @@ const pull = require('pull-stream') const { getDescribe, getIt, expect } = require('../utils/mocha') const pullToPromise = require('pull-to-promise') -module.exports = (createCommon, options) => { +/** @typedef { import("ipfsd-ctl").TestsInterface } TestsInterface */ +/** + * @param {TestsInterface} common + * @param {Object} options + */ +module.exports = (common, options) => { const describe = getDescribe(options) const it = getIt(options) - const common = createCommon() describe('.addPullStream', function () { this.timeout(40 * 1000) diff --git a/src/files-regular/add-readable-stream.js b/src/files-regular/add-readable-stream.js index 6b5d33eae..43eb2b5f7 100644 --- a/src/files-regular/add-readable-stream.js +++ b/src/files-regular/add-readable-stream.js @@ -5,10 +5,14 @@ const { fixtures } = require('./utils') const { getDescribe, getIt, expect } = require('../utils/mocha') const getStream = require('get-stream') -module.exports = (createCommon, options) => { +/** @typedef { import("ipfsd-ctl").TestsInterface } TestsInterface */ +/** + * @param {TestsInterface} common + * @param {Object} options + */ +module.exports = (common, options) => { const describe = getDescribe(options) const it = getIt(options) - const common = createCommon() describe('.addReadableStream', function () { this.timeout(40 * 1000) diff --git a/src/files-regular/add.js b/src/files-regular/add.js index 9faa37752..71a22c60d 100644 --- a/src/files-regular/add.js +++ b/src/files-regular/add.js @@ -8,10 +8,14 @@ const expectTimeout = require('../utils/expect-timeout') const { getDescribe, getIt, expect } = require('../utils/mocha') const { supportsFileReader } = require('ipfs-utils/src/supports') -module.exports = (createCommon, options) => { +/** @typedef { import("ipfsd-ctl").TestsInterface } TestsInterface */ +/** + * @param {TestsInterface} common + * @param {Object} options + */ +module.exports = (common, options) => { const describe = getDescribe(options) const it = getIt(options) - const common = createCommon() describe('.add', function () { this.timeout(40 * 1000) diff --git a/src/files-regular/cat-pull-stream.js b/src/files-regular/cat-pull-stream.js index 18842d13e..c8b72823a 100644 --- a/src/files-regular/cat-pull-stream.js +++ b/src/files-regular/cat-pull-stream.js @@ -5,10 +5,14 @@ const { fixtures } = require('./utils') const { getDescribe, getIt, expect } = require('../utils/mocha') const pullToPromise = require('pull-to-promise') -module.exports = (createCommon, options) => { +/** @typedef { import("ipfsd-ctl").TestsInterface } TestsInterface */ +/** + * @param {TestsInterface} common + * @param {Object} options + */ +module.exports = (common, options) => { const describe = getDescribe(options) const it = getIt(options) - const common = createCommon() describe('.catPullStream', function () { this.timeout(40 * 1000) diff --git a/src/files-regular/cat-readable-stream.js b/src/files-regular/cat-readable-stream.js index 17778b664..2eced04c8 100644 --- a/src/files-regular/cat-readable-stream.js +++ b/src/files-regular/cat-readable-stream.js @@ -5,10 +5,14 @@ const { fixtures } = require('./utils') const { getDescribe, getIt, expect } = require('../utils/mocha') const getStream = require('get-stream') -module.exports = (createCommon, options) => { +/** @typedef { import("ipfsd-ctl").TestsInterface } TestsInterface */ +/** + * @param {TestsInterface} common + * @param {Object} options + */ +module.exports = (common, options) => { const describe = getDescribe(options) const it = getIt(options) - const common = createCommon() describe('.catReadableStream', function () { this.timeout(40 * 1000) diff --git a/src/files-regular/cat.js b/src/files-regular/cat.js index 41523adf2..ddf9afa20 100644 --- a/src/files-regular/cat.js +++ b/src/files-regular/cat.js @@ -6,10 +6,14 @@ const bs58 = require('bs58') const CID = require('cids') const { getDescribe, getIt, expect } = require('../utils/mocha') -module.exports = (createCommon, options) => { +/** @typedef { import("ipfsd-ctl").TestsInterface } TestsInterface */ +/** + * @param {TestsInterface} common + * @param {Object} options + */ +module.exports = (common, options) => { const describe = getDescribe(options) const it = getIt(options) - const common = createCommon() describe('.cat', function () { this.timeout(40 * 1000) diff --git a/src/files-regular/get-pull-stream.js b/src/files-regular/get-pull-stream.js index ee50075e7..9ef7a710e 100644 --- a/src/files-regular/get-pull-stream.js +++ b/src/files-regular/get-pull-stream.js @@ -5,10 +5,14 @@ const { fixtures } = require('./utils') const { getDescribe, getIt, expect } = require('../utils/mocha') const pullToPromise = require('pull-to-promise') -module.exports = (createCommon, options) => { +/** @typedef { import("ipfsd-ctl").TestsInterface } TestsInterface */ +/** + * @param {TestsInterface} common + * @param {Object} options + */ +module.exports = (common, options) => { const describe = getDescribe(options) const it = getIt(options) - const common = createCommon() describe('.getPullStream', function () { this.timeout(40 * 1000) diff --git a/src/files-regular/get-readable-stream.js b/src/files-regular/get-readable-stream.js index ed1837bb6..d0ae755bf 100644 --- a/src/files-regular/get-readable-stream.js +++ b/src/files-regular/get-readable-stream.js @@ -6,10 +6,14 @@ const through = require('through2') const { getDescribe, getIt, expect } = require('../utils/mocha') const getStream = require('get-stream') -module.exports = (createCommon, options) => { +/** @typedef { import("ipfsd-ctl").TestsInterface } TestsInterface */ +/** + * @param {TestsInterface} common + * @param {Object} options + */ +module.exports = (common, options) => { const describe = getDescribe(options) const it = getIt(options) - const common = createCommon() describe('.getReadableStream', function () { this.timeout(40 * 1000) diff --git a/src/files-regular/get.js b/src/files-regular/get.js index 8a940f2ba..2491eed7e 100644 --- a/src/files-regular/get.js +++ b/src/files-regular/get.js @@ -6,10 +6,14 @@ const bs58 = require('bs58') const CID = require('cids') const { getDescribe, getIt, expect } = require('../utils/mocha') -module.exports = (createCommon, options) => { +/** @typedef { import("ipfsd-ctl").TestsInterface } TestsInterface */ +/** + * @param {TestsInterface} common + * @param {Object} options + */ +module.exports = (common, options) => { const describe = getDescribe(options) const it = getIt(options) - const common = createCommon() describe('.get', function () { this.timeout(40 * 1000) diff --git a/src/files-regular/ls-pull-stream.js b/src/files-regular/ls-pull-stream.js index 8b9ff1739..8d9491a28 100644 --- a/src/files-regular/ls-pull-stream.js +++ b/src/files-regular/ls-pull-stream.js @@ -5,10 +5,14 @@ const { fixtures } = require('./utils') const { getDescribe, getIt, expect } = require('../utils/mocha') const pullToPromise = require('pull-to-promise') -module.exports = (createCommon, options) => { +/** @typedef { import("ipfsd-ctl").TestsInterface } TestsInterface */ +/** + * @param {TestsInterface} common + * @param {Object} options + */ +module.exports = (common, options) => { const describe = getDescribe(options) const it = getIt(options) - const common = createCommon() describe('.lsPullStream', function () { this.timeout(40 * 1000) diff --git a/src/files-regular/ls-readable-stream.js b/src/files-regular/ls-readable-stream.js index ccf27dc65..d3b6f96d4 100644 --- a/src/files-regular/ls-readable-stream.js +++ b/src/files-regular/ls-readable-stream.js @@ -5,10 +5,14 @@ const { fixtures } = require('./utils') const { getDescribe, getIt, expect } = require('../utils/mocha') const getStream = require('get-stream') -module.exports = (createCommon, options) => { +/** @typedef { import("ipfsd-ctl").TestsInterface } TestsInterface */ +/** + * @param {TestsInterface} common + * @param {Object} options + */ +module.exports = (common, options) => { const describe = getDescribe(options) const it = getIt(options) - const common = createCommon() describe('.lsReadableStream', function () { this.timeout(40 * 1000) diff --git a/src/files-regular/ls.js b/src/files-regular/ls.js index 6e32e6bc0..af3721c63 100644 --- a/src/files-regular/ls.js +++ b/src/files-regular/ls.js @@ -7,10 +7,14 @@ const CID = require('cids') const randomName = prefix => `${prefix}${Math.round(Math.random() * 1000)}` -module.exports = (createCommon, options) => { +/** @typedef { import("ipfsd-ctl").TestsInterface } TestsInterface */ +/** + * @param {TestsInterface} common + * @param {Object} options + */ +module.exports = (common, options) => { const describe = getDescribe(options) const it = getIt(options) - const common = createCommon() describe('.ls', function () { this.timeout(40 * 1000) diff --git a/src/files-regular/refs-local-tests.js b/src/files-regular/refs-local-tests.js index 6d5cda042..1d3a29620 100644 --- a/src/files-regular/refs-local-tests.js +++ b/src/files-regular/refs-local-tests.js @@ -4,10 +4,16 @@ const { fixtures } = require('./utils') const { getDescribe, getIt, expect } = require('../utils/mocha') -module.exports = (createCommon, suiteName, ipfsRefsLocal, options) => { +/** @typedef { import("ipfsd-ctl").TestsInterface } TestsInterface */ +/** + * @param {TestsInterface} common + * @param {*} suiteName + * @param {*} ipfsRefsLocal + * @param {Object} options + */ +module.exports = (common, suiteName, ipfsRefsLocal, options) => { const describe = getDescribe(options) const it = getIt(options) - const common = createCommon() describe(suiteName, function () { this.timeout(40 * 1000) diff --git a/src/files-regular/refs-tests.js b/src/files-regular/refs-tests.js index 3725800d8..caa675470 100644 --- a/src/files-regular/refs-tests.js +++ b/src/files-regular/refs-tests.js @@ -7,10 +7,16 @@ const { getDescribe, getIt, expect } = require('../utils/mocha') const loadFixture = require('aegir/fixtures') const CID = require('cids') -module.exports = (createCommon, suiteName, ipfsRefs, options) => { +/** @typedef { import("ipfsd-ctl").TestsInterface } TestsInterface */ +/** + * @param {TestsInterface} common + * @param {*} suiteName + * @param {*} ipfsRefs + * @param {Object} options + */ +module.exports = (common, suiteName, ipfsRefs, options) => { const describe = getDescribe(options) const it = getIt(options) - const common = createCommon() describe(suiteName, function () { this.timeout(40 * 1000) diff --git a/src/key/export.js b/src/key/export.js index 70d1588fa..f122ebf93 100644 --- a/src/key/export.js +++ b/src/key/export.js @@ -4,10 +4,14 @@ const hat = require('hat') const { getDescribe, getIt, expect } = require('../utils/mocha') -module.exports = (createCommon, options) => { +/** @typedef { import("ipfsd-ctl").TestsInterface } TestsInterface */ +/** + * @param {TestsInterface} common + * @param {Object} options + */ +module.exports = (common, options) => { const describe = getDescribe(options) const it = getIt(options) - const common = createCommon() describe('.key.export', () => { let ipfs diff --git a/src/key/gen.js b/src/key/gen.js index 726cfdb03..dc85c6399 100644 --- a/src/key/gen.js +++ b/src/key/gen.js @@ -4,10 +4,14 @@ const hat = require('hat') const { getDescribe, getIt, expect } = require('../utils/mocha') -module.exports = (createCommon, options) => { +/** @typedef { import("ipfsd-ctl").TestsInterface } TestsInterface */ +/** + * @param {TestsInterface} common + * @param {Object} options + */ +module.exports = (common, options) => { const describe = getDescribe(options) const it = getIt(options) - const common = createCommon() describe('.key.gen', () => { const keyTypes = [ diff --git a/src/key/import.js b/src/key/import.js index 4ed73ba36..8272014cf 100644 --- a/src/key/import.js +++ b/src/key/import.js @@ -4,10 +4,14 @@ const hat = require('hat') const { getDescribe, getIt, expect } = require('../utils/mocha') -module.exports = (createCommon, options) => { +/** @typedef { import("ipfsd-ctl").TestsInterface } TestsInterface */ +/** + * @param {TestsInterface} common + * @param {Object} options + */ +module.exports = (common, options) => { const describe = getDescribe(options) const it = getIt(options) - const common = createCommon() describe('.key.import', () => { let ipfs diff --git a/src/key/list.js b/src/key/list.js index b8b1af780..762fc5e07 100644 --- a/src/key/list.js +++ b/src/key/list.js @@ -5,10 +5,14 @@ const pTimes = require('p-times') const hat = require('hat') const { getDescribe, getIt, expect } = require('../utils/mocha') -module.exports = (createCommon, options) => { +/** @typedef { import("ipfsd-ctl").TestsInterface } TestsInterface */ +/** + * @param {TestsInterface} common + * @param {Object} options + */ +module.exports = (common, options) => { const describe = getDescribe(options) const it = getIt(options) - const common = createCommon() describe('.key.list', () => { let ipfs diff --git a/src/key/rename.js b/src/key/rename.js index a3f5333cc..6d57a371b 100644 --- a/src/key/rename.js +++ b/src/key/rename.js @@ -4,10 +4,14 @@ const hat = require('hat') const { getDescribe, getIt, expect } = require('../utils/mocha') -module.exports = (createCommon, options) => { +/** @typedef { import("ipfsd-ctl").TestsInterface } TestsInterface */ +/** + * @param {TestsInterface} common + * @param {Object} options + */ +module.exports = (common, options) => { const describe = getDescribe(options) const it = getIt(options) - const common = createCommon() describe('.key.rename', () => { let ipfs diff --git a/src/key/rm.js b/src/key/rm.js index 3607b93a4..59f46ca38 100644 --- a/src/key/rm.js +++ b/src/key/rm.js @@ -4,10 +4,14 @@ const hat = require('hat') const { getDescribe, getIt, expect } = require('../utils/mocha') -module.exports = (createCommon, options) => { +/** @typedef { import("ipfsd-ctl").TestsInterface } TestsInterface */ +/** + * @param {TestsInterface} common + * @param {Object} options + */ +module.exports = (common, options) => { const describe = getDescribe(options) const it = getIt(options) - const common = createCommon() describe('.key.rm', () => { let ipfs diff --git a/src/miscellaneous/dns.js b/src/miscellaneous/dns.js index 9a68ea808..fade59bc9 100644 --- a/src/miscellaneous/dns.js +++ b/src/miscellaneous/dns.js @@ -3,10 +3,14 @@ const { getDescribe, getIt, expect } = require('../utils/mocha') -module.exports = (createCommon, options) => { +/** @typedef { import("ipfsd-ctl").TestsInterface } TestsInterface */ +/** + * @param {TestsInterface} common + * @param {Object} options + */ +module.exports = (common, options) => { const describe = getDescribe(options) const it = getIt(options) - const common = createCommon() describe('.dns', function () { this.timeout(10 * 1000) diff --git a/src/miscellaneous/id.js b/src/miscellaneous/id.js index 2ba82464d..cdf2f0ef3 100644 --- a/src/miscellaneous/id.js +++ b/src/miscellaneous/id.js @@ -3,10 +3,14 @@ const { getDescribe, getIt, expect } = require('../utils/mocha') -module.exports = (createCommon, options) => { +/** @typedef { import("ipfsd-ctl").TestsInterface } TestsInterface */ +/** + * @param {TestsInterface} common + * @param {Object} options + */ +module.exports = (common, options) => { const describe = getDescribe(options) const it = getIt(options) - const common = createCommon() describe('.id', function () { this.timeout(60 * 1000) diff --git a/src/miscellaneous/resolve.js b/src/miscellaneous/resolve.js index 6eb65819d..60bf12240 100644 --- a/src/miscellaneous/resolve.js +++ b/src/miscellaneous/resolve.js @@ -7,10 +7,14 @@ const hat = require('hat') const multibase = require('multibase') const { getDescribe, getIt, expect } = require('../utils/mocha') -module.exports = (createCommon, options) => { +/** @typedef { import("ipfsd-ctl").TestsInterface } TestsInterface */ +/** + * @param {TestsInterface} common + * @param {Object} options + */ +module.exports = (common, options) => { const describe = getDescribe(options) const it = getIt(options) - const common = createCommon() describe('.resolve', function () { this.timeout(60 * 1000) diff --git a/src/miscellaneous/stop.js b/src/miscellaneous/stop.js index 58ee8bea6..4e9e2f9b5 100644 --- a/src/miscellaneous/stop.js +++ b/src/miscellaneous/stop.js @@ -3,15 +3,20 @@ const { getDescribe, getIt, expect } = require('../utils/mocha') -module.exports = (createCommon, options) => { +/** @typedef { import("ipfsd-ctl").TestsInterface } TestsInterface */ +/** + * @param {TestsInterface} common + * @param {Object} options + */ +module.exports = (common, options) => { const describe = getDescribe(options) const it = getIt(options) - const common = createCommon() - describe('.stop', () => { - it('should stop the node', async function () { - this.timeout(10 * 1000) - const ipfs = await common.setup() + describe('.stop', function () { + this.timeout(60 * 1000) + + it('should stop the node', async () => { + const ipfs = await common.node() await ipfs.stop() diff --git a/src/miscellaneous/version.js b/src/miscellaneous/version.js index c38af691b..6235470f7 100644 --- a/src/miscellaneous/version.js +++ b/src/miscellaneous/version.js @@ -3,10 +3,14 @@ const { getDescribe, getIt, expect } = require('../utils/mocha') -module.exports = (createCommon, options) => { +/** @typedef { import("ipfsd-ctl").TestsInterface } TestsInterface */ +/** + * @param {TestsInterface} common + * @param {Object} options + */ +module.exports = (common, options) => { const describe = getDescribe(options) const it = getIt(options) - const common = createCommon() describe('.version', () => { let ipfs diff --git a/src/name-pubsub/cancel.js b/src/name-pubsub/cancel.js index 2a887ca17..934aaa279 100644 --- a/src/name-pubsub/cancel.js +++ b/src/name-pubsub/cancel.js @@ -6,10 +6,14 @@ const { promisify } = require('es6-promisify') const { getDescribe, getIt, expect } = require('../utils/mocha') -module.exports = (createCommon, options) => { +/** @typedef { import("ipfsd-ctl").TestsInterface } TestsInterface */ +/** + * @param {TestsInterface} common + * @param {Object} options + */ +module.exports = (common, options) => { const describe = getDescribe(options) const it = getIt(options) - const common = createCommon() describe('.name.pubsub.cancel', () => { let ipfs diff --git a/src/name-pubsub/state.js b/src/name-pubsub/state.js index 13ec1e08e..70c5197ee 100644 --- a/src/name-pubsub/state.js +++ b/src/name-pubsub/state.js @@ -3,10 +3,14 @@ const { getDescribe, getIt, expect } = require('../utils/mocha') -module.exports = (createCommon, options) => { +/** @typedef { import("ipfsd-ctl").TestsInterface } TestsInterface */ +/** + * @param {TestsInterface} common + * @param {Object} options + */ +module.exports = (common, options) => { const describe = getDescribe(options) const it = getIt(options) - const common = createCommon() describe('.name.pubsub.state', () => { let ipfs diff --git a/src/name-pubsub/subs.js b/src/name-pubsub/subs.js index 1d3e2dd07..1128c4672 100644 --- a/src/name-pubsub/subs.js +++ b/src/name-pubsub/subs.js @@ -3,10 +3,14 @@ const { getDescribe, getIt, expect } = require('../utils/mocha') -module.exports = (createCommon, options) => { +/** @typedef { import("ipfsd-ctl").TestsInterface } TestsInterface */ +/** + * @param {TestsInterface} common + * @param {Object} options + */ +module.exports = (common, options) => { const describe = getDescribe(options) const it = getIt(options) - const common = createCommon() describe('.name.pubsub.subs', () => { let ipfs diff --git a/src/name/publish.js b/src/name/publish.js index 7c4733db1..055087ec5 100644 --- a/src/name/publish.js +++ b/src/name/publish.js @@ -6,10 +6,14 @@ const hat = require('hat') const { fixture } = require('./utils') const { getDescribe, getIt, expect } = require('../utils/mocha') -module.exports = (createCommon, options) => { +/** @typedef { import("ipfsd-ctl").TestsInterface } TestsInterface */ +/** + * @param {TestsInterface} common + * @param {Object} options + */ +module.exports = (common, options) => { const describe = getDescribe(options) const it = getIt(options) - const common = createCommon() describe('.name.publish offline', () => { const keyName = hat() diff --git a/src/name/resolve.js b/src/name/resolve.js index 94ff8249f..e78c282a9 100644 --- a/src/name/resolve.js +++ b/src/name/resolve.js @@ -5,12 +5,16 @@ const { getDescribe, getIt, expect } = require('../utils/mocha') const delay = require('delay') const CID = require('cids') -module.exports = (createCommon, options) => { +/** @typedef { import("ipfsd-ctl").TestsInterface } TestsInterface */ +/** + * @param {TestsInterface} common + * @param {Object} options + */ +module.exports = (common, options) => { const describe = getDescribe(options) const it = getIt(options) - describe('.name.resolve offline', () => { - const common = createCommon() + describe('.name.resolve offline', function () { let ipfs let nodeId @@ -127,7 +131,6 @@ module.exports = (createCommon, options) => { }) describe('.name.resolve dns', function () { - const common = createCommon() let ipfs this.retries(5) diff --git a/src/object/data.js b/src/object/data.js index e2eeb5159..ddefef3ba 100644 --- a/src/object/data.js +++ b/src/object/data.js @@ -5,10 +5,14 @@ const bs58 = require('bs58') const hat = require('hat') const { getDescribe, getIt, expect } = require('../utils/mocha') -module.exports = (createCommon, options) => { +/** @typedef { import("ipfsd-ctl").TestsInterface } TestsInterface */ +/** + * @param {TestsInterface} common + * @param {Object} options + */ +module.exports = (common, options) => { const describe = getDescribe(options) const it = getIt(options) - const common = createCommon() describe('.object.data', function () { this.timeout(80 * 1000) diff --git a/src/object/get.js b/src/object/get.js index c4f662dfa..4c355b2fa 100644 --- a/src/object/get.js +++ b/src/object/get.js @@ -9,10 +9,14 @@ const UnixFs = require('ipfs-unixfs') const crypto = require('crypto') const { asDAGLink } = require('./utils') -module.exports = (createCommon, options) => { +/** @typedef { import("ipfsd-ctl").TestsInterface } TestsInterface */ +/** + * @param {TestsInterface} common + * @param {Object} options + */ +module.exports = (common, options) => { const describe = getDescribe(options) const it = getIt(options) - const common = createCommon() describe('.object.get', function () { this.timeout(80 * 1000) diff --git a/src/object/links.js b/src/object/links.js index 0770ef219..ca5fb57bc 100644 --- a/src/object/links.js +++ b/src/object/links.js @@ -8,10 +8,14 @@ const { getDescribe, getIt, expect } = require('../utils/mocha') const { asDAGLink } = require('./utils') const CID = require('cids') -module.exports = (createCommon, options) => { +/** @typedef { import("ipfsd-ctl").TestsInterface } TestsInterface */ +/** + * @param {TestsInterface} common + * @param {Object} options + */ +module.exports = (common, options) => { const describe = getDescribe(options) const it = getIt(options) - const common = createCommon() describe('.object.links', function () { this.timeout(80 * 1000) diff --git a/src/object/new.js b/src/object/new.js index 6f20522d0..a05867b77 100644 --- a/src/object/new.js +++ b/src/object/new.js @@ -3,10 +3,14 @@ const { getDescribe, getIt, expect } = require('../utils/mocha') -module.exports = (createCommon, options) => { +/** @typedef { import("ipfsd-ctl").TestsInterface } TestsInterface */ +/** + * @param {TestsInterface} common + * @param {Object} options + */ +module.exports = (common, options) => { const describe = getDescribe(options) const it = getIt(options) - const common = createCommon() describe('.object.new', function () { this.timeout(80 * 1000) diff --git a/src/object/patch/add-link.js b/src/object/patch/add-link.js index 1e97a70ba..0a7f7b164 100644 --- a/src/object/patch/add-link.js +++ b/src/object/patch/add-link.js @@ -6,10 +6,14 @@ const DAGNode = dagPB.DAGNode const { getDescribe, getIt, expect } = require('../../utils/mocha') const { asDAGLink } = require('../utils') -module.exports = (createCommon, options) => { +/** @typedef { import("ipfsd-ctl").TestsInterface } TestsInterface */ +/** + * @param {TestsInterface} common + * @param {Object} options + */ +module.exports = (common, options) => { const describe = getDescribe(options) const it = getIt(options) - const common = createCommon() describe('.object.patch.addLink', function () { this.timeout(80 * 1000) diff --git a/src/object/patch/append-data.js b/src/object/patch/append-data.js index 0364c12ed..f8df8eab9 100644 --- a/src/object/patch/append-data.js +++ b/src/object/patch/append-data.js @@ -3,10 +3,14 @@ const { getDescribe, getIt, expect } = require('../../utils/mocha') -module.exports = (createCommon, options) => { +/** @typedef { import("ipfsd-ctl").TestsInterface } TestsInterface */ +/** + * @param {TestsInterface} common + * @param {Object} options + */ +module.exports = (common, options) => { const describe = getDescribe(options) const it = getIt(options) - const common = createCommon() describe('.object.patch.appendData', function () { this.timeout(80 * 1000) diff --git a/src/object/patch/rm-link.js b/src/object/patch/rm-link.js index f12ffefa7..21c29a385 100644 --- a/src/object/patch/rm-link.js +++ b/src/object/patch/rm-link.js @@ -4,10 +4,14 @@ const { getDescribe, getIt, expect } = require('../../utils/mocha') const { asDAGLink } = require('../utils') -module.exports = (createCommon, options) => { +/** @typedef { import("ipfsd-ctl").TestsInterface } TestsInterface */ +/** + * @param {TestsInterface} common + * @param {Object} options + */ +module.exports = (common, options) => { const describe = getDescribe(options) const it = getIt(options) - const common = createCommon() describe('.object.patch.rmLink', function () { this.timeout(80 * 1000) diff --git a/src/object/patch/set-data.js b/src/object/patch/set-data.js index 1163b9521..3d89f288d 100644 --- a/src/object/patch/set-data.js +++ b/src/object/patch/set-data.js @@ -3,10 +3,14 @@ const { getDescribe, getIt, expect } = require('../../utils/mocha') -module.exports = (createCommon, options) => { +/** @typedef { import("ipfsd-ctl").TestsInterface } TestsInterface */ +/** + * @param {TestsInterface} common + * @param {Object} options + */ +module.exports = (common, options) => { const describe = getDescribe(options) const it = getIt(options) - const common = createCommon() describe('.object.patch.setData', function () { this.timeout(80 * 1000) diff --git a/src/object/put.js b/src/object/put.js index c1383e7f4..337b9b307 100644 --- a/src/object/put.js +++ b/src/object/put.js @@ -7,10 +7,14 @@ const hat = require('hat') const { getDescribe, getIt, expect } = require('../utils/mocha') const { asDAGLink } = require('./utils') -module.exports = (createCommon, options) => { +/** @typedef { import("ipfsd-ctl").TestsInterface } TestsInterface */ +/** + * @param {TestsInterface} common + * @param {Object} options + */ +module.exports = (common, options) => { const describe = getDescribe(options) const it = getIt(options) - const common = createCommon() describe('.object.put', function () { this.timeout(80 * 1000) diff --git a/src/object/stat.js b/src/object/stat.js index 12c80b7d1..a8cf80f80 100644 --- a/src/object/stat.js +++ b/src/object/stat.js @@ -6,10 +6,14 @@ const DAGNode = dagPB.DAGNode const { getDescribe, getIt, expect } = require('../utils/mocha') const { asDAGLink } = require('./utils') -module.exports = (createCommon, options) => { +/** @typedef { import("ipfsd-ctl").TestsInterface } TestsInterface */ +/** + * @param {TestsInterface} common + * @param {Object} options + */ +module.exports = (common, options) => { const describe = getDescribe(options) const it = getIt(options) - const common = createCommon() describe('.object.stat', function () { this.timeout(80 * 1000) diff --git a/src/pin/add.js b/src/pin/add.js index d8789080c..4bf409f98 100644 --- a/src/pin/add.js +++ b/src/pin/add.js @@ -4,21 +4,20 @@ const { fixtures } = require('./utils') const { getDescribe, getIt, expect } = require('../utils/mocha') -module.exports = (createCommon, options) => { +/** @typedef { import("ipfsd-ctl").TestsInterface } TestsInterface */ +/** + * @param {TestsInterface} common + * @param {Object} options + */ +module.exports = (common, options) => { const describe = getDescribe(options) const it = getIt(options) - const common = createCommon() describe('.pin.add', function () { this.timeout(50 * 1000) let ipfs - - before(async function () { - // CI takes longer to instantiate the daemon, so we need to increase the - // timeout for the before step - this.timeout(60 * 1000) - + before(async () => { ipfs = await common.setup() await Promise.all(fixtures.files.map(file => { return ipfs.add(file.data, { pin: false }) diff --git a/src/pin/ls.js b/src/pin/ls.js index 47caed6c3..2ce29ed19 100644 --- a/src/pin/ls.js +++ b/src/pin/ls.js @@ -4,10 +4,14 @@ const { fixtures } = require('./utils') const { getDescribe, getIt, expect } = require('../utils/mocha') -module.exports = (createCommon, options) => { +/** @typedef { import("ipfsd-ctl").TestsInterface } TestsInterface */ +/** + * @param {TestsInterface} common + * @param {Object} options + */ +module.exports = (common, options) => { const describe = getDescribe(options) const it = getIt(options) - const common = createCommon() describe('.pin.ls', function () { this.timeout(50 * 1000) diff --git a/src/pin/rm.js b/src/pin/rm.js index 6be13effe..405f5f5a0 100644 --- a/src/pin/rm.js +++ b/src/pin/rm.js @@ -4,21 +4,20 @@ const { fixtures } = require('./utils') const { getDescribe, getIt, expect } = require('../utils/mocha') -module.exports = (createCommon, options) => { +/** @typedef { import("ipfsd-ctl").TestsInterface } TestsInterface */ +/** + * @param {TestsInterface} common + * @param {Object} options + */ +module.exports = (common, options) => { const describe = getDescribe(options) const it = getIt(options) - const common = createCommon() describe('.pin.rm', function () { this.timeout(50 * 1000) let ipfs - - before(async function () { - // CI takes longer to instantiate the daemon, so we need to increase the - // timeout for the before step - this.timeout(60 * 1000) - + before(async () => { ipfs = await common.setup() await ipfs.add(fixtures.files[0].data, { pin: false }) await ipfs.pin.add(fixtures.files[0].cid, { recursive: true }) diff --git a/src/ping/ping-pull-stream.js b/src/ping/ping-pull-stream.js index e9e65add2..0c3781282 100644 --- a/src/ping/ping-pull-stream.js +++ b/src/ping/ping-pull-stream.js @@ -5,10 +5,14 @@ const pullToPromise = require('pull-to-promise') const { getDescribe, getIt, expect } = require('../utils/mocha') const { isPong } = require('./utils.js') -module.exports = (createCommon, options) => { +/** @typedef { import("ipfsd-ctl").TestsInterface } TestsInterface */ +/** + * @param {TestsInterface} common + * @param {Object} options + */ +module.exports = (common, options) => { const describe = getDescribe(options) const it = getIt(options) - const common = createCommon() describe('.pingPullStream', function () { this.timeout(60 * 1000) diff --git a/src/ping/ping-readable-stream.js b/src/ping/ping-readable-stream.js index 3c69fc367..13c0ca35e 100644 --- a/src/ping/ping-readable-stream.js +++ b/src/ping/ping-readable-stream.js @@ -6,10 +6,14 @@ const { Writable } = require('stream') const { getDescribe, getIt, expect } = require('../utils/mocha') const { isPong } = require('./utils.js') -module.exports = (createCommon, options) => { +/** @typedef { import("ipfsd-ctl").TestsInterface } TestsInterface */ +/** + * @param {TestsInterface} common + * @param {Object} options + */ +module.exports = (common, options) => { const describe = getDescribe(options) const it = getIt(options) - const common = createCommon() describe('.pingReadableStream', function () { this.timeout(60 * 1000) diff --git a/src/ping/ping.js b/src/ping/ping.js index 030a77f16..a23ed2517 100644 --- a/src/ping/ping.js +++ b/src/ping/ping.js @@ -4,10 +4,14 @@ const { getDescribe, getIt, expect } = require('../utils/mocha') const { expectIsPingResponse, isPong } = require('./utils') -module.exports = (createCommon, options) => { +/** @typedef { import("ipfsd-ctl").TestsInterface } TestsInterface */ +/** + * @param {TestsInterface} common + * @param {Object} options + */ +module.exports = (common, options) => { const describe = getDescribe(options) const it = getIt(options) - const common = createCommon() describe('.ping', function () { this.timeout(60 * 1000) diff --git a/src/pubsub/ls.js b/src/pubsub/ls.js index daf2e3586..25f7ea982 100644 --- a/src/pubsub/ls.js +++ b/src/pubsub/ls.js @@ -5,22 +5,21 @@ const { getTopic } = require('./utils') const { getDescribe, getIt, expect } = require('../utils/mocha') const delay = require('delay') -module.exports = (createCommon, options) => { +/** @typedef { import("ipfsd-ctl").TestsInterface } TestsInterface */ +/** + * @param {TestsInterface} common + * @param {Object} options + */ +module.exports = (common, options) => { const describe = getDescribe(options) const it = getIt(options) - const common = createCommon() describe('.pubsub.ls', function () { this.timeout(80 * 1000) let ipfs let subscribedTopics = [] - - before(async function () { - // CI takes longer to instantiate the daemon, so we need to increase the - // timeout for the before step - this.timeout(60 * 1000) - + before(async () => { ipfs = await common.setup() }) diff --git a/src/pubsub/peers.js b/src/pubsub/peers.js index 88bef2d65..6392cf22e 100644 --- a/src/pubsub/peers.js +++ b/src/pubsub/peers.js @@ -5,10 +5,14 @@ const { waitForPeers, getTopic } = require('./utils') const { getDescribe, getIt, expect } = require('../utils/mocha') const delay = require('delay') -module.exports = (createCommon, options) => { +/** @typedef { import("ipfsd-ctl").TestsInterface } TestsInterface */ +/** + * @param {TestsInterface} common + * @param {Object} options + */ +module.exports = (common, options) => { const describe = getDescribe(options) const it = getIt(options) - const common = createCommon() describe('.pubsub.peers', function () { this.timeout(80 * 1000) @@ -17,12 +21,7 @@ module.exports = (createCommon, options) => { let ipfs2 let ipfs3 let subscribedTopics = [] - - before(async function () { - // CI takes longer to instantiate the daemon, so we need to increase the - // timeout for the before step - this.timeout(100 * 1000) - + before(async () => { ipfs1 = await common.setup() ipfs2 = await common.setup() ipfs3 = await common.setup() diff --git a/src/pubsub/publish.js b/src/pubsub/publish.js index 3b8e93fcd..c79db160e 100644 --- a/src/pubsub/publish.js +++ b/src/pubsub/publish.js @@ -5,10 +5,14 @@ const hat = require('hat') const { getTopic } = require('./utils') const { getDescribe, getIt } = require('../utils/mocha') -module.exports = (createCommon, options) => { +/** @typedef { import("ipfsd-ctl").TestsInterface } TestsInterface */ +/** + * @param {TestsInterface} common + * @param {Object} options + */ +module.exports = (common, options) => { const describe = getDescribe(options) const it = getIt(options) - const common = createCommon() describe('.pubsub.publish', function () { this.timeout(80 * 1000) diff --git a/src/pubsub/subscribe.js b/src/pubsub/subscribe.js index 103aa937e..fdaf302b3 100644 --- a/src/pubsub/subscribe.js +++ b/src/pubsub/subscribe.js @@ -7,10 +7,14 @@ const { waitForPeers, getTopic } = require('./utils') const { getDescribe, getIt, expect } = require('../utils/mocha') const delay = require('delay') -module.exports = (createCommon, options) => { +/** @typedef { import("ipfsd-ctl").TestsInterface } TestsInterface */ +/** + * @param {TestsInterface} common + * @param {Object} options + */ +module.exports = (common, options) => { const describe = getDescribe(options) const it = getIt(options) - const common = createCommon() describe('.pubsub.subscribe', function () { this.timeout(80 * 1000) @@ -29,6 +33,8 @@ module.exports = (createCommon, options) => { ipfs2 = await common.setup() }) + after(() => common.teardown()) + beforeEach(() => { topic = getTopic() subscribedTopics = [topic] diff --git a/src/pubsub/unsubscribe.js b/src/pubsub/unsubscribe.js index 2fe522df7..0cd4f8cbf 100644 --- a/src/pubsub/unsubscribe.js +++ b/src/pubsub/unsubscribe.js @@ -6,10 +6,14 @@ const { getTopic } = require('./utils') const { getDescribe, getIt, expect } = require('../utils/mocha') const delay = require('delay') -module.exports = (createCommon, options) => { +/** @typedef { import("ipfsd-ctl").TestsInterface } TestsInterface */ +/** + * @param {TestsInterface} common + * @param {Object} options + */ +module.exports = (common, options) => { const describe = getDescribe(options) const it = getIt(options) - const common = createCommon() describe('.pubsub.unsubscribe', function () { this.timeout(80 * 1000) diff --git a/src/repo/gc.js b/src/repo/gc.js index 2c29c2dea..676e1c770 100644 --- a/src/repo/gc.js +++ b/src/repo/gc.js @@ -4,10 +4,14 @@ const { getDescribe, getIt, expect } = require('../utils/mocha') const { DAGNode } = require('ipld-dag-pb') -module.exports = (createCommon, options) => { +/** @typedef { import("ipfsd-ctl").TestsInterface } TestsInterface */ +/** + * @param {TestsInterface} common + * @param {Object} options + */ +module.exports = (common, options) => { const describe = getDescribe(options) const it = getIt(options) - const common = createCommon() describe('.repo.gc', () => { let ipfs diff --git a/src/repo/stat.js b/src/repo/stat.js index aaa7ad4b7..bedbc8e60 100644 --- a/src/repo/stat.js +++ b/src/repo/stat.js @@ -4,10 +4,14 @@ const { expectIsRepo } = require('../stats/utils') const { getDescribe, getIt } = require('../utils/mocha') -module.exports = (createCommon, options) => { +/** @typedef { import("ipfsd-ctl").TestsInterface } TestsInterface */ +/** + * @param {TestsInterface} common + * @param {Object} options + */ +module.exports = (common, options) => { const describe = getDescribe(options) const it = getIt(options) - const common = createCommon() describe('.repo.stat', () => { let ipfs diff --git a/src/repo/version.js b/src/repo/version.js index d8384e383..e49d5608f 100644 --- a/src/repo/version.js +++ b/src/repo/version.js @@ -3,10 +3,14 @@ const { getDescribe, getIt, expect } = require('../utils/mocha') -module.exports = (createCommon, options) => { +/** @typedef { import("ipfsd-ctl").TestsInterface } TestsInterface */ +/** + * @param {TestsInterface} common + * @param {Object} options + */ +module.exports = (common, options) => { const describe = getDescribe(options) const it = getIt(options) - const common = createCommon() describe('.repo.version', () => { let ipfs diff --git a/src/stats/bitswap.js b/src/stats/bitswap.js index 61bca7e61..db03f1724 100644 --- a/src/stats/bitswap.js +++ b/src/stats/bitswap.js @@ -4,10 +4,14 @@ const { getDescribe, getIt } = require('../utils/mocha') const { expectIsBitswap } = require('./utils') -module.exports = (createCommon, options) => { +/** @typedef { import("ipfsd-ctl").TestsInterface } TestsInterface */ +/** + * @param {TestsInterface} common + * @param {Object} options + */ +module.exports = (common, options) => { const describe = getDescribe(options) const it = getIt(options) - const common = createCommon() describe('.stats.bitswap', () => { let ipfs diff --git a/src/stats/bw-pull-stream.js b/src/stats/bw-pull-stream.js index 97d96193c..be97601c2 100644 --- a/src/stats/bw-pull-stream.js +++ b/src/stats/bw-pull-stream.js @@ -5,10 +5,14 @@ const { expectIsBandwidth } = require('./utils') const pullToPromise = require('pull-to-promise') const { getDescribe, getIt } = require('../utils/mocha') -module.exports = (createCommon, options) => { +/** @typedef { import("ipfsd-ctl").TestsInterface } TestsInterface */ +/** + * @param {TestsInterface} common + * @param {Object} options + */ +module.exports = (common, options) => { const describe = getDescribe(options) const it = getIt(options) - const common = createCommon() describe('.stats.bwPullStream', () => { let ipfs diff --git a/src/stats/bw-readable-stream.js b/src/stats/bw-readable-stream.js index 50e0a8c0d..e9ae0db3c 100644 --- a/src/stats/bw-readable-stream.js +++ b/src/stats/bw-readable-stream.js @@ -5,10 +5,14 @@ const { expectIsBandwidth } = require('./utils') const { getDescribe, getIt } = require('../utils/mocha') const getStream = require('get-stream') -module.exports = (createCommon, options) => { +/** @typedef { import("ipfsd-ctl").TestsInterface } TestsInterface */ +/** + * @param {TestsInterface} common + * @param {Object} options + */ +module.exports = (common, options) => { const describe = getDescribe(options) const it = getIt(options) - const common = createCommon() describe('.stats.bwReadableStream', () => { let ipfs diff --git a/src/stats/bw.js b/src/stats/bw.js index 7994bca84..676a1acda 100644 --- a/src/stats/bw.js +++ b/src/stats/bw.js @@ -4,10 +4,14 @@ const { expectIsBandwidth } = require('./utils') const { getDescribe, getIt } = require('../utils/mocha') -module.exports = (createCommon, options) => { +/** @typedef { import("ipfsd-ctl").TestsInterface } TestsInterface */ +/** + * @param {TestsInterface} common + * @param {Object} options + */ +module.exports = (common, options) => { const describe = getDescribe(options) const it = getIt(options) - const common = createCommon() describe('.stats.bw', () => { let ipfs diff --git a/src/stats/repo.js b/src/stats/repo.js index e6fae8d37..c2f88f6bb 100644 --- a/src/stats/repo.js +++ b/src/stats/repo.js @@ -4,10 +4,14 @@ const { expectIsRepo } = require('./utils') const { getDescribe, getIt } = require('../utils/mocha') -module.exports = (createCommon, options) => { +/** @typedef { import("ipfsd-ctl").TestsInterface } TestsInterface */ +/** + * @param {TestsInterface} common + * @param {Object} options + */ +module.exports = (common, options) => { const describe = getDescribe(options) const it = getIt(options) - const common = createCommon() describe('.stats.repo', () => { let ipfs diff --git a/src/swarm/addrs.js b/src/swarm/addrs.js index 03196577a..f4d3730a6 100644 --- a/src/swarm/addrs.js +++ b/src/swarm/addrs.js @@ -4,10 +4,14 @@ const PeerInfo = require('peer-info') const { getDescribe, getIt, expect } = require('../utils/mocha') -module.exports = (createCommon, options) => { +/** @typedef { import("ipfsd-ctl").TestsInterface } TestsInterface */ +/** + * @param {TestsInterface} common + * @param {Object} options + */ +module.exports = (common, options) => { const describe = getDescribe(options) const it = getIt(options) - const common = createCommon() describe('.swarm.addrs', function () { this.timeout(80 * 1000) diff --git a/src/swarm/connect.js b/src/swarm/connect.js index 9de402652..4ac818fd7 100644 --- a/src/swarm/connect.js +++ b/src/swarm/connect.js @@ -3,10 +3,14 @@ const { getDescribe, getIt, expect } = require('../utils/mocha') -module.exports = (createCommon, options) => { +/** @typedef { import("ipfsd-ctl").TestsInterface } TestsInterface */ +/** + * @param {TestsInterface} common + * @param {Object} options + */ +module.exports = (common, options) => { const describe = getDescribe(options) const it = getIt(options) - const common = createCommon() describe('.swarm.connect', function () { this.timeout(80 * 1000) diff --git a/src/swarm/disconnect.js b/src/swarm/disconnect.js index 51551001e..a71da9b76 100644 --- a/src/swarm/disconnect.js +++ b/src/swarm/disconnect.js @@ -3,10 +3,14 @@ const { getDescribe, getIt, expect } = require('../utils/mocha') -module.exports = (createCommon, options) => { +/** @typedef { import("ipfsd-ctl").TestsInterface } TestsInterface */ +/** + * @param {TestsInterface} common + * @param {Object} options + */ +module.exports = (common, options) => { const describe = getDescribe(options) const it = getIt(options) - const common = createCommon() describe('.swarm.disconnect', function () { this.timeout(80 * 1000) diff --git a/src/swarm/local-addrs.js b/src/swarm/local-addrs.js index 0c534e6e7..1a387c936 100644 --- a/src/swarm/local-addrs.js +++ b/src/swarm/local-addrs.js @@ -3,10 +3,14 @@ const { getDescribe, getIt, expect } = require('../utils/mocha') -module.exports = (createCommon, options) => { +/** @typedef { import("ipfsd-ctl").TestsInterface } TestsInterface */ +/** + * @param {TestsInterface} common + * @param {Object} options + */ +module.exports = (common, options) => { const describe = getDescribe(options) const it = getIt(options) - const common = createCommon() describe('.swarm.localAddrs', function () { this.timeout(80 * 1000) diff --git a/src/swarm/peers.js b/src/swarm/peers.js index f37471c9d..d8d8daa2f 100644 --- a/src/swarm/peers.js +++ b/src/swarm/peers.js @@ -6,10 +6,14 @@ const PeerId = require('peer-id') const delay = require('delay') const { getDescribe, getIt, expect } = require('../utils/mocha') -module.exports = (createCommon, options) => { +/** @typedef { import("ipfsd-ctl").TestsInterface } TestsInterface */ +/** + * @param {TestsInterface} common + * @param {Object} options + */ +module.exports = (common, options) => { const describe = getDescribe(options) const it = getIt(options) - const common = createCommon() describe('.swarm.peers', function () { this.timeout(80 * 1000) From 5035a4489524e1e35f0a6ae436efb792f07a0fc1 Mon Sep 17 00:00:00 2001 From: Hugo Dias Date: Tue, 15 Oct 2019 09:13:39 +0100 Subject: [PATCH 02/12] fix: tweak some tests --- src/miscellaneous/dns.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/miscellaneous/dns.js b/src/miscellaneous/dns.js index fade59bc9..d7f478cb5 100644 --- a/src/miscellaneous/dns.js +++ b/src/miscellaneous/dns.js @@ -13,7 +13,7 @@ module.exports = (common, options) => { const it = getIt(options) describe('.dns', function () { - this.timeout(10 * 1000) + this.timeout(60 * 1000) this.retries(3) let ipfs From beff1a27948898de5a39056ec6f1f12f5578d489 Mon Sep 17 00:00:00 2001 From: Hugo Dias Date: Mon, 21 Oct 2019 11:49:57 +0200 Subject: [PATCH 03/12] fix: fix connecting multiples node in the browser when running with a 'proc' pre-setup we could end up with multiples in-browser setup connecting to each other. whihc isnt a very useful situation. with this the first node gets the pre-configured config and all the others get a JS daemon. --- package.json | 2 +- src/bitswap/wantlist.js | 2 +- src/miscellaneous/resolve.js | 11 ++--------- src/ping/ping-pull-stream.js | 2 +- src/ping/ping-readable-stream.js | 2 +- src/ping/ping.js | 2 +- src/pubsub/peers.js | 4 ++-- src/pubsub/subscribe.js | 2 +- src/swarm/addrs.js | 2 +- src/swarm/connect.js | 2 +- src/swarm/disconnect.js | 2 +- src/swarm/peers.js | 16 +++++++--------- 12 files changed, 20 insertions(+), 29 deletions(-) diff --git a/package.json b/package.json index fe926c906..669fba18c 100644 --- a/package.json +++ b/package.json @@ -76,7 +76,7 @@ }, "devDependencies": { "aegir": "^20.3.2", - "ipfsd-ctl": "ipfs/js-ipfsd-ctl#feat/interface-tests" + "ipfsd-ctl": "github:ipfs/js-ipfsd-ctl#feat/interface-tests" }, "contributors": [ "Alan Shaw ", diff --git a/src/bitswap/wantlist.js b/src/bitswap/wantlist.js index 3a4e8a2ab..19a510f59 100644 --- a/src/bitswap/wantlist.js +++ b/src/bitswap/wantlist.js @@ -25,7 +25,7 @@ module.exports = (common, options) => { this.timeout(60 * 1000) ipfsA = await common.setup() - ipfsB = 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).catch(() => {}) diff --git a/src/miscellaneous/resolve.js b/src/miscellaneous/resolve.js index 60bf12240..0bd003c57 100644 --- a/src/miscellaneous/resolve.js +++ b/src/miscellaneous/resolve.js @@ -81,15 +81,8 @@ module.exports = (common, options) => { it('should resolve IPNS link recursively', async function () { this.timeout(20 * 1000) - - // Ensure another node exists for publishing to - only required by go-ipfs - if (ipfs.peerId.agentVersion.includes('go-ipfs')) { - const node = await common.setup() - - // this fails in the browser because there is no relay node available to connect the two - // nodes, but we only need this for go-ipfs as it doesn't support the `allowOffline` flag yet - await ipfs.swarm.connect(node.peerId.addresses.find((a) => a.includes('127.0.0.1'))) - } + const node = await common.setup({ type: 'js' }) + 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 }) diff --git a/src/ping/ping-pull-stream.js b/src/ping/ping-pull-stream.js index 0c3781282..96b85746c 100644 --- a/src/ping/ping-pull-stream.js +++ b/src/ping/ping-pull-stream.js @@ -22,7 +22,7 @@ module.exports = (common, options) => { before(async () => { ipfsA = await common.setup() - ipfsB = await common.setup() + ipfsB = await common.setup({ type: 'js' }) await ipfsA.swarm.connect(ipfsB.peerId.addresses[0]) }) diff --git a/src/ping/ping-readable-stream.js b/src/ping/ping-readable-stream.js index 13c0ca35e..2ac8ce33d 100644 --- a/src/ping/ping-readable-stream.js +++ b/src/ping/ping-readable-stream.js @@ -23,7 +23,7 @@ module.exports = (common, options) => { before(async () => { ipfsA = await common.setup() - ipfsB = await common.setup() + ipfsB = await common.setup({ type: 'js' }) await ipfsA.swarm.connect(ipfsB.peerId.addresses[0]) }) diff --git a/src/ping/ping.js b/src/ping/ping.js index a23ed2517..d4e74d2be 100644 --- a/src/ping/ping.js +++ b/src/ping/ping.js @@ -25,7 +25,7 @@ module.exports = (common, options) => { this.timeout(60 * 1000) ipfsA = await common.setup() - ipfsB = await common.setup() + ipfsB = await common.setup({ type: 'js' }) await ipfsA.swarm.connect(ipfsB.peerId.addresses[0]) }) diff --git a/src/pubsub/peers.js b/src/pubsub/peers.js index 6392cf22e..38f148f1f 100644 --- a/src/pubsub/peers.js +++ b/src/pubsub/peers.js @@ -23,8 +23,8 @@ module.exports = (common, options) => { let subscribedTopics = [] before(async () => { ipfs1 = await common.setup() - ipfs2 = await common.setup() - ipfs3 = await common.setup() + ipfs2 = await common.setup({ type: 'js' }) + ipfs3 = await common.setup({ type: 'js' }) 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')) diff --git a/src/pubsub/subscribe.js b/src/pubsub/subscribe.js index fdaf302b3..5162677f7 100644 --- a/src/pubsub/subscribe.js +++ b/src/pubsub/subscribe.js @@ -30,7 +30,7 @@ module.exports = (common, options) => { this.timeout(100 * 1000) ipfs1 = await common.setup() - ipfs2 = await common.setup() + ipfs2 = await common.setup({ type: 'js' }) }) after(() => common.teardown()) diff --git a/src/swarm/addrs.js b/src/swarm/addrs.js index f4d3730a6..c1a451588 100644 --- a/src/swarm/addrs.js +++ b/src/swarm/addrs.js @@ -21,7 +21,7 @@ module.exports = (common, options) => { before(async () => { ipfsA = await common.setup() - ipfsB = await common.setup() + ipfsB = await common.setup({ type: 'js' }) await ipfsA.swarm.connect(ipfsB.peerId.addresses[0]) }) diff --git a/src/swarm/connect.js b/src/swarm/connect.js index 4ac818fd7..988f2748d 100644 --- a/src/swarm/connect.js +++ b/src/swarm/connect.js @@ -19,7 +19,7 @@ module.exports = (common, options) => { before(async () => { ipfsA = await common.setup() - ipfsB = await common.setup() + ipfsB = await common.setup({ type: 'js' }) }) after(() => common.teardown()) diff --git a/src/swarm/disconnect.js b/src/swarm/disconnect.js index a71da9b76..02909dba1 100644 --- a/src/swarm/disconnect.js +++ b/src/swarm/disconnect.js @@ -20,7 +20,7 @@ module.exports = (common, options) => { before(async () => { ipfsA = await common.setup() - ipfsB = await common.setup() + ipfsB = await common.setup({ type: 'js' }) await ipfsA.swarm.connect(ipfsB.peerId.addresses[0]) }) diff --git a/src/swarm/peers.js b/src/swarm/peers.js index d8d8daa2f..485e1bc23 100644 --- a/src/swarm/peers.js +++ b/src/swarm/peers.js @@ -23,7 +23,7 @@ module.exports = (common, options) => { before(async () => { ipfsA = await common.setup() - ipfsB = await common.setup() + ipfsB = await common.setup({ type: 'js' }) await ipfsA.swarm.connect(ipfsB.peerId.addresses[0]) await delay(60 * 1000) // wait for open streams in the connection available }) @@ -84,10 +84,8 @@ module.exports = (common, options) => { } it('should list peers only once', async () => { - const config = getConfig(['/ip4/127.0.0.1/tcp/0']) - - const nodeA = await common.setup({ spawnOptions: { config } }) - const nodeB = await common.setup({ spawnOptions: { config } }) + const nodeA = await common.setup() + const nodeB = await common.setup({ type: 'js' }) await nodeA.swarm.connect(nodeB.peerId.addresses[0]) await delay(1000) const peersA = await nodeA.swarm.peers() @@ -103,11 +101,11 @@ module.exports = (common, options) => { '/ip4/127.0.0.1/tcp/16544' ]) const configB = getConfig([ - '/ip4/127.0.0.1/tcp/26545', - '/ip4/127.0.0.1/tcp/26546' + '/ip4/127.0.0.1/tcp/26545/ws', + '/ip4/127.0.0.1/tcp/26546/ws' ]) - const nodeA = await common.setup({ spawnOptions: { config: configA } }) - const nodeB = await common.setup({ spawnOptions: { config: configB } }) + const nodeA = await common.setup({ ipfsOptions: { config: configA } }) + const nodeB = await common.setup({ type: 'js', ipfsOptions: { config: configB } }) await nodeA.swarm.connect(nodeB.peerId.addresses[0]) await delay(1000) const peersA = await nodeA.swarm.peers() From 5d9bbd8274dec0d764eef7ad0364936f0e7b8045 Mon Sep 17 00:00:00 2001 From: Hugo Dias Date: Tue, 3 Dec 2019 17:36:44 +0000 Subject: [PATCH 04/12] fix: change secondary node to Go --- src/bitswap/stat.js | 2 +- src/bitswap/wantlist.js | 3 +-- src/miscellaneous/resolve.js | 3 +-- src/miscellaneous/stop.js | 3 +-- src/pubsub/peers.js | 4 ++-- src/pubsub/subscribe.js | 4 +--- src/swarm/peers.js | 6 +++--- 7 files changed, 10 insertions(+), 15 deletions(-) diff --git a/src/bitswap/stat.js b/src/bitswap/stat.js index 93f919de6..699b26a4d 100644 --- a/src/bitswap/stat.js +++ b/src/bitswap/stat.js @@ -32,7 +32,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() }) }) } diff --git a/src/bitswap/wantlist.js b/src/bitswap/wantlist.js index 19a510f59..7d04afd35 100644 --- a/src/bitswap/wantlist.js +++ b/src/bitswap/wantlist.js @@ -26,7 +26,6 @@ module.exports = (common, options) => { 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).catch(() => {}) }) @@ -52,7 +51,7 @@ module.exports = (common, options) => { const node = await common.node() await node.stop() - return expect(node.bitswap.wantlist()).to.eventually.be.rejected() + return expect(node.api.bitswap.stat()).to.eventually.be.rejected() }) }) } diff --git a/src/miscellaneous/resolve.js b/src/miscellaneous/resolve.js index 0bd003c57..8d271ef17 100644 --- a/src/miscellaneous/resolve.js +++ b/src/miscellaneous/resolve.js @@ -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 }) diff --git a/src/miscellaneous/stop.js b/src/miscellaneous/stop.js index 4e9e2f9b5..7f1d8458b 100644 --- a/src/miscellaneous/stop.js +++ b/src/miscellaneous/stop.js @@ -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() }) }) } diff --git a/src/pubsub/peers.js b/src/pubsub/peers.js index 38f148f1f..f93447415 100644 --- a/src/pubsub/peers.js +++ b/src/pubsub/peers.js @@ -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')) diff --git a/src/pubsub/subscribe.js b/src/pubsub/subscribe.js index 5162677f7..6a48c57d0 100644 --- a/src/pubsub/subscribe.js +++ b/src/pubsub/subscribe.js @@ -30,11 +30,9 @@ module.exports = (common, options) => { this.timeout(100 * 1000) ipfs1 = await common.setup() - ipfs2 = await common.setup({ type: 'js' }) + ipfs2 = await common.setup({ type: 'go' }) }) - after(() => common.teardown()) - beforeEach(() => { topic = getTopic() subscribedTopics = [topic] diff --git a/src/swarm/peers.js b/src/swarm/peers.js index 485e1bc23..9ec5c7b75 100644 --- a/src/swarm/peers.js +++ b/src/swarm/peers.js @@ -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 }) @@ -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() @@ -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() From c165e0762cf00d1f73848f42ce144bf9f8d9b415 Mon Sep 17 00:00:00 2001 From: Hugo Dias Date: Tue, 3 Dec 2019 17:50:04 +0000 Subject: [PATCH 05/12] fix: one more to go --- src/bitswap/wantlist.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/bitswap/wantlist.js b/src/bitswap/wantlist.js index 7d04afd35..14a137c01 100644 --- a/src/bitswap/wantlist.js +++ b/src/bitswap/wantlist.js @@ -25,7 +25,7 @@ module.exports = (common, options) => { this.timeout(60 * 1000) ipfsA = await common.setup() - ipfsB = await common.setup({ type: 'js' }) + ipfsB = await common.setup({ type: 'go' }) // Add key to the wantlist for ipfsB ipfsB.block.get(key).catch(() => {}) }) From f5287d8e52b45d51c061b33cfb827a1f61fecf9c Mon Sep 17 00:00:00 2001 From: Hugo Dias Date: Mon, 9 Dec 2019 21:12:50 +0000 Subject: [PATCH 06/12] chore: update to the latest ctl api --- src/bitswap/stat.js | 12 ++++++------ src/bitswap/wantlist.js | 22 +++++++--------------- src/block/get.js | 14 +++++--------- src/block/put.js | 14 +++++--------- src/block/rm.js | 8 ++++---- src/block/stat.js | 14 +++++--------- src/bootstrap/add.js | 14 +++++--------- src/bootstrap/list.js | 8 ++++---- src/bootstrap/rm.js | 8 ++++---- src/config/get.js | 8 ++++---- src/config/profiles/apply.js | 14 +++++--------- src/config/profiles/list.js | 14 +++++--------- src/config/replace.js | 14 +++++--------- src/config/set.js | 14 +++++--------- src/dag/get.js | 8 ++++---- src/dag/put.js | 14 ++++---------- src/dag/tree.js | 14 ++++---------- src/dht/find-peer.js | 20 ++++++-------------- src/dht/find-provs.js | 16 ++++++---------- src/dht/get.js | 20 ++++++-------------- src/dht/provide.js | 20 ++++++-------------- src/dht/put.js | 16 ++++++---------- src/dht/query.js | 20 ++++++-------------- src/files-mfs/cp.js | 14 ++++---------- src/files-mfs/flush.js | 14 ++++---------- src/files-mfs/ls-pull-stream.js | 14 ++++---------- src/files-mfs/ls-readable-stream.js | 14 ++++---------- src/files-mfs/ls.js | 14 ++++---------- src/files-mfs/mkdir.js | 14 ++++---------- src/files-mfs/mv.js | 14 ++++---------- src/files-mfs/read-pull-stream.js | 14 ++++---------- src/files-mfs/read-readable-stream.js | 14 ++++---------- src/files-mfs/read.js | 14 ++++---------- src/files-mfs/rm.js | 14 ++++---------- src/files-mfs/stat.js | 14 ++++---------- src/files-mfs/write.js | 14 ++++---------- src/files-regular/add-from-fs.js | 14 ++++---------- src/files-regular/add-from-stream.js | 14 ++++---------- src/files-regular/add-from-url.js | 14 ++++---------- src/files-regular/add-pull-stream.js | 14 ++++---------- src/files-regular/add-readable-stream.js | 14 ++++---------- src/files-regular/add.js | 14 ++++---------- src/files-regular/cat-pull-stream.js | 14 ++++---------- src/files-regular/cat-readable-stream.js | 14 +++++--------- src/files-regular/cat.js | 14 ++++---------- src/files-regular/get-pull-stream.js | 14 ++++---------- src/files-regular/get-readable-stream.js | 14 +++++--------- src/files-regular/get.js | 14 +++++--------- src/files-regular/ls-pull-stream.js | 14 +++++--------- src/files-regular/ls-readable-stream.js | 14 +++++--------- src/files-regular/ls.js | 14 +++++--------- src/files-regular/refs-local-tests.js | 14 +++++--------- src/files-regular/refs-tests.js | 14 +++++--------- src/key/export.js | 14 +++++--------- src/key/gen.js | 14 +++++--------- src/key/import.js | 14 +++++--------- src/key/list.js | 14 +++++--------- src/key/rename.js | 14 +++++--------- src/key/rm.js | 14 +++++--------- src/miscellaneous/dns.js | 14 +++++--------- src/miscellaneous/id.js | 8 ++++---- src/miscellaneous/resolve.js | 10 +++++----- src/miscellaneous/stop.js | 6 +++--- src/miscellaneous/version.js | 14 +++++--------- src/name-pubsub/cancel.js | 14 +++++--------- src/name-pubsub/state.js | 14 +++++--------- src/name-pubsub/subs.js | 14 +++++--------- src/name/publish.js | 14 +++++--------- src/name/resolve.js | 12 ++++++------ src/object/data.js | 14 +++++--------- src/object/get.js | 14 +++++--------- src/object/links.js | 14 +++++--------- src/object/new.js | 14 +++++--------- src/object/patch/add-link.js | 14 +++++--------- src/object/patch/append-data.js | 14 +++++--------- src/object/patch/rm-link.js | 14 +++++--------- src/object/patch/set-data.js | 14 +++++--------- src/object/put.js | 14 +++++--------- src/object/stat.js | 14 +++++--------- src/pin/add.js | 8 ++++---- src/pin/ls.js | 14 +++++--------- src/pin/rm.js | 8 ++++---- src/ping/ping-pull-stream.js | 10 +++++----- src/ping/ping-readable-stream.js | 10 +++++----- src/ping/ping.js | 16 ++++++---------- src/pubsub/ls.js | 8 ++++---- src/pubsub/peers.js | 12 ++++++------ src/pubsub/publish.js | 14 +++++--------- src/pubsub/subscribe.js | 16 ++++++---------- src/pubsub/unsubscribe.js | 14 +++++--------- src/repo/gc.js | 14 +++++--------- src/repo/stat.js | 14 +++++--------- src/repo/version.js | 14 +++++--------- src/stats/bitswap.js | 14 +++++--------- src/stats/bw-pull-stream.js | 14 +++++--------- src/stats/bw-readable-stream.js | 14 +++++--------- src/stats/bw.js | 14 +++++--------- src/stats/repo.js | 14 +++++--------- src/swarm/addrs.js | 10 +++++----- src/swarm/connect.js | 10 +++++----- src/swarm/disconnect.js | 10 +++++----- src/swarm/local-addrs.js | 8 ++++---- src/swarm/peers.js | 22 ++++++++++++---------- 103 files changed, 499 insertions(+), 893 deletions(-) diff --git a/src/bitswap/stat.js b/src/bitswap/stat.js index 699b26a4d..602c55218 100644 --- a/src/bitswap/stat.js +++ b/src/bitswap/stat.js @@ -4,9 +4,9 @@ const { getDescribe, getIt, expect } = require('../utils/mocha') const { expectIsBitswap } = require('../stats/utils') -/** @typedef { import("ipfsd-ctl").TestsInterface } TestsInterface */ +/** @typedef { import("ipfsd-ctl/src/factory") } Factory */ /** - * @param {TestsInterface} common + * @param {Factory} common * @param {Object} options */ module.exports = (common, options) => { @@ -18,18 +18,18 @@ module.exports = (common, options) => { let ipfs before(async () => { - ipfs = await common.setup() + ipfs = (await common.spawn()).api }) - after(() => common.teardown()) + after(() => common.clean()) it('should get bitswap stats', async () => { const res = await ipfs.bitswap.stat() expectIsBitswap(null, res) }) - it('should not get bitswap stats when offline', async function () { - const node = await common.node() + it('should not get bitswap stats when offline', async () => { + const node = await common.spawn() await node.stop() return expect(node.api.bitswap.stat()).to.eventually.be.rejected() diff --git a/src/bitswap/wantlist.js b/src/bitswap/wantlist.js index 14a137c01..788fed8a3 100644 --- a/src/bitswap/wantlist.js +++ b/src/bitswap/wantlist.js @@ -4,9 +4,9 @@ const { getDescribe, getIt, expect } = require('../utils/mocha') const { waitForWantlistKey } = require('./utils') -/** @typedef { import("ipfsd-ctl").TestsInterface } TestsInterface */ +/** @typedef { import("ipfsd-ctl/src/factory") } Factory */ /** - * @param {TestsInterface} common + * @param {Factory} common * @param {Object} options */ module.exports = (common, options) => { @@ -19,22 +19,14 @@ module.exports = (common, options) => { let ipfsB const key = 'QmUBdnXXPyoDFXj3Hj39dNJ5VkN3QFRskXxcGaYFBB8CNR' - before(async function () { - // CI takes longer to instantiate the daemon, so we need to increase the - // timeout for the before step - this.timeout(60 * 1000) - - ipfsA = await common.setup() - ipfsB = await common.setup({ type: 'go' }) + before(async () => { + ipfsA = (await common.spawn()).api + ipfsB = (await common.spawn({ type: 'go' })).api // Add key to the wantlist for ipfsB ipfsB.block.get(key).catch(() => {}) }) - after(function () { - this.timeout(30 * 1000) - - return common.teardown() - }) + after(() => common.clean()) it('should get the wantlist', function () { return waitForWantlistKey(ipfsB, key) @@ -48,7 +40,7 @@ module.exports = (common, options) => { }) it('should not get the wantlist when offline', async () => { - const node = await common.node() + const node = await common.spawn() await node.stop() return expect(node.api.bitswap.stat()).to.eventually.be.rejected() diff --git a/src/block/get.js b/src/block/get.js index 576ab72a7..413654a18 100644 --- a/src/block/get.js +++ b/src/block/get.js @@ -5,9 +5,9 @@ const multihash = require('multihashes') const CID = require('cids') const { getDescribe, getIt, expect } = require('../utils/mocha') -/** @typedef { import("ipfsd-ctl").TestsInterface } TestsInterface */ +/** @typedef { import("ipfsd-ctl/src/factory") } Factory */ /** - * @param {TestsInterface} common + * @param {Factory} common * @param {Object} options */ module.exports = (common, options) => { @@ -18,17 +18,13 @@ module.exports = (common, options) => { const data = Buffer.from('blorb') let ipfs, hash - before(async function () { - // CI takes longer to instantiate the daemon, so we need to increase the - // timeout for the before step - this.timeout(60 * 1000) - - ipfs = await common.setup() + before(async () => { + ipfs = (await common.spawn()).api const block = await ipfs.block.put(data) hash = block.cid.multihash }) - after(() => common.teardown()) + after(() => common.clean()) it('should get by CID object', async () => { const cid = new CID(hash) diff --git a/src/block/put.js b/src/block/put.js index b29daef63..877457330 100644 --- a/src/block/put.js +++ b/src/block/put.js @@ -6,9 +6,9 @@ const multihash = require('multihashes') const CID = require('cids') const { getDescribe, getIt, expect } = require('../utils/mocha') -/** @typedef { import("ipfsd-ctl").TestsInterface } TestsInterface */ +/** @typedef { import("ipfsd-ctl/src/factory") } Factory */ /** - * @param {TestsInterface} common + * @param {Factory} common * @param {Object} options */ module.exports = (common, options) => { @@ -18,15 +18,11 @@ module.exports = (common, options) => { describe('.block.put', () => { let ipfs - before(async function () { - // CI takes longer to instantiate the daemon, so we need to increase the - // timeout for the before step - this.timeout(60 * 1000) - - ipfs = await common.setup() + before(async () => { + ipfs = (await common.spawn()).api }) - after(() => common.teardown()) + after(() => common.clean()) it('should put a buffer, using defaults', async () => { const expectedHash = 'QmPv52ekjS75L4JmHpXVeuJ5uX2ecSfSZo88NSyxwA3rAQ' diff --git a/src/block/rm.js b/src/block/rm.js index 327d02c70..72665a5bc 100644 --- a/src/block/rm.js +++ b/src/block/rm.js @@ -4,9 +4,9 @@ const { getDescribe, getIt, expect } = require('../utils/mocha') const hat = require('hat') -/** @typedef { import("ipfsd-ctl").TestsInterface } TestsInterface */ +/** @typedef { import("ipfsd-ctl/src/factory") } Factory */ /** - * @param {TestsInterface} common + * @param {Factory} common * @param {Object} options */ module.exports = (common, options) => { @@ -16,9 +16,9 @@ module.exports = (common, options) => { describe('.block.rm', () => { let ipfs - before(async () => { ipfs = await common.setup() }) + before(async () => { ipfs = (await common.spawn()).api }) - after(() => common.teardown()) + after(() => common.clean()) it('should remove by CID object', async () => { const cid = await ipfs.dag.put(Buffer.from(hat()), { diff --git a/src/block/stat.js b/src/block/stat.js index a048e9db7..e2354b7e9 100644 --- a/src/block/stat.js +++ b/src/block/stat.js @@ -4,9 +4,9 @@ const CID = require('cids') const { getDescribe, getIt, expect } = require('../utils/mocha') -/** @typedef { import("ipfsd-ctl").TestsInterface } TestsInterface */ +/** @typedef { import("ipfsd-ctl/src/factory") } Factory */ /** - * @param {TestsInterface} common + * @param {Factory} common * @param {Object} options */ module.exports = (common, options) => { @@ -17,17 +17,13 @@ module.exports = (common, options) => { const data = Buffer.from('blorb') let ipfs, hash - before(async function () { - // CI takes longer to instantiate the daemon, so we need to increase the - // timeout for the before step - this.timeout(60 * 1000) - - ipfs = await common.setup() + before(async () => { + ipfs = (await common.spawn()).api const block = await ipfs.block.put(data) hash = block.cid.multihash }) - after(() => common.teardown()) + after(() => common.clean()) it('should stat by CID', async () => { const cid = new CID(hash) diff --git a/src/bootstrap/add.js b/src/bootstrap/add.js index 1191e8e7d..510888f6e 100644 --- a/src/bootstrap/add.js +++ b/src/bootstrap/add.js @@ -6,9 +6,9 @@ const { getDescribe, getIt, expect } = require('../utils/mocha') const invalidArg = 'this/Is/So/Invalid/' const validIp4 = '/ip4/104.236.176.52/tcp/4001/ipfs/QmSoLnSGccFuZQJzRadHn95W2CrSFmZuTdDWP8HXaHca9z' -/** @typedef { import("ipfsd-ctl").TestsInterface } TestsInterface */ +/** @typedef { import("ipfsd-ctl/src/factory") } Factory */ /** - * @param {TestsInterface} common + * @param {Factory} common * @param {Object} options */ module.exports = (common, options) => { @@ -20,15 +20,11 @@ module.exports = (common, options) => { let ipfs - before(async function () { - // CI takes longer to instantiate the daemon, so we need to increase the - // timeout for the before step - this.timeout(60 * 1000) - - ipfs = await common.setup() + before(async () => { + ipfs = (await common.spawn()).api }) - after(() => common.teardown()) + after(() => common.clean()) it('should return an error when called with an invalid arg', () => { return expect(ipfs.bootstrap.add(invalidArg)).to.eventually.be.rejected diff --git a/src/bootstrap/list.js b/src/bootstrap/list.js index eaef06f57..9dd335ef8 100644 --- a/src/bootstrap/list.js +++ b/src/bootstrap/list.js @@ -3,9 +3,9 @@ const { getDescribe, getIt, expect } = require('../utils/mocha') -/** @typedef { import("ipfsd-ctl").TestsInterface } TestsInterface */ +/** @typedef { import("ipfsd-ctl/src/factory") } Factory */ /** - * @param {TestsInterface} common + * @param {Factory} common * @param {Object} options */ module.exports = (common, options) => { @@ -17,9 +17,9 @@ module.exports = (common, options) => { let ipfs - before(async () => { ipfs = await common.setup() }) + before(async () => { ipfs = (await common.spawn()).api }) - after(() => common.teardown()) + after(() => common.clean()) it('should return a list of peers', async () => { const res = await ipfs.bootstrap.list() diff --git a/src/bootstrap/rm.js b/src/bootstrap/rm.js index 02f6f9feb..839eb499f 100644 --- a/src/bootstrap/rm.js +++ b/src/bootstrap/rm.js @@ -3,9 +3,9 @@ const { getDescribe, getIt, expect } = require('../utils/mocha') -/** @typedef { import("ipfsd-ctl").TestsInterface } TestsInterface */ +/** @typedef { import("ipfsd-ctl/src/factory") } Factory */ /** - * @param {TestsInterface} common + * @param {Factory} common * @param {Object} options */ module.exports = (common, options) => { @@ -20,9 +20,9 @@ module.exports = (common, options) => { let ipfs - before(async () => { ipfs = await common.setup() }) + before(async () => { ipfs = (await common.spawn()).api }) - after(() => common.teardown()) + after(() => common.clean()) it('should return an error when called with an invalid arg', () => { return expect(ipfs.bootstrap.rm(invalidArg)).to.eventually.be.rejected diff --git a/src/config/get.js b/src/config/get.js index 3b219316e..7f8efeca6 100644 --- a/src/config/get.js +++ b/src/config/get.js @@ -4,9 +4,9 @@ const { getDescribe, getIt, expect } = require('../utils/mocha') const isPlainObject = require('is-plain-object') -/** @typedef { import("ipfsd-ctl").TestsInterface } TestsInterface */ +/** @typedef { import("ipfsd-ctl/src/factory") } Factory */ /** - * @param {TestsInterface} common + * @param {Factory} common * @param {Object} options */ module.exports = (common, options) => { @@ -17,9 +17,9 @@ module.exports = (common, options) => { this.timeout(30 * 1000) let ipfs - before(async () => { ipfs = await common.setup() }) + before(async () => { ipfs = (await common.spawn()).api }) - after(() => common.teardown()) + after(() => common.clean()) it('should retrieve the whole config', async () => { const config = await ipfs.config.get() diff --git a/src/config/profiles/apply.js b/src/config/profiles/apply.js index 6a399091c..3466a7165 100644 --- a/src/config/profiles/apply.js +++ b/src/config/profiles/apply.js @@ -2,9 +2,9 @@ 'use strict' const { getDescribe, getIt, expect } = require('../../utils/mocha') -/** @typedef { import("ipfsd-ctl").TestsInterface } TestsInterface */ +/** @typedef { import("ipfsd-ctl/src/factory") } Factory */ /** - * @param {TestsInterface} common + * @param {Factory} common * @param {Object} options */ module.exports = (common, options) => { @@ -15,15 +15,11 @@ module.exports = (common, options) => { this.timeout(30 * 1000) let ipfs - before(async function () { - // CI takes longer to instantiate the daemon, so we need to increase the - // timeout for the before step - this.timeout(60 * 1000) - - ipfs = await common.setup() + before(async () => { + ipfs = (await common.spawn()).api }) - after(() => common.teardown()) + after(() => common.clean()) it('should apply a config profile', async () => { const diff = await ipfs.config.profiles.apply('lowpower') diff --git a/src/config/profiles/list.js b/src/config/profiles/list.js index 67640fa06..ca6187fbb 100644 --- a/src/config/profiles/list.js +++ b/src/config/profiles/list.js @@ -2,9 +2,9 @@ 'use strict' const { getDescribe, getIt, expect } = require('../../utils/mocha') -/** @typedef { import("ipfsd-ctl").TestsInterface } TestsInterface */ +/** @typedef { import("ipfsd-ctl/src/factory") } Factory */ /** - * @param {TestsInterface} common + * @param {Factory} common * @param {Object} options */ module.exports = (common, options) => { @@ -15,15 +15,11 @@ module.exports = (common, options) => { this.timeout(30 * 1000) let ipfs - before(async function () { - // CI takes longer to instantiate the daemon, so we need to increase the - // timeout for the before step - this.timeout(60 * 1000) - - ipfs = await common.setup() + before(async () => { + ipfs = (await common.spawn()).api }) - after(() => common.teardown()) + after(() => common.clean()) it('should list config profiles', async () => { const profiles = await ipfs.config.profiles.list() diff --git a/src/config/replace.js b/src/config/replace.js index da17794b1..5fe2e4d56 100644 --- a/src/config/replace.js +++ b/src/config/replace.js @@ -2,9 +2,9 @@ 'use strict' const { getDescribe, getIt, expect } = require('../utils/mocha') -/** @typedef { import("ipfsd-ctl").TestsInterface } TestsInterface */ +/** @typedef { import("ipfsd-ctl/src/factory") } Factory */ /** - * @param {TestsInterface} common + * @param {Factory} common * @param {Object} options */ module.exports = (common, options) => { @@ -15,15 +15,11 @@ module.exports = (common, options) => { this.timeout(30 * 1000) let ipfs - before(async function () { - // CI takes longer to instantiate the daemon, so we need to increase the - // timeout for the before step - this.timeout(60 * 1000) - - ipfs = await common.setup() + before(async () => { + ipfs = (await common.spawn()).api }) - after(() => common.teardown()) + after(() => common.clean()) const config = { Fruit: 'Bananas' diff --git a/src/config/set.js b/src/config/set.js index 5f88d3ce6..fbb8ff352 100644 --- a/src/config/set.js +++ b/src/config/set.js @@ -2,9 +2,9 @@ 'use strict' const { getDescribe, getIt, expect } = require('../utils/mocha') -/** @typedef { import("ipfsd-ctl").TestsInterface } TestsInterface */ +/** @typedef { import("ipfsd-ctl/src/factory") } Factory */ /** - * @param {TestsInterface} common + * @param {Factory} common * @param {Object} options */ module.exports = (common, options) => { @@ -15,15 +15,11 @@ module.exports = (common, options) => { this.timeout(30 * 1000) let ipfs - before(async function () { - // CI takes longer to instantiate the daemon, so we need to increase the - // timeout for the before step - this.timeout(60 * 1000) - - ipfs = await common.setup() + before(async () => { + ipfs = (await common.spawn()).api }) - after(() => common.teardown()) + after(() => common.clean()) it('should set a new key', async () => { await ipfs.config.set('Fruit', 'banana') diff --git a/src/dag/get.js b/src/dag/get.js index 97788284d..67a25cda5 100644 --- a/src/dag/get.js +++ b/src/dag/get.js @@ -9,9 +9,9 @@ const Unixfs = require('ipfs-unixfs') const CID = require('cids') const { getDescribe, getIt, expect } = require('../utils/mocha') -/** @typedef { import("ipfsd-ctl").TestsInterface } TestsInterface */ +/** @typedef { import("ipfsd-ctl/src/factory") } Factory */ /** - * @param {TestsInterface} common + * @param {Factory} common * @param {Object} options */ module.exports = (common, options) => { @@ -20,9 +20,9 @@ module.exports = (common, options) => { describe('.dag.get', () => { let ipfs - before(async () => { ipfs = await common.setup() }) + before(async () => { ipfs = (await common.spawn()).api }) - after(() => common.teardown()) + after(() => common.clean()) let pbNode let cborNode diff --git a/src/dag/put.js b/src/dag/put.js index b0d5edd33..1dd031086 100644 --- a/src/dag/put.js +++ b/src/dag/put.js @@ -8,9 +8,9 @@ const CID = require('cids') const multihash = require('multihashes') const { getDescribe, getIt, expect } = require('../utils/mocha') -/** @typedef { import("ipfsd-ctl").TestsInterface } TestsInterface */ +/** @typedef { import("ipfsd-ctl/src/factory") } Factory */ /** - * @param {TestsInterface} common + * @param {Factory} common * @param {Object} options */ module.exports = (common, options) => { @@ -20,15 +20,9 @@ module.exports = (common, options) => { describe('.dag.put', () => { let ipfs - before(async function () { - // CI takes longer to instantiate the daemon, so we need to increase the - // timeout for the before step - this.timeout(60 * 1000) + before(async () => { ipfs = (await common.spawn()).api }) - ipfs = await common.setup() - }) - - after(() => common.teardown()) + after(() => common.clean()) let pbNode let cborNode diff --git a/src/dag/tree.js b/src/dag/tree.js index 9451b936e..36a206738 100644 --- a/src/dag/tree.js +++ b/src/dag/tree.js @@ -7,9 +7,9 @@ const DAGNode = dagPB.DAGNode const dagCBOR = require('ipld-dag-cbor') const { getDescribe, getIt, expect } = require('../utils/mocha') -/** @typedef { import("ipfsd-ctl").TestsInterface } TestsInterface */ +/** @typedef { import("ipfsd-ctl/src/factory") } Factory */ /** - * @param {TestsInterface} common + * @param {Factory} common * @param {Object} options */ module.exports = (common, options) => { @@ -19,15 +19,9 @@ module.exports = (common, options) => { describe('.dag.tree', () => { let ipfs - before(async function () { - // CI takes longer to instantiate the daemon, so we need to increase the - // timeout for the before step - this.timeout(60 * 1000) - - ipfs = await common.setup() - }) + before(async () => { ipfs = (await common.spawn()).api }) - after(() => common.teardown()) + after(() => common.clean()) let nodePb let nodeCbor diff --git a/src/dht/find-peer.js b/src/dht/find-peer.js index d0ab85ea5..4237b0d49 100644 --- a/src/dht/find-peer.js +++ b/src/dht/find-peer.js @@ -3,9 +3,9 @@ const { getDescribe, getIt, expect } = require('../utils/mocha') -/** @typedef { import("ipfsd-ctl").TestsInterface } TestsInterface */ +/** @typedef { import("ipfsd-ctl/src/factory") } Factory */ /** - * @param {TestsInterface} common + * @param {Factory} common * @param {Object} options */ module.exports = (common, options) => { @@ -18,21 +18,13 @@ module.exports = (common, options) => { let nodeA let nodeB - before(async function () { - // CI takes longer to instantiate the daemon, so we need to increase the - // timeout for the before step - this.timeout(60 * 1000) - - nodeA = await common.setup() - nodeB = await common.setup() + before(async () => { + nodeA = (await common.spawn()).api + nodeB = (await common.spawn()).api await nodeB.swarm.connect(nodeA.peerId.addresses[0]) }) - after(function () { - this.timeout(50 * 1000) - - return common.teardown() - }) + after(() => common.clean()) it('should find other peers', async () => { const res = await nodeA.dht.findPeer(nodeB.peerId.id) diff --git a/src/dht/find-provs.js b/src/dht/find-provs.js index 1230279da..76cae20c7 100644 --- a/src/dht/find-provs.js +++ b/src/dht/find-provs.js @@ -13,9 +13,9 @@ async function fakeCid () { return new CID(0, 'dag-pb', mh) } -/** @typedef { import("ipfsd-ctl").TestsInterface } TestsInterface */ +/** @typedef { import("ipfsd-ctl/src/factory") } Factory */ /** - * @param {TestsInterface} common + * @param {Factory} common * @param {Object} options */ module.exports = (common, options) => { @@ -28,20 +28,16 @@ module.exports = (common, options) => { let nodeC before(async () => { - nodeA = await common.setup() - nodeB = await common.setup() - nodeC = await common.setup() + nodeA = (await common.spawn()).api + nodeB = (await common.spawn()).api + nodeC = (await common.spawn()).api await Promise.all([ nodeB.swarm.connect(nodeA.peerId.addresses[0]), nodeC.swarm.connect(nodeB.peerId.addresses[0]) ]) }) - after(function () { - this.timeout(50 * 1000) - - return common.teardown() - }) + after(() => common.clean()) let providedCid before('add providers for the same cid', async function () { diff --git a/src/dht/get.js b/src/dht/get.js index c0651e454..356a41224 100644 --- a/src/dht/get.js +++ b/src/dht/get.js @@ -4,9 +4,9 @@ const hat = require('hat') const { getDescribe, getIt, expect } = require('../utils/mocha') -/** @typedef { import("ipfsd-ctl").TestsInterface } TestsInterface */ +/** @typedef { import("ipfsd-ctl/src/factory") } Factory */ /** - * @param {TestsInterface} common + * @param {Factory} common * @param {Object} options */ module.exports = (common, options) => { @@ -19,21 +19,13 @@ module.exports = (common, options) => { let nodeA let nodeB - before(async function () { - // CI takes longer to instantiate the daemon, so we need to increase the - // timeout for the before step - this.timeout(60 * 1000) - - nodeA = await common.setup() - nodeB = await common.setup() + before(async () => { + nodeA = (await common.spawn()).api + nodeB = (await common.spawn()).api await nodeA.swarm.connect(nodeB.peerId.addresses[0]) }) - after(function () { - this.timeout(50 * 1000) - - return common.teardown() - }) + after(() => common.clean()) it('should error when getting a non-existent key from the DHT', () => { return expect(nodeA.dht.get('non-existing', { timeout: 100 })).to.eventually.be.rejected diff --git a/src/dht/provide.js b/src/dht/provide.js index 63c6d73ef..696f3aa73 100644 --- a/src/dht/provide.js +++ b/src/dht/provide.js @@ -4,9 +4,9 @@ const CID = require('cids') const { getDescribe, getIt, expect } = require('../utils/mocha') -/** @typedef { import("ipfsd-ctl").TestsInterface } TestsInterface */ +/** @typedef { import("ipfsd-ctl/src/factory") } Factory */ /** - * @param {TestsInterface} common + * @param {Factory} common * @param {Object} options */ module.exports = (common, options) => { @@ -18,21 +18,13 @@ module.exports = (common, options) => { let ipfs - before(async function () { - // CI takes longer to instantiate the daemon, so we need to increase the - // timeout for the before step - this.timeout(60 * 1000) - - ipfs = await common.setup() - const nodeB = await common.setup() + before(async () => { + ipfs = (await common.spawn()).api + const nodeB = (await common.spawn()).api await ipfs.swarm.connect(nodeB.peerId.addresses[0]) }) - after(function () { - this.timeout(50 * 1000) - - return common.teardown() - }) + after(() => common.clean()) it('should provide local CID', async () => { const res = await ipfs.add(Buffer.from('test')) diff --git a/src/dht/put.js b/src/dht/put.js index a569e80d4..1f006cdab 100644 --- a/src/dht/put.js +++ b/src/dht/put.js @@ -3,9 +3,9 @@ const { getDescribe, getIt } = require('../utils/mocha') -/** @typedef { import("ipfsd-ctl").TestsInterface } TestsInterface */ +/** @typedef { import("ipfsd-ctl/src/factory") } Factory */ /** - * @param {TestsInterface} common + * @param {Factory} common * @param {Object} options */ module.exports = (common, options) => { @@ -18,17 +18,13 @@ module.exports = (common, options) => { let nodeA let nodeB - before(async function () { - // CI takes longer to instantiate the daemon, so we need to increase the - // timeout for the before step - this.timeout(60 * 1000) - - nodeA = await common.setup() - nodeB = await common.setup() + before(async () => { + nodeA = (await common.spawn()).api + nodeB = (await common.spawn()).api await nodeA.swarm.connect(nodeB.peerId.addresses[0]) }) - after(() => common.teardown()) + after(() => common.clean()) it('should put a value to the DHT', async function () { this.timeout(80 * 1000) diff --git a/src/dht/query.js b/src/dht/query.js index 7a0a82f34..f5fea5ecc 100644 --- a/src/dht/query.js +++ b/src/dht/query.js @@ -4,9 +4,9 @@ const pTimeout = require('p-timeout') const { getDescribe, getIt, expect } = require('../utils/mocha') -/** @typedef { import("ipfsd-ctl").TestsInterface } TestsInterface */ +/** @typedef { import("ipfsd-ctl/src/factory") } Factory */ /** - * @param {TestsInterface} common + * @param {Factory} common * @param {Object} options */ module.exports = (common, options) => { @@ -19,21 +19,13 @@ module.exports = (common, options) => { let nodeA let nodeB - before(async function () { - // CI takes longer to instantiate the daemon, so we need to increase the - // timeout for the before step - this.timeout(60 * 1000) - - nodeA = await common.setup() - nodeB = await common.setup() + before(async () => { + nodeA = (await common.spawn()).api + nodeB = (await common.spawn()).api await nodeB.swarm.connect(nodeA.peerId.addresses[0]) }) - after(function () { - this.timeout(50 * 1000) - - return common.teardown() - }) + after(() => common.clean()) it('should return the other node in the query', async function () { const timeout = 150 * 1000 diff --git a/src/files-mfs/cp.js b/src/files-mfs/cp.js index f53d55173..0515d83ed 100644 --- a/src/files-mfs/cp.js +++ b/src/files-mfs/cp.js @@ -5,9 +5,9 @@ const hat = require('hat') const { fixtures } = require('../files-regular/utils') const { getDescribe, getIt, expect } = require('../utils/mocha') -/** @typedef { import("ipfsd-ctl").TestsInterface } TestsInterface */ +/** @typedef { import("ipfsd-ctl/src/factory") } Factory */ /** - * @param {TestsInterface} common + * @param {Factory} common * @param {Object} options */ module.exports = (common, options) => { @@ -19,15 +19,9 @@ module.exports = (common, options) => { let ipfs - before(async function () { - // CI takes longer to instantiate the daemon, so we need to increase the - // timeout for the before step - this.timeout(60 * 1000) + before(async () => { ipfs = (await common.spawn()).api }) - ipfs = await common.setup() - }) - - after(() => common.teardown()) + after(() => common.clean()) it('should copy file, expect error', () => { const testDir = `/test-${hat()}` diff --git a/src/files-mfs/flush.js b/src/files-mfs/flush.js index 6c284df60..54c74cdcf 100644 --- a/src/files-mfs/flush.js +++ b/src/files-mfs/flush.js @@ -4,9 +4,9 @@ const hat = require('hat') const { getDescribe, getIt, expect } = require('../utils/mocha') -/** @typedef { import("ipfsd-ctl").TestsInterface } TestsInterface */ +/** @typedef { import("ipfsd-ctl/src/factory") } Factory */ /** - * @param {TestsInterface} common + * @param {Factory} common * @param {Object} options */ module.exports = (common, options) => { @@ -18,15 +18,9 @@ module.exports = (common, options) => { let ipfs - before(async function () { - // CI takes longer to instantiate the daemon, so we need to increase the - // timeout for the before step - this.timeout(60 * 1000) + before(async () => { ipfs = (await common.spawn()).api }) - ipfs = await common.setup() - }) - - after(() => common.teardown()) + after(() => common.clean()) it('should not flush not found file/dir, expect error', async () => { const testDir = `/test-${hat()}` diff --git a/src/files-mfs/ls-pull-stream.js b/src/files-mfs/ls-pull-stream.js index 3506cd55f..0674fa7b7 100644 --- a/src/files-mfs/ls-pull-stream.js +++ b/src/files-mfs/ls-pull-stream.js @@ -5,9 +5,9 @@ const hat = require('hat') const { getDescribe, getIt, expect } = require('../utils/mocha') const pullToPromise = require('pull-to-promise') -/** @typedef { import("ipfsd-ctl").TestsInterface } TestsInterface */ +/** @typedef { import("ipfsd-ctl/src/factory") } Factory */ /** - * @param {TestsInterface} common + * @param {Factory} common * @param {Object} options */ module.exports = (common, options) => { @@ -19,15 +19,9 @@ module.exports = (common, options) => { let ipfs - before(async function () { - // CI takes longer to instantiate the daemon, so we need to increase the - // timeout for the before step - this.timeout(60 * 1000) + before(async () => { ipfs = (await common.spawn()).api }) - ipfs = await common.setup() - }) - - after(() => common.teardown()) + after(() => common.clean()) it('should not ls not found file/dir, expect error', () => { const testDir = `/test-${hat()}` diff --git a/src/files-mfs/ls-readable-stream.js b/src/files-mfs/ls-readable-stream.js index 262b341fa..fab1c3ad6 100644 --- a/src/files-mfs/ls-readable-stream.js +++ b/src/files-mfs/ls-readable-stream.js @@ -5,9 +5,9 @@ const hat = require('hat') const { getDescribe, getIt, expect } = require('../utils/mocha') const getStream = require('get-stream') -/** @typedef { import("ipfsd-ctl").TestsInterface } TestsInterface */ +/** @typedef { import("ipfsd-ctl/src/factory") } Factory */ /** - * @param {TestsInterface} common + * @param {Factory} common * @param {Object} options */ module.exports = (common, options) => { @@ -19,15 +19,9 @@ module.exports = (common, options) => { let ipfs - before(async function () { - // CI takes longer to instantiate the daemon, so we need to increase the - // timeout for the before step - this.timeout(60 * 1000) + before(async () => { ipfs = (await common.spawn()).api }) - ipfs = await common.setup() - }) - - after(() => common.teardown()) + after(() => common.clean()) it('should not ls not found file/dir, expect error', () => { const testDir = `/test-${hat()}` diff --git a/src/files-mfs/ls.js b/src/files-mfs/ls.js index 0633d62d8..5497f49ab 100644 --- a/src/files-mfs/ls.js +++ b/src/files-mfs/ls.js @@ -5,9 +5,9 @@ const hat = require('hat') const { fixtures } = require('../files-regular/utils') const { getDescribe, getIt, expect } = require('../utils/mocha') -/** @typedef { import("ipfsd-ctl").TestsInterface } TestsInterface */ +/** @typedef { import("ipfsd-ctl/src/factory") } Factory */ /** - * @param {TestsInterface} common + * @param {Factory} common * @param {Object} options */ module.exports = (common, options) => { @@ -19,15 +19,9 @@ module.exports = (common, options) => { let ipfs - before(async function () { - // CI takes longer to instantiate the daemon, so we need to increase the - // timeout for the before step - this.timeout(60 * 1000) + before(async () => { ipfs = (await common.spawn()).api }) - ipfs = await common.setup() - }) - - after(() => common.teardown()) + after(() => common.clean()) it('should not ls not found file/dir, expect error', () => { const testDir = `/test-${hat()}` diff --git a/src/files-mfs/mkdir.js b/src/files-mfs/mkdir.js index e7524ac2f..0c35e5ec8 100644 --- a/src/files-mfs/mkdir.js +++ b/src/files-mfs/mkdir.js @@ -4,9 +4,9 @@ const hat = require('hat') const { getDescribe, getIt, expect } = require('../utils/mocha') -/** @typedef { import("ipfsd-ctl").TestsInterface } TestsInterface */ +/** @typedef { import("ipfsd-ctl/src/factory") } Factory */ /** - * @param {TestsInterface} common + * @param {Factory} common * @param {Object} options */ module.exports = (common, options) => { @@ -18,15 +18,9 @@ module.exports = (common, options) => { let ipfs - before(async function () { - // CI takes longer to instantiate the daemon, so we need to increase the - // timeout for the before step - this.timeout(60 * 1000) + before(async () => { ipfs = (await common.spawn()).api }) - ipfs = await common.setup() - }) - - after(() => common.teardown()) + after(() => common.clean()) it('should make directory on root', () => { const testDir = `/test-${hat()}` diff --git a/src/files-mfs/mv.js b/src/files-mfs/mv.js index 93ffd8e94..d5c9bcc62 100644 --- a/src/files-mfs/mv.js +++ b/src/files-mfs/mv.js @@ -4,9 +4,9 @@ const hat = require('hat') const { getDescribe, getIt, expect } = require('../utils/mocha') -/** @typedef { import("ipfsd-ctl").TestsInterface } TestsInterface */ +/** @typedef { import("ipfsd-ctl/src/factory") } Factory */ /** - * @param {TestsInterface} common + * @param {Factory} common * @param {Object} options */ module.exports = (common, options) => { @@ -18,19 +18,13 @@ module.exports = (common, options) => { let ipfs - before(async function () { - // CI takes longer to instantiate the daemon, so we need to increase the - // timeout for the before step - this.timeout(60 * 1000) - - ipfs = await common.setup() - }) + before(async () => { ipfs = (await common.spawn()).api }) before(async () => { await ipfs.files.mkdir('/test/lv1/lv2', { parents: true }) await ipfs.files.write('/test/a', Buffer.from('Hello, world!'), { create: true }) }) - after(() => common.teardown()) + after(() => common.clean()) it('should not move not found file/dir, expect error', () => { const testDir = `/test-${hat()}` diff --git a/src/files-mfs/read-pull-stream.js b/src/files-mfs/read-pull-stream.js index a34cf0c87..ccd0c0f9f 100644 --- a/src/files-mfs/read-pull-stream.js +++ b/src/files-mfs/read-pull-stream.js @@ -5,9 +5,9 @@ const hat = require('hat') const { getDescribe, getIt, expect } = require('../utils/mocha') const pullToPromise = require('pull-to-promise') -/** @typedef { import("ipfsd-ctl").TestsInterface } TestsInterface */ +/** @typedef { import("ipfsd-ctl/src/factory") } Factory */ /** - * @param {TestsInterface} common + * @param {Factory} common * @param {Object} options */ module.exports = (common, options) => { @@ -19,15 +19,9 @@ module.exports = (common, options) => { let ipfs - before(async function () { - // CI takes longer to instantiate the daemon, so we need to increase the - // timeout for the before step - this.timeout(60 * 1000) + before(async () => { ipfs = (await common.spawn()).api }) - ipfs = await common.setup() - }) - - after(() => common.teardown()) + after(() => common.clean()) it('should not read not found, expect error', () => { const testDir = `/test-${hat()}` diff --git a/src/files-mfs/read-readable-stream.js b/src/files-mfs/read-readable-stream.js index acd14c2a4..c3f87101f 100644 --- a/src/files-mfs/read-readable-stream.js +++ b/src/files-mfs/read-readable-stream.js @@ -5,9 +5,9 @@ const hat = require('hat') const { getDescribe, getIt, expect } = require('../utils/mocha') const getStream = require('get-stream') -/** @typedef { import("ipfsd-ctl").TestsInterface } TestsInterface */ +/** @typedef { import("ipfsd-ctl/src/factory") } Factory */ /** - * @param {TestsInterface} common + * @param {Factory} common * @param {Object} options */ module.exports = (common, options) => { @@ -19,15 +19,9 @@ module.exports = (common, options) => { let ipfs - before(async function () { - // CI takes longer to instantiate the daemon, so we need to increase the - // timeout for the before step - this.timeout(60 * 1000) + before(async () => { ipfs = (await common.spawn()).api }) - ipfs = await common.setup() - }) - - after(() => common.teardown()) + after(() => common.clean()) it('should not read not found, expect error', () => { const testDir = `/test-${hat()}` diff --git a/src/files-mfs/read.js b/src/files-mfs/read.js index 0d316f4be..46467768b 100644 --- a/src/files-mfs/read.js +++ b/src/files-mfs/read.js @@ -5,9 +5,9 @@ const hat = require('hat') const { fixtures } = require('../files-regular/utils') const { getDescribe, getIt, expect } = require('../utils/mocha') -/** @typedef { import("ipfsd-ctl").TestsInterface } TestsInterface */ +/** @typedef { import("ipfsd-ctl/src/factory") } Factory */ /** - * @param {TestsInterface} common + * @param {Factory} common * @param {Object} options */ module.exports = (common, options) => { @@ -19,15 +19,9 @@ module.exports = (common, options) => { let ipfs - before(async function () { - // CI takes longer to instantiate the daemon, so we need to increase the - // timeout for the before step - this.timeout(60 * 1000) + before(async () => { ipfs = (await common.spawn()).api }) - ipfs = await common.setup() - }) - - after(() => common.teardown()) + after(() => common.clean()) it('should not read not found, expect error', () => { const testDir = `/test-${hat()}` diff --git a/src/files-mfs/rm.js b/src/files-mfs/rm.js index 84dfbdefc..9a91e0d3c 100644 --- a/src/files-mfs/rm.js +++ b/src/files-mfs/rm.js @@ -4,9 +4,9 @@ const hat = require('hat') const { getDescribe, getIt, expect } = require('../utils/mocha') -/** @typedef { import("ipfsd-ctl").TestsInterface } TestsInterface */ +/** @typedef { import("ipfsd-ctl/src/factory") } Factory */ /** - * @param {TestsInterface} common + * @param {Factory} common * @param {Object} options */ module.exports = (common, options) => { @@ -18,15 +18,9 @@ module.exports = (common, options) => { let ipfs - before(async function () { - // CI takes longer to instantiate the daemon, so we need to increase the - // timeout for the before step - this.timeout(60 * 1000) + before(async () => { ipfs = (await common.spawn()).api }) - ipfs = await common.setup() - }) - - after(() => common.teardown()) + after(() => common.clean()) it('should not remove not found file/dir, expect error', () => { const testDir = `/test-${hat()}` diff --git a/src/files-mfs/stat.js b/src/files-mfs/stat.js index 6afb87e3d..9640b30d6 100644 --- a/src/files-mfs/stat.js +++ b/src/files-mfs/stat.js @@ -5,9 +5,9 @@ const hat = require('hat') const { fixtures } = require('../files-regular/utils') const { getDescribe, getIt, expect } = require('../utils/mocha') -/** @typedef { import("ipfsd-ctl").TestsInterface } TestsInterface */ +/** @typedef { import("ipfsd-ctl/src/factory") } Factory */ /** - * @param {TestsInterface} common + * @param {Factory} common * @param {Object} options */ module.exports = (common, options) => { @@ -19,16 +19,10 @@ module.exports = (common, options) => { let ipfs - before(async function () { - // CI takes longer to instantiate the daemon, so we need to increase the - // timeout for the before step - this.timeout(60 * 1000) - - ipfs = await common.setup() - }) + before(async () => { ipfs = (await common.spawn()).api }) before(async () => { await ipfs.add(fixtures.smallFile.data) }) - after(() => common.teardown()) + after(() => common.clean()) it('should not stat not found file/dir, expect error', function () { const testDir = `/test-${hat()}` diff --git a/src/files-mfs/write.js b/src/files-mfs/write.js index d7e2c74ed..0fb3a72eb 100644 --- a/src/files-mfs/write.js +++ b/src/files-mfs/write.js @@ -4,9 +4,9 @@ const hat = require('hat') const { getDescribe, getIt, expect } = require('../utils/mocha') -/** @typedef { import("ipfsd-ctl").TestsInterface } TestsInterface */ +/** @typedef { import("ipfsd-ctl/src/factory") } Factory */ /** - * @param {TestsInterface} common + * @param {Factory} common * @param {Object} options */ module.exports = (common, options) => { @@ -18,15 +18,9 @@ module.exports = (common, options) => { let ipfs - before(async function () { - // CI takes longer to instantiate the daemon, so we need to increase the - // timeout for the before step - this.timeout(60 * 1000) + before(async () => { ipfs = (await common.spawn()).api }) - ipfs = await common.setup() - }) - - after(() => common.teardown()) + after(() => common.clean()) it('should not write to non existent file, expect error', function () { const testDir = `/test-${hat()}` diff --git a/src/files-regular/add-from-fs.js b/src/files-regular/add-from-fs.js index bd058986d..a20a01718 100644 --- a/src/files-regular/add-from-fs.js +++ b/src/files-regular/add-from-fs.js @@ -7,9 +7,9 @@ const { getDescribe, getIt, expect } = require('../utils/mocha') const fs = require('fs') const os = require('os') -/** @typedef { import("ipfsd-ctl").TestsInterface } TestsInterface */ +/** @typedef { import("ipfsd-ctl/src/factory") } Factory */ /** - * @param {TestsInterface} common + * @param {Factory} common * @param {Object} options */ module.exports = (common, options) => { @@ -22,15 +22,9 @@ module.exports = (common, options) => { const fixturesPath = path.join(__dirname, '../../test/fixtures') let ipfs - before(async function () { - // CI takes longer to instantiate the daemon, so we need to increase the - // timeout for the before step - this.timeout(60 * 1000) + before(async () => { ipfs = (await common.spawn()).api }) - ipfs = await common.setup() - }) - - after(() => common.teardown()) + after(() => common.clean()) it('should add a directory from the file system', async () => { const filesPath = path.join(fixturesPath, 'test-folder') diff --git a/src/files-regular/add-from-stream.js b/src/files-regular/add-from-stream.js index 0dbedcc55..5762cb70a 100644 --- a/src/files-regular/add-from-stream.js +++ b/src/files-regular/add-from-stream.js @@ -5,9 +5,9 @@ const { Readable } = require('readable-stream') const { getDescribe, getIt, expect } = require('../utils/mocha') const { fixtures } = require('./utils') -/** @typedef { import("ipfsd-ctl").TestsInterface } TestsInterface */ +/** @typedef { import("ipfsd-ctl/src/factory") } Factory */ /** - * @param {TestsInterface} common + * @param {Factory} common * @param {Object} options */ module.exports = (common, options) => { @@ -19,15 +19,9 @@ module.exports = (common, options) => { let ipfs - before(async function () { - // CI takes longer to instantiate the daemon, so we need to increase the - // timeout for the before step - this.timeout(60 * 1000) + before(async () => { ipfs = (await common.spawn()).api }) - ipfs = await common.setup() - }) - - after(() => common.teardown()) + after(() => common.clean()) it('should add from a stream', async () => { const stream = new Readable({ diff --git a/src/files-regular/add-from-url.js b/src/files-regular/add-from-url.js index e6b093712..0fa60577c 100644 --- a/src/files-regular/add-from-url.js +++ b/src/files-regular/add-from-url.js @@ -5,9 +5,9 @@ const pTimeout = require('p-timeout') const { getDescribe, getIt, expect } = require('../utils/mocha') const { echoUrl, redirectUrl } = require('../utils/echo-http-server') -/** @typedef { import("ipfsd-ctl").TestsInterface } TestsInterface */ +/** @typedef { import("ipfsd-ctl/src/factory") } Factory */ /** - * @param {TestsInterface} common + * @param {Factory} common * @param {Object} options */ module.exports = (common, options) => { @@ -19,15 +19,9 @@ module.exports = (common, options) => { let ipfs - before(async function () { - // CI takes longer to instantiate the daemon, so we need to increase the - // timeout for the before step - this.timeout(60 * 1000) + before(async () => { ipfs = (await common.spawn()).api }) - ipfs = await common.setup() - }) - - after(() => common.teardown()) + after(() => common.clean()) it('should add from a HTTP URL', async () => { const text = `TEST${Date.now()}` diff --git a/src/files-regular/add-pull-stream.js b/src/files-regular/add-pull-stream.js index 9b5c79d05..dd408114c 100644 --- a/src/files-regular/add-pull-stream.js +++ b/src/files-regular/add-pull-stream.js @@ -6,9 +6,9 @@ const pull = require('pull-stream') const { getDescribe, getIt, expect } = require('../utils/mocha') const pullToPromise = require('pull-to-promise') -/** @typedef { import("ipfsd-ctl").TestsInterface } TestsInterface */ +/** @typedef { import("ipfsd-ctl/src/factory") } Factory */ /** - * @param {TestsInterface} common + * @param {Factory} common * @param {Object} options */ module.exports = (common, options) => { @@ -20,15 +20,9 @@ module.exports = (common, options) => { let ipfs - before(async function () { - // CI takes longer to instantiate the daemon, so we need to increase the - // timeout for the before step - this.timeout(60 * 1000) + before(async () => { ipfs = (await common.spawn()).api }) - ipfs = await common.setup() - }) - - after(() => common.teardown()) + after(() => common.clean()) it('should add pull stream of valid files and dirs', async function () { const content = (name) => ({ diff --git a/src/files-regular/add-readable-stream.js b/src/files-regular/add-readable-stream.js index 43eb2b5f7..f2a32c872 100644 --- a/src/files-regular/add-readable-stream.js +++ b/src/files-regular/add-readable-stream.js @@ -5,9 +5,9 @@ const { fixtures } = require('./utils') const { getDescribe, getIt, expect } = require('../utils/mocha') const getStream = require('get-stream') -/** @typedef { import("ipfsd-ctl").TestsInterface } TestsInterface */ +/** @typedef { import("ipfsd-ctl/src/factory") } Factory */ /** - * @param {TestsInterface} common + * @param {Factory} common * @param {Object} options */ module.exports = (common, options) => { @@ -19,15 +19,9 @@ module.exports = (common, options) => { let ipfs - before(async function () { - // CI takes longer to instantiate the daemon, so we need to increase the - // timeout for the before step - this.timeout(60 * 1000) + before(async () => { ipfs = (await common.spawn()).api }) - ipfs = await common.setup() - }) - - after(() => common.teardown()) + after(() => common.clean()) it('should add readable stream of valid files and dirs', async function () { const content = (name) => ({ diff --git a/src/files-regular/add.js b/src/files-regular/add.js index 71a22c60d..c1fbaaa79 100644 --- a/src/files-regular/add.js +++ b/src/files-regular/add.js @@ -8,9 +8,9 @@ const expectTimeout = require('../utils/expect-timeout') const { getDescribe, getIt, expect } = require('../utils/mocha') const { supportsFileReader } = require('ipfs-utils/src/supports') -/** @typedef { import("ipfsd-ctl").TestsInterface } TestsInterface */ +/** @typedef { import("ipfsd-ctl/src/factory") } Factory */ /** - * @param {TestsInterface} common + * @param {Factory} common * @param {Object} options */ module.exports = (common, options) => { @@ -22,15 +22,9 @@ module.exports = (common, options) => { let ipfs - before(async function () { - // CI takes longer to instantiate the daemon, so we need to increase the - // timeout for the before step - this.timeout(60 * 1000) + before(async () => { ipfs = (await common.spawn()).api }) - ipfs = await common.setup() - }) - - after(() => common.teardown()) + after(() => common.clean()) it('should add a File', async function () { if (!supportsFileReader) return this.skip('skip in node') diff --git a/src/files-regular/cat-pull-stream.js b/src/files-regular/cat-pull-stream.js index c8b72823a..70b4cedc4 100644 --- a/src/files-regular/cat-pull-stream.js +++ b/src/files-regular/cat-pull-stream.js @@ -5,9 +5,9 @@ const { fixtures } = require('./utils') const { getDescribe, getIt, expect } = require('../utils/mocha') const pullToPromise = require('pull-to-promise') -/** @typedef { import("ipfsd-ctl").TestsInterface } TestsInterface */ +/** @typedef { import("ipfsd-ctl/src/factory") } Factory */ /** - * @param {TestsInterface} common + * @param {Factory} common * @param {Object} options */ module.exports = (common, options) => { @@ -19,16 +19,10 @@ module.exports = (common, options) => { let ipfs - before(async function () { - // CI takes longer to instantiate the daemon, so we need to increase the - // timeout for the before step - this.timeout(60 * 1000) - - ipfs = await common.setup() - }) + before(async () => { ipfs = (await common.spawn()).api }) before(() => ipfs.add(fixtures.smallFile.data)) - after(() => common.teardown()) + after(() => common.clean()) it('should return a Pull Stream for a CID', async () => { const stream = ipfs.catPullStream(fixtures.smallFile.cid) diff --git a/src/files-regular/cat-readable-stream.js b/src/files-regular/cat-readable-stream.js index 2eced04c8..85a935c8c 100644 --- a/src/files-regular/cat-readable-stream.js +++ b/src/files-regular/cat-readable-stream.js @@ -5,9 +5,9 @@ const { fixtures } = require('./utils') const { getDescribe, getIt, expect } = require('../utils/mocha') const getStream = require('get-stream') -/** @typedef { import("ipfsd-ctl").TestsInterface } TestsInterface */ +/** @typedef { import("ipfsd-ctl/src/factory") } Factory */ /** - * @param {TestsInterface} common + * @param {Factory} common * @param {Object} options */ module.exports = (common, options) => { @@ -19,17 +19,13 @@ module.exports = (common, options) => { let ipfs - before(async function () { - // CI takes longer to instantiate the daemon, so we need to increase the - // timeout for the before step - this.timeout(60 * 1000) - - ipfs = await common.setup() + before(async () => { + ipfs = (await common.spawn()).api await ipfs.add(fixtures.bigFile.data) await ipfs.add(fixtures.smallFile.data) }) - after(() => common.teardown()) + after(() => common.clean()) it('should return a Readable Stream for a CID', async () => { const stream = ipfs.catReadableStream(fixtures.bigFile.cid) diff --git a/src/files-regular/cat.js b/src/files-regular/cat.js index ddf9afa20..f34297594 100644 --- a/src/files-regular/cat.js +++ b/src/files-regular/cat.js @@ -6,9 +6,9 @@ const bs58 = require('bs58') const CID = require('cids') const { getDescribe, getIt, expect } = require('../utils/mocha') -/** @typedef { import("ipfsd-ctl").TestsInterface } TestsInterface */ +/** @typedef { import("ipfsd-ctl/src/factory") } Factory */ /** - * @param {TestsInterface} common + * @param {Factory} common * @param {Object} options */ module.exports = (common, options) => { @@ -20,15 +20,9 @@ module.exports = (common, options) => { let ipfs - before(async function () { - // CI takes longer to instantiate the daemon, so we need to increase the - // timeout for the before step - this.timeout(60 * 1000) + before(async () => { ipfs = (await common.spawn()).api }) - ipfs = await common.setup() - }) - - after(() => common.teardown()) + after(() => common.clean()) before(() => Promise.all([ ipfs.add(fixtures.smallFile.data), diff --git a/src/files-regular/get-pull-stream.js b/src/files-regular/get-pull-stream.js index 9ef7a710e..070ebfba2 100644 --- a/src/files-regular/get-pull-stream.js +++ b/src/files-regular/get-pull-stream.js @@ -5,9 +5,9 @@ const { fixtures } = require('./utils') const { getDescribe, getIt, expect } = require('../utils/mocha') const pullToPromise = require('pull-to-promise') -/** @typedef { import("ipfsd-ctl").TestsInterface } TestsInterface */ +/** @typedef { import("ipfsd-ctl/src/factory") } Factory */ /** - * @param {TestsInterface} common + * @param {Factory} common * @param {Object} options */ module.exports = (common, options) => { @@ -19,17 +19,11 @@ module.exports = (common, options) => { let ipfs - before(async function () { - // CI takes longer to instantiate the daemon, so we need to increase the - // timeout for the before step - this.timeout(60 * 1000) - - ipfs = await common.setup() - }) + before(async () => { ipfs = (await common.spawn()).api }) before(() => ipfs.add(fixtures.smallFile.data)) - after(() => common.teardown()) + after(() => common.clean()) it('should return a Pull Stream of Pull Streams', async () => { const stream = ipfs.getPullStream(fixtures.smallFile.cid) diff --git a/src/files-regular/get-readable-stream.js b/src/files-regular/get-readable-stream.js index d0ae755bf..7a66915a1 100644 --- a/src/files-regular/get-readable-stream.js +++ b/src/files-regular/get-readable-stream.js @@ -6,9 +6,9 @@ const through = require('through2') const { getDescribe, getIt, expect } = require('../utils/mocha') const getStream = require('get-stream') -/** @typedef { import("ipfsd-ctl").TestsInterface } TestsInterface */ +/** @typedef { import("ipfsd-ctl/src/factory") } Factory */ /** - * @param {TestsInterface} common + * @param {Factory} common * @param {Object} options */ module.exports = (common, options) => { @@ -20,16 +20,12 @@ module.exports = (common, options) => { let ipfs - before(async function () { - // CI takes longer to instantiate the daemon, so we need to increase the - // timeout for the before step - this.timeout(60 * 1000) - - ipfs = await common.setup() + before(async () => { + ipfs = (await common.spawn()).api await ipfs.add(fixtures.smallFile.data) }) - after(() => common.teardown()) + after(() => common.clean()) it('should return a Readable Stream of Readable Streams', async () => { const stream = ipfs.getReadableStream(fixtures.smallFile.cid) diff --git a/src/files-regular/get.js b/src/files-regular/get.js index 2491eed7e..8f15d0a92 100644 --- a/src/files-regular/get.js +++ b/src/files-regular/get.js @@ -6,9 +6,9 @@ const bs58 = require('bs58') const CID = require('cids') const { getDescribe, getIt, expect } = require('../utils/mocha') -/** @typedef { import("ipfsd-ctl").TestsInterface } TestsInterface */ +/** @typedef { import("ipfsd-ctl/src/factory") } Factory */ /** - * @param {TestsInterface} common + * @param {Factory} common * @param {Object} options */ module.exports = (common, options) => { @@ -20,17 +20,13 @@ module.exports = (common, options) => { let ipfs - before(async function () { - // CI takes longer to instantiate the daemon, so we need to increase the - // timeout for the before step - this.timeout(60 * 1000) - - ipfs = await common.setup() + before(async () => { + ipfs = (await common.spawn()).api await ipfs.add(fixtures.smallFile.data) await ipfs.add(fixtures.bigFile.data) }) - after(() => common.teardown()) + after(() => common.clean()) it('should get with a base58 encoded multihash', async () => { const files = await ipfs.get(fixtures.smallFile.cid) diff --git a/src/files-regular/ls-pull-stream.js b/src/files-regular/ls-pull-stream.js index 8d9491a28..699574fa1 100644 --- a/src/files-regular/ls-pull-stream.js +++ b/src/files-regular/ls-pull-stream.js @@ -5,9 +5,9 @@ const { fixtures } = require('./utils') const { getDescribe, getIt, expect } = require('../utils/mocha') const pullToPromise = require('pull-to-promise') -/** @typedef { import("ipfsd-ctl").TestsInterface } TestsInterface */ +/** @typedef { import("ipfsd-ctl/src/factory") } Factory */ /** - * @param {TestsInterface} common + * @param {Factory} common * @param {Object} options */ module.exports = (common, options) => { @@ -19,15 +19,11 @@ module.exports = (common, options) => { let ipfs - before(async function () { - // CI takes longer to instantiate the daemon, so we need to increase the - // timeout for the before step - this.timeout(60 * 1000) - - ipfs = await common.setup() + before(async () => { + ipfs = (await common.spawn()).api }) - after(() => common.teardown()) + after(() => common.clean()) it('should pull stream ls with a base58 encoded CID', async function () { const content = (name) => ({ diff --git a/src/files-regular/ls-readable-stream.js b/src/files-regular/ls-readable-stream.js index d3b6f96d4..42e39fe01 100644 --- a/src/files-regular/ls-readable-stream.js +++ b/src/files-regular/ls-readable-stream.js @@ -5,9 +5,9 @@ const { fixtures } = require('./utils') const { getDescribe, getIt, expect } = require('../utils/mocha') const getStream = require('get-stream') -/** @typedef { import("ipfsd-ctl").TestsInterface } TestsInterface */ +/** @typedef { import("ipfsd-ctl/src/factory") } Factory */ /** - * @param {TestsInterface} common + * @param {Factory} common * @param {Object} options */ module.exports = (common, options) => { @@ -19,15 +19,11 @@ module.exports = (common, options) => { let ipfs - before(async function () { - // CI takes longer to instantiate the daemon, so we need to increase the - // timeout for the before step - this.timeout(60 * 1000) - - ipfs = await common.setup() + before(async () => { + ipfs = (await common.spawn()).api }) - after(() => common.teardown()) + after(() => common.clean()) it('should readable stream ls with a base58 encoded CID', async function () { const content = (name) => ({ diff --git a/src/files-regular/ls.js b/src/files-regular/ls.js index af3721c63..4c3654870 100644 --- a/src/files-regular/ls.js +++ b/src/files-regular/ls.js @@ -7,9 +7,9 @@ const CID = require('cids') const randomName = prefix => `${prefix}${Math.round(Math.random() * 1000)}` -/** @typedef { import("ipfsd-ctl").TestsInterface } TestsInterface */ +/** @typedef { import("ipfsd-ctl/src/factory") } Factory */ /** - * @param {TestsInterface} common + * @param {Factory} common * @param {Object} options */ module.exports = (common, options) => { @@ -21,15 +21,11 @@ module.exports = (common, options) => { let ipfs - before(async function () { - // CI takes longer to instantiate the daemon, so we need to increase the - // timeout for the before step - this.timeout(60 * 1000) - - ipfs = await common.setup() + before(async () => { + ipfs = (await common.spawn()).api }) - after(() => common.teardown()) + after(() => common.clean()) it('should ls with a base58 encoded CID', async function () { const content = (name) => ({ diff --git a/src/files-regular/refs-local-tests.js b/src/files-regular/refs-local-tests.js index 1d3a29620..663a8e26f 100644 --- a/src/files-regular/refs-local-tests.js +++ b/src/files-regular/refs-local-tests.js @@ -4,9 +4,9 @@ const { fixtures } = require('./utils') const { getDescribe, getIt, expect } = require('../utils/mocha') -/** @typedef { import("ipfsd-ctl").TestsInterface } TestsInterface */ +/** @typedef { import("ipfsd-ctl/src/factory") } Factory */ /** - * @param {TestsInterface} common + * @param {Factory} common * @param {*} suiteName * @param {*} ipfsRefsLocal * @param {Object} options @@ -20,15 +20,11 @@ module.exports = (common, suiteName, ipfsRefsLocal, options) => { let ipfs - before(async function () { - // CI takes longer to instantiate the daemon, so we need to increase the - // timeout for the before step - this.timeout(60 * 1000) - - ipfs = await common.setup() + before(async () => { + ipfs = (await common.spawn()).api }) - after(() => common.teardown()) + after(() => common.clean()) it('should get local refs', async function () { const content = (name) => ({ diff --git a/src/files-regular/refs-tests.js b/src/files-regular/refs-tests.js index caa675470..d974614f1 100644 --- a/src/files-regular/refs-tests.js +++ b/src/files-regular/refs-tests.js @@ -7,9 +7,9 @@ const { getDescribe, getIt, expect } = require('../utils/mocha') const loadFixture = require('aegir/fixtures') const CID = require('cids') -/** @typedef { import("ipfsd-ctl").TestsInterface } TestsInterface */ +/** @typedef { import("ipfsd-ctl/src/factory") } Factory */ /** - * @param {TestsInterface} common + * @param {Factory} common * @param {*} suiteName * @param {*} ipfsRefs * @param {Object} options @@ -23,12 +23,8 @@ module.exports = (common, suiteName, ipfsRefs, options) => { let ipfs, pbRootCb, dagRootCid - before(async function () { - // CI takes longer to instantiate the daemon, so we need to increase the - // timeout for the before step - this.timeout(60 * 1000) - - ipfs = await common.setup() + before(async () => { + ipfs = (await common.spawn()).api }) before(async function () { @@ -41,7 +37,7 @@ module.exports = (common, suiteName, ipfsRefs, options) => { dagRootCid = cid }) - after(() => common.teardown()) + after(() => common.clean()) for (const [name, options] of Object.entries(getRefsTests())) { const { path, params, expected, expectError, expectTimeout } = options diff --git a/src/key/export.js b/src/key/export.js index f122ebf93..48fdb731b 100644 --- a/src/key/export.js +++ b/src/key/export.js @@ -4,9 +4,9 @@ const hat = require('hat') const { getDescribe, getIt, expect } = require('../utils/mocha') -/** @typedef { import("ipfsd-ctl").TestsInterface } TestsInterface */ +/** @typedef { import("ipfsd-ctl/src/factory") } Factory */ /** - * @param {TestsInterface} common + * @param {Factory} common * @param {Object} options */ module.exports = (common, options) => { @@ -16,15 +16,11 @@ module.exports = (common, options) => { describe('.key.export', () => { let ipfs - before(async function () { - // CI takes longer to instantiate the daemon, so we need to increase the - // timeout for the before step - this.timeout(60 * 1000) - - ipfs = await common.setup() + before(async () => { + ipfs = (await common.spawn()).api }) - after(() => common.teardown()) + after(() => common.clean()) it('should export "self" key', async function () { const pem = await ipfs.key.export('self', hat()) diff --git a/src/key/gen.js b/src/key/gen.js index dc85c6399..c6afda3c0 100644 --- a/src/key/gen.js +++ b/src/key/gen.js @@ -4,9 +4,9 @@ const hat = require('hat') const { getDescribe, getIt, expect } = require('../utils/mocha') -/** @typedef { import("ipfsd-ctl").TestsInterface } TestsInterface */ +/** @typedef { import("ipfsd-ctl/src/factory") } Factory */ /** - * @param {TestsInterface} common + * @param {Factory} common * @param {Object} options */ module.exports = (common, options) => { @@ -20,15 +20,11 @@ module.exports = (common, options) => { let ipfs - before(async function () { - // CI takes longer to instantiate the daemon, so we need to increase the - // timeout for the before step - this.timeout(60 * 1000) - - ipfs = await common.setup() + before(async () => { + ipfs = (await common.spawn()).api }) - after(() => common.teardown()) + after(() => common.clean()) keyTypes.forEach((kt) => { it(`should generate a new ${kt.type} key`, async function () { diff --git a/src/key/import.js b/src/key/import.js index 8272014cf..8fc2162fd 100644 --- a/src/key/import.js +++ b/src/key/import.js @@ -4,9 +4,9 @@ const hat = require('hat') const { getDescribe, getIt, expect } = require('../utils/mocha') -/** @typedef { import("ipfsd-ctl").TestsInterface } TestsInterface */ +/** @typedef { import("ipfsd-ctl/src/factory") } Factory */ /** - * @param {TestsInterface} common + * @param {Factory} common * @param {Object} options */ module.exports = (common, options) => { @@ -16,15 +16,11 @@ module.exports = (common, options) => { describe('.key.import', () => { let ipfs - before(async function () { - // CI takes longer to instantiate the daemon, so we need to increase the - // timeout for the before step - this.timeout(60 * 1000) - - ipfs = await common.setup() + before(async () => { + ipfs = (await common.spawn()).api }) - after(() => common.teardown()) + after(() => common.clean()) it('should import an exported key', async () => { const password = hat() diff --git a/src/key/list.js b/src/key/list.js index 762fc5e07..7cf88bef6 100644 --- a/src/key/list.js +++ b/src/key/list.js @@ -5,9 +5,9 @@ const pTimes = require('p-times') const hat = require('hat') const { getDescribe, getIt, expect } = require('../utils/mocha') -/** @typedef { import("ipfsd-ctl").TestsInterface } TestsInterface */ +/** @typedef { import("ipfsd-ctl/src/factory") } Factory */ /** - * @param {TestsInterface} common + * @param {Factory} common * @param {Object} options */ module.exports = (common, options) => { @@ -17,15 +17,11 @@ module.exports = (common, options) => { describe('.key.list', () => { let ipfs - before(async function () { - // CI takes longer to instantiate the daemon, so we need to increase the - // timeout for the before step - this.timeout(60 * 1000) - - ipfs = await common.setup() + before(async () => { + ipfs = (await common.spawn()).api }) - after(() => common.teardown()) + after(() => common.clean()) it('should list all the keys', async function () { this.timeout(60 * 1000) diff --git a/src/key/rename.js b/src/key/rename.js index 6d57a371b..d18c2a285 100644 --- a/src/key/rename.js +++ b/src/key/rename.js @@ -4,9 +4,9 @@ const hat = require('hat') const { getDescribe, getIt, expect } = require('../utils/mocha') -/** @typedef { import("ipfsd-ctl").TestsInterface } TestsInterface */ +/** @typedef { import("ipfsd-ctl/src/factory") } Factory */ /** - * @param {TestsInterface} common + * @param {Factory} common * @param {Object} options */ module.exports = (common, options) => { @@ -16,15 +16,11 @@ module.exports = (common, options) => { describe('.key.rename', () => { let ipfs - before(async function () { - // CI takes longer to instantiate the daemon, so we need to increase the - // timeout for the before step - this.timeout(60 * 1000) - - ipfs = await common.setup() + before(async () => { + ipfs = (await common.spawn()).api }) - after(() => common.teardown()) + after(() => common.clean()) it('should rename a key', async function () { this.timeout(30 * 1000) diff --git a/src/key/rm.js b/src/key/rm.js index 59f46ca38..8e86c1e46 100644 --- a/src/key/rm.js +++ b/src/key/rm.js @@ -4,9 +4,9 @@ const hat = require('hat') const { getDescribe, getIt, expect } = require('../utils/mocha') -/** @typedef { import("ipfsd-ctl").TestsInterface } TestsInterface */ +/** @typedef { import("ipfsd-ctl/src/factory") } Factory */ /** - * @param {TestsInterface} common + * @param {Factory} common * @param {Object} options */ module.exports = (common, options) => { @@ -16,15 +16,11 @@ module.exports = (common, options) => { describe('.key.rm', () => { let ipfs - before(async function () { - // CI takes longer to instantiate the daemon, so we need to increase the - // timeout for the before step - this.timeout(60 * 1000) - - ipfs = await common.setup() + before(async () => { + ipfs = (await common.spawn()).api }) - after(() => common.teardown()) + after(() => common.clean()) it('should rm a key', async function () { this.timeout(30 * 1000) diff --git a/src/miscellaneous/dns.js b/src/miscellaneous/dns.js index d7f478cb5..585557c15 100644 --- a/src/miscellaneous/dns.js +++ b/src/miscellaneous/dns.js @@ -3,9 +3,9 @@ const { getDescribe, getIt, expect } = require('../utils/mocha') -/** @typedef { import("ipfsd-ctl").TestsInterface } TestsInterface */ +/** @typedef { import("ipfsd-ctl/src/factory") } Factory */ /** - * @param {TestsInterface} common + * @param {Factory} common * @param {Object} options */ module.exports = (common, options) => { @@ -17,15 +17,11 @@ module.exports = (common, options) => { this.retries(3) let ipfs - before(async function () { - // CI takes longer to instantiate the daemon, so we need to increase the - // timeout for the before step - this.timeout(60 * 1000) - - ipfs = await common.setup() + before(async () => { + ipfs = (await common.spawn()).api }) - after(() => common.teardown()) + after(() => common.clean()) it('should non-recursively resolve ipfs.io', async () => { const res = await ipfs.dns('ipfs.io', { recursive: false }) diff --git a/src/miscellaneous/id.js b/src/miscellaneous/id.js index cdf2f0ef3..3d25a045e 100644 --- a/src/miscellaneous/id.js +++ b/src/miscellaneous/id.js @@ -3,9 +3,9 @@ const { getDescribe, getIt, expect } = require('../utils/mocha') -/** @typedef { import("ipfsd-ctl").TestsInterface } TestsInterface */ +/** @typedef { import("ipfsd-ctl/src/factory") } Factory */ /** - * @param {TestsInterface} common + * @param {Factory} common * @param {Object} options */ module.exports = (common, options) => { @@ -17,10 +17,10 @@ module.exports = (common, options) => { let ipfs before(async () => { - ipfs = await common.setup() + ipfs = (await common.spawn()).api }) - after(() => common.teardown()) + after(() => common.clean()) it('should get the node ID', async () => { const res = await ipfs.id() diff --git a/src/miscellaneous/resolve.js b/src/miscellaneous/resolve.js index 8d271ef17..ccf4851be 100644 --- a/src/miscellaneous/resolve.js +++ b/src/miscellaneous/resolve.js @@ -7,9 +7,9 @@ const hat = require('hat') const multibase = require('multibase') const { getDescribe, getIt, expect } = require('../utils/mocha') -/** @typedef { import("ipfsd-ctl").TestsInterface } TestsInterface */ +/** @typedef { import("ipfsd-ctl/src/factory") } Factory */ /** - * @param {TestsInterface} common + * @param {Factory} common * @param {Object} options */ module.exports = (common, options) => { @@ -21,10 +21,10 @@ module.exports = (common, options) => { let ipfs before(async () => { - ipfs = await common.setup() + ipfs = (await common.spawn()).api }) - after(() => common.teardown()) + after(() => common.clean()) it('should resolve an IPFS hash', async () => { const content = loadFixture('test/fixtures/testfile.txt', 'interface-ipfs-core') @@ -81,7 +81,7 @@ module.exports = (common, options) => { it('should resolve IPNS link recursively', async function () { this.timeout(20 * 1000) - const node = await common.setup({ type: 'go' }) + const node = (await common.spawn({ type: 'go' })).api 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 }) diff --git a/src/miscellaneous/stop.js b/src/miscellaneous/stop.js index 7f1d8458b..b6f3bd3b8 100644 --- a/src/miscellaneous/stop.js +++ b/src/miscellaneous/stop.js @@ -3,9 +3,9 @@ const { getDescribe, getIt, expect } = require('../utils/mocha') -/** @typedef { import("ipfsd-ctl").TestsInterface } TestsInterface */ +/** @typedef { import("ipfsd-ctl/src/factory") } Factory */ /** - * @param {TestsInterface} common + * @param {Factory} common * @param {Object} options */ module.exports = (common, options) => { @@ -16,7 +16,7 @@ module.exports = (common, options) => { this.timeout(60 * 1000) it('should stop the node', async () => { - const ipfs = await common.node() + const ipfs = await common.spawn() await ipfs.stop() // Trying to stop an already stopped node should return an error diff --git a/src/miscellaneous/version.js b/src/miscellaneous/version.js index 6235470f7..82349177b 100644 --- a/src/miscellaneous/version.js +++ b/src/miscellaneous/version.js @@ -3,9 +3,9 @@ const { getDescribe, getIt, expect } = require('../utils/mocha') -/** @typedef { import("ipfsd-ctl").TestsInterface } TestsInterface */ +/** @typedef { import("ipfsd-ctl/src/factory") } Factory */ /** - * @param {TestsInterface} common + * @param {Factory} common * @param {Object} options */ module.exports = (common, options) => { @@ -15,15 +15,11 @@ module.exports = (common, options) => { describe('.version', () => { let ipfs - before(async function () { - // CI takes longer to instantiate the daemon, so we need to increase the - // timeout for the before step - this.timeout(60 * 1000) - - ipfs = await common.setup() + before(async () => { + ipfs = (await common.spawn()).api }) - after(() => common.teardown()) + after(() => common.clean()) it('should get the node version', async () => { const result = await ipfs.version() diff --git a/src/name-pubsub/cancel.js b/src/name-pubsub/cancel.js index 934aaa279..30cf5e81e 100644 --- a/src/name-pubsub/cancel.js +++ b/src/name-pubsub/cancel.js @@ -6,9 +6,9 @@ const { promisify } = require('es6-promisify') const { getDescribe, getIt, expect } = require('../utils/mocha') -/** @typedef { import("ipfsd-ctl").TestsInterface } TestsInterface */ +/** @typedef { import("ipfsd-ctl/src/factory") } Factory */ /** - * @param {TestsInterface} common + * @param {Factory} common * @param {Object} options */ module.exports = (common, options) => { @@ -19,16 +19,12 @@ module.exports = (common, options) => { let ipfs let nodeId - before(async function () { - // CI takes longer to instantiate the daemon, so we need to increase the - // timeout for the before step - this.timeout(60 * 1000) - - ipfs = await common.setup() + before(async () => { + ipfs = (await common.spawn()).api nodeId = ipfs.peerId.id }) - after(() => common.teardown()) + after(() => common.clean()) it('should return false when the name that is intended to cancel is not subscribed', async function () { this.timeout(60 * 1000) diff --git a/src/name-pubsub/state.js b/src/name-pubsub/state.js index 70c5197ee..01da8dbaa 100644 --- a/src/name-pubsub/state.js +++ b/src/name-pubsub/state.js @@ -3,9 +3,9 @@ const { getDescribe, getIt, expect } = require('../utils/mocha') -/** @typedef { import("ipfsd-ctl").TestsInterface } TestsInterface */ +/** @typedef { import("ipfsd-ctl/src/factory") } Factory */ /** - * @param {TestsInterface} common + * @param {Factory} common * @param {Object} options */ module.exports = (common, options) => { @@ -15,15 +15,11 @@ module.exports = (common, options) => { describe('.name.pubsub.state', () => { let ipfs - before(async function () { - // CI takes longer to instantiate the daemon, so we need to increase the - // timeout for the before step - this.timeout(60 * 1000) - - ipfs = await common.setup() + before(async () => { + ipfs = (await common.spawn()).api }) - after(() => common.teardown()) + after(() => common.clean()) it('should get the current state of pubsub', async function () { this.timeout(50 * 1000) diff --git a/src/name-pubsub/subs.js b/src/name-pubsub/subs.js index 1128c4672..9b4764ff0 100644 --- a/src/name-pubsub/subs.js +++ b/src/name-pubsub/subs.js @@ -3,9 +3,9 @@ const { getDescribe, getIt, expect } = require('../utils/mocha') -/** @typedef { import("ipfsd-ctl").TestsInterface } TestsInterface */ +/** @typedef { import("ipfsd-ctl/src/factory") } Factory */ /** - * @param {TestsInterface} common + * @param {Factory} common * @param {Object} options */ module.exports = (common, options) => { @@ -15,15 +15,11 @@ module.exports = (common, options) => { describe('.name.pubsub.subs', () => { let ipfs - before(async function () { - // CI takes longer to instantiate the daemon, so we need to increase the - // timeout for the before step - this.timeout(60 * 1000) - - ipfs = await common.setup() + before(async () => { + ipfs = (await common.spawn()).api }) - after(() => common.teardown()) + after(() => common.clean()) it('should get an empty array as a result of subscriptions before any resolve', async function () { this.timeout(60 * 1000) diff --git a/src/name/publish.js b/src/name/publish.js index 055087ec5..c40abf3a1 100644 --- a/src/name/publish.js +++ b/src/name/publish.js @@ -6,9 +6,9 @@ const hat = require('hat') const { fixture } = require('./utils') const { getDescribe, getIt, expect } = require('../utils/mocha') -/** @typedef { import("ipfsd-ctl").TestsInterface } TestsInterface */ +/** @typedef { import("ipfsd-ctl/src/factory") } Factory */ /** - * @param {TestsInterface} common + * @param {Factory} common * @param {Object} options */ module.exports = (common, options) => { @@ -20,17 +20,13 @@ module.exports = (common, options) => { let ipfs let nodeId - before(async function () { - // CI takes longer to instantiate the daemon, so we need to increase the - // timeout for the before step - this.timeout(60 * 1000) - - ipfs = await common.setup() + before(async () => { + ipfs = (await common.spawn()).api nodeId = ipfs.peerId.id await ipfs.add(fixture.data, { pin: false }) }) - after(() => common.teardown()) + after(() => common.clean()) it('should publish an IPNS record with the default params', async function () { this.timeout(50 * 1000) diff --git a/src/name/resolve.js b/src/name/resolve.js index e78c282a9..d83d6845e 100644 --- a/src/name/resolve.js +++ b/src/name/resolve.js @@ -5,9 +5,9 @@ const { getDescribe, getIt, expect } = require('../utils/mocha') const delay = require('delay') const CID = require('cids') -/** @typedef { import("ipfsd-ctl").TestsInterface } TestsInterface */ +/** @typedef { import("ipfsd-ctl/src/factory") } Factory */ /** - * @param {TestsInterface} common + * @param {Factory} common * @param {Object} options */ module.exports = (common, options) => { @@ -19,11 +19,11 @@ module.exports = (common, options) => { let nodeId before(async () => { - ipfs = await common.setup() + ipfs = (await common.spawn()).api nodeId = ipfs.peerId.id }) - after(() => common.teardown()) + after(() => common.clean()) it('should resolve a record default options', async function () { this.timeout(20 * 1000) @@ -135,10 +135,10 @@ module.exports = (common, options) => { this.retries(5) before(async () => { - ipfs = await common.setup() + ipfs = (await common.spawn()).api }) - after(() => common.teardown()) + after(() => common.clean()) it('should resolve /ipns/ipfs.io', async () => { return expect(await ipfs.name.resolve('/ipns/ipfs.io')) diff --git a/src/object/data.js b/src/object/data.js index ddefef3ba..4224b36d5 100644 --- a/src/object/data.js +++ b/src/object/data.js @@ -5,9 +5,9 @@ const bs58 = require('bs58') const hat = require('hat') const { getDescribe, getIt, expect } = require('../utils/mocha') -/** @typedef { import("ipfsd-ctl").TestsInterface } TestsInterface */ +/** @typedef { import("ipfsd-ctl/src/factory") } Factory */ /** - * @param {TestsInterface} common + * @param {Factory} common * @param {Object} options */ module.exports = (common, options) => { @@ -19,15 +19,11 @@ module.exports = (common, options) => { let ipfs - before(async function () { - // CI takes longer to instantiate the daemon, so we need to increase the - // timeout for the before step - this.timeout(60 * 1000) - - ipfs = await common.setup() + before(async () => { + ipfs = (await common.spawn()).api }) - after(() => common.teardown()) + after(() => common.clean()) it('should get data by multihash', async () => { const testObj = { diff --git a/src/object/get.js b/src/object/get.js index 4c355b2fa..5e7ecdf46 100644 --- a/src/object/get.js +++ b/src/object/get.js @@ -9,9 +9,9 @@ const UnixFs = require('ipfs-unixfs') const crypto = require('crypto') const { asDAGLink } = require('./utils') -/** @typedef { import("ipfsd-ctl").TestsInterface } TestsInterface */ +/** @typedef { import("ipfsd-ctl/src/factory") } Factory */ /** - * @param {TestsInterface} common + * @param {Factory} common * @param {Object} options */ module.exports = (common, options) => { @@ -23,15 +23,11 @@ module.exports = (common, options) => { let ipfs - before(async function () { - // CI takes longer to instantiate the daemon, so we need to increase the - // timeout for the before step - this.timeout(60 * 1000) - - ipfs = await common.setup() + before(async () => { + ipfs = (await common.spawn()).api }) - after(() => common.teardown()) + after(() => common.clean()) it('should get object by multihash', async () => { const obj = { diff --git a/src/object/links.js b/src/object/links.js index ca5fb57bc..a3b3c45e9 100644 --- a/src/object/links.js +++ b/src/object/links.js @@ -8,9 +8,9 @@ const { getDescribe, getIt, expect } = require('../utils/mocha') const { asDAGLink } = require('./utils') const CID = require('cids') -/** @typedef { import("ipfsd-ctl").TestsInterface } TestsInterface */ +/** @typedef { import("ipfsd-ctl/src/factory") } Factory */ /** - * @param {TestsInterface} common + * @param {Factory} common * @param {Object} options */ module.exports = (common, options) => { @@ -22,15 +22,11 @@ module.exports = (common, options) => { let ipfs - before(async function () { - // CI takes longer to instantiate the daemon, so we need to increase the - // timeout for the before step - this.timeout(60 * 1000) - - ipfs = await common.setup() + before(async () => { + ipfs = (await common.spawn()).api }) - after(() => common.teardown()) + after(() => common.clean()) it('should get empty links by multihash', async () => { const testObj = { diff --git a/src/object/new.js b/src/object/new.js index a05867b77..3faa3c056 100644 --- a/src/object/new.js +++ b/src/object/new.js @@ -3,9 +3,9 @@ const { getDescribe, getIt, expect } = require('../utils/mocha') -/** @typedef { import("ipfsd-ctl").TestsInterface } TestsInterface */ +/** @typedef { import("ipfsd-ctl/src/factory") } Factory */ /** - * @param {TestsInterface} common + * @param {Factory} common * @param {Object} options */ module.exports = (common, options) => { @@ -17,15 +17,11 @@ module.exports = (common, options) => { let ipfs - before(async function () { - // CI takes longer to instantiate the daemon, so we need to increase the - // timeout for the before step - this.timeout(60 * 1000) - - ipfs = await common.setup() + before(async () => { + ipfs = (await common.spawn()).api }) - after(() => common.teardown()) + after(() => common.clean()) it('should create a new object with no template', async () => { const cid = await ipfs.object.new() diff --git a/src/object/patch/add-link.js b/src/object/patch/add-link.js index 0a7f7b164..cea45a53f 100644 --- a/src/object/patch/add-link.js +++ b/src/object/patch/add-link.js @@ -6,9 +6,9 @@ const DAGNode = dagPB.DAGNode const { getDescribe, getIt, expect } = require('../../utils/mocha') const { asDAGLink } = require('../utils') -/** @typedef { import("ipfsd-ctl").TestsInterface } TestsInterface */ +/** @typedef { import("ipfsd-ctl/src/factory") } Factory */ /** - * @param {TestsInterface} common + * @param {Factory} common * @param {Object} options */ module.exports = (common, options) => { @@ -20,15 +20,11 @@ module.exports = (common, options) => { let ipfs - before(async function () { - // CI takes longer to instantiate the daemon, so we need to increase the - // timeout for the before step - this.timeout(60 * 1000) - - ipfs = await common.setup() + before(async () => { + ipfs = (await common.spawn()).api }) - after(() => common.teardown()) + after(() => common.clean()) it('should add a link to an existing node', async () => { const obj = { diff --git a/src/object/patch/append-data.js b/src/object/patch/append-data.js index f8df8eab9..97b42c173 100644 --- a/src/object/patch/append-data.js +++ b/src/object/patch/append-data.js @@ -3,9 +3,9 @@ const { getDescribe, getIt, expect } = require('../../utils/mocha') -/** @typedef { import("ipfsd-ctl").TestsInterface } TestsInterface */ +/** @typedef { import("ipfsd-ctl/src/factory") } Factory */ /** - * @param {TestsInterface} common + * @param {Factory} common * @param {Object} options */ module.exports = (common, options) => { @@ -17,15 +17,11 @@ module.exports = (common, options) => { let ipfs - before(async function () { - // CI takes longer to instantiate the daemon, so we need to increase the - // timeout for the before step - this.timeout(60 * 1000) - - ipfs = await common.setup() + before(async () => { + ipfs = (await common.spawn()).api }) - after(() => common.teardown()) + after(() => common.clean()) it('should append data to an existing node', async () => { const obj = { diff --git a/src/object/patch/rm-link.js b/src/object/patch/rm-link.js index 21c29a385..9ec9a7c42 100644 --- a/src/object/patch/rm-link.js +++ b/src/object/patch/rm-link.js @@ -4,9 +4,9 @@ const { getDescribe, getIt, expect } = require('../../utils/mocha') const { asDAGLink } = require('../utils') -/** @typedef { import("ipfsd-ctl").TestsInterface } TestsInterface */ +/** @typedef { import("ipfsd-ctl/src/factory") } Factory */ /** - * @param {TestsInterface} common + * @param {Factory} common * @param {Object} options */ module.exports = (common, options) => { @@ -18,15 +18,11 @@ module.exports = (common, options) => { let ipfs - before(async function () { - // CI takes longer to instantiate the daemon, so we need to increase the - // timeout for the before step - this.timeout(60 * 1000) - - ipfs = await common.setup() + before(async () => { + ipfs = (await common.spawn()).api }) - after(() => common.teardown()) + after(() => common.clean()) it('should remove a link from an existing node', async () => { const obj1 = { diff --git a/src/object/patch/set-data.js b/src/object/patch/set-data.js index 3d89f288d..309a57a72 100644 --- a/src/object/patch/set-data.js +++ b/src/object/patch/set-data.js @@ -3,9 +3,9 @@ const { getDescribe, getIt, expect } = require('../../utils/mocha') -/** @typedef { import("ipfsd-ctl").TestsInterface } TestsInterface */ +/** @typedef { import("ipfsd-ctl/src/factory") } Factory */ /** - * @param {TestsInterface} common + * @param {Factory} common * @param {Object} options */ module.exports = (common, options) => { @@ -17,15 +17,11 @@ module.exports = (common, options) => { let ipfs - before(async function () { - // CI takes longer to instantiate the daemon, so we need to increase the - // timeout for the before step - this.timeout(60 * 1000) - - ipfs = await common.setup() + before(async () => { + ipfs = (await common.spawn()).api }) - after(() => common.teardown()) + after(() => common.clean()) it('should set data for an existing node', async () => { const obj = { diff --git a/src/object/put.js b/src/object/put.js index 337b9b307..e26c3bcca 100644 --- a/src/object/put.js +++ b/src/object/put.js @@ -7,9 +7,9 @@ const hat = require('hat') const { getDescribe, getIt, expect } = require('../utils/mocha') const { asDAGLink } = require('./utils') -/** @typedef { import("ipfsd-ctl").TestsInterface } TestsInterface */ +/** @typedef { import("ipfsd-ctl/src/factory") } Factory */ /** - * @param {TestsInterface} common + * @param {Factory} common * @param {Object} options */ module.exports = (common, options) => { @@ -21,15 +21,11 @@ module.exports = (common, options) => { let ipfs - before(async function () { - // CI takes longer to instantiate the daemon, so we need to increase the - // timeout for the before step - this.timeout(60 * 1000) - - ipfs = await common.setup() + before(async () => { + ipfs = (await common.spawn()).api }) - after(() => common.teardown()) + after(() => common.clean()) it('should put an object', async () => { const obj = { diff --git a/src/object/stat.js b/src/object/stat.js index a8cf80f80..25c60d27e 100644 --- a/src/object/stat.js +++ b/src/object/stat.js @@ -6,9 +6,9 @@ const DAGNode = dagPB.DAGNode const { getDescribe, getIt, expect } = require('../utils/mocha') const { asDAGLink } = require('./utils') -/** @typedef { import("ipfsd-ctl").TestsInterface } TestsInterface */ +/** @typedef { import("ipfsd-ctl/src/factory") } Factory */ /** - * @param {TestsInterface} common + * @param {Factory} common * @param {Object} options */ module.exports = (common, options) => { @@ -20,15 +20,11 @@ module.exports = (common, options) => { let ipfs - before(async function () { - // CI takes longer to instantiate the daemon, so we need to increase the - // timeout for the before step - this.timeout(60 * 1000) - - ipfs = await common.setup() + before(async () => { + ipfs = (await common.spawn()).api }) - after(() => common.teardown()) + after(() => common.clean()) it('should get stats by multihash', async () => { const testObj = { diff --git a/src/pin/add.js b/src/pin/add.js index 4bf409f98..1f2e94172 100644 --- a/src/pin/add.js +++ b/src/pin/add.js @@ -4,9 +4,9 @@ const { fixtures } = require('./utils') const { getDescribe, getIt, expect } = require('../utils/mocha') -/** @typedef { import("ipfsd-ctl").TestsInterface } TestsInterface */ +/** @typedef { import("ipfsd-ctl/src/factory") } Factory */ /** - * @param {TestsInterface} common + * @param {Factory} common * @param {Object} options */ module.exports = (common, options) => { @@ -18,13 +18,13 @@ module.exports = (common, options) => { let ipfs before(async () => { - ipfs = await common.setup() + ipfs = (await common.spawn()).api await Promise.all(fixtures.files.map(file => { return ipfs.add(file.data, { pin: false }) })) }) - after(() => common.teardown()) + after(() => common.clean()) it('should add a pin', async () => { const pinset = await ipfs.pin.add(fixtures.files[0].cid, { recursive: false }) diff --git a/src/pin/ls.js b/src/pin/ls.js index 2ce29ed19..780c3e3df 100644 --- a/src/pin/ls.js +++ b/src/pin/ls.js @@ -4,9 +4,9 @@ const { fixtures } = require('./utils') const { getDescribe, getIt, expect } = require('../utils/mocha') -/** @typedef { import("ipfsd-ctl").TestsInterface } TestsInterface */ +/** @typedef { import("ipfsd-ctl/src/factory") } Factory */ /** - * @param {TestsInterface} common + * @param {Factory} common * @param {Object} options */ module.exports = (common, options) => { @@ -18,12 +18,8 @@ module.exports = (common, options) => { let ipfs - before(async function () { - // CI takes longer to instantiate the daemon, so we need to increase the - // timeout for the before step - this.timeout(60 * 1000) - - ipfs = await common.setup() + before(async () => { + ipfs = (await common.spawn()).api // two files wrapped in directories, only root CID pinned recursively const dir = fixtures.directory.files.map((file) => ({ path: file.path, content: file.data })) await ipfs.add(dir, { pin: false, cidVersion: 0 }) @@ -36,7 +32,7 @@ module.exports = (common, options) => { await ipfs.pin.add(fixtures.files[1].cid, { recursive: false }) }) - after(() => common.teardown()) + after(() => common.clean()) // 1st, because ipfs.add pins automatically it('should list all recursive pins', async () => { diff --git a/src/pin/rm.js b/src/pin/rm.js index 405f5f5a0..28ba073c6 100644 --- a/src/pin/rm.js +++ b/src/pin/rm.js @@ -4,9 +4,9 @@ const { fixtures } = require('./utils') const { getDescribe, getIt, expect } = require('../utils/mocha') -/** @typedef { import("ipfsd-ctl").TestsInterface } TestsInterface */ +/** @typedef { import("ipfsd-ctl/src/factory") } Factory */ /** - * @param {TestsInterface} common + * @param {Factory} common * @param {Object} options */ module.exports = (common, options) => { @@ -18,14 +18,14 @@ module.exports = (common, options) => { let ipfs before(async () => { - ipfs = await common.setup() + ipfs = (await common.spawn()).api await ipfs.add(fixtures.files[0].data, { pin: false }) await ipfs.pin.add(fixtures.files[0].cid, { recursive: true }) await ipfs.add(fixtures.files[1].data, { pin: false }) await ipfs.pin.add(fixtures.files[1].cid, { recursive: false }) }) - after(() => common.teardown()) + after(() => common.clean()) it('should remove a recursive pin', async () => { const removedPinset = await ipfs.pin.rm(fixtures.files[0].cid, { recursive: true }) diff --git a/src/ping/ping-pull-stream.js b/src/ping/ping-pull-stream.js index 96b85746c..23c48077c 100644 --- a/src/ping/ping-pull-stream.js +++ b/src/ping/ping-pull-stream.js @@ -5,9 +5,9 @@ const pullToPromise = require('pull-to-promise') const { getDescribe, getIt, expect } = require('../utils/mocha') const { isPong } = require('./utils.js') -/** @typedef { import("ipfsd-ctl").TestsInterface } TestsInterface */ +/** @typedef { import("ipfsd-ctl/src/factory") } Factory */ /** - * @param {TestsInterface} common + * @param {Factory} common * @param {Object} options */ module.exports = (common, options) => { @@ -21,12 +21,12 @@ module.exports = (common, options) => { let ipfsB before(async () => { - ipfsA = await common.setup() - ipfsB = await common.setup({ type: 'js' }) + ipfsA = (await common.spawn()).api + ipfsB = (await common.spawn({ type: 'js' })).api await ipfsA.swarm.connect(ipfsB.peerId.addresses[0]) }) - after(() => common.teardown()) + after(() => common.clean()) it('should send the specified number of packets over pull stream', async () => { const count = 3 diff --git a/src/ping/ping-readable-stream.js b/src/ping/ping-readable-stream.js index 2ac8ce33d..75b3ff84b 100644 --- a/src/ping/ping-readable-stream.js +++ b/src/ping/ping-readable-stream.js @@ -6,9 +6,9 @@ const { Writable } = require('stream') const { getDescribe, getIt, expect } = require('../utils/mocha') const { isPong } = require('./utils.js') -/** @typedef { import("ipfsd-ctl").TestsInterface } TestsInterface */ +/** @typedef { import("ipfsd-ctl/src/factory") } Factory */ /** - * @param {TestsInterface} common + * @param {Factory} common * @param {Object} options */ module.exports = (common, options) => { @@ -22,12 +22,12 @@ module.exports = (common, options) => { let ipfsB before(async () => { - ipfsA = await common.setup() - ipfsB = await common.setup({ type: 'js' }) + ipfsA = (await common.spawn()).api + ipfsB = (await common.spawn({ type: 'js' })).api await ipfsA.swarm.connect(ipfsB.peerId.addresses[0]) }) - after(() => common.teardown()) + after(() => common.clean()) it('should send the specified number of packets over readable stream', () => { let packetNum = 0 diff --git a/src/ping/ping.js b/src/ping/ping.js index d4e74d2be..00e42b6c4 100644 --- a/src/ping/ping.js +++ b/src/ping/ping.js @@ -4,9 +4,9 @@ const { getDescribe, getIt, expect } = require('../utils/mocha') const { expectIsPingResponse, isPong } = require('./utils') -/** @typedef { import("ipfsd-ctl").TestsInterface } TestsInterface */ +/** @typedef { import("ipfsd-ctl/src/factory") } Factory */ /** - * @param {TestsInterface} common + * @param {Factory} common * @param {Object} options */ module.exports = (common, options) => { @@ -19,17 +19,13 @@ module.exports = (common, options) => { let ipfsA let ipfsB - before(async function () { - // CI takes longer to instantiate the daemon, so we need to increase the - // timeout for the before step - this.timeout(60 * 1000) - - ipfsA = await common.setup() - ipfsB = await common.setup({ type: 'js' }) + before(async () => { + ipfsA = (await common.spawn()).api + ipfsB = (await common.spawn({ type: 'js' })).api await ipfsA.swarm.connect(ipfsB.peerId.addresses[0]) }) - after(() => common.teardown()) + after(() => common.clean()) it('should send the specified number of packets', async () => { const count = 3 diff --git a/src/pubsub/ls.js b/src/pubsub/ls.js index 25f7ea982..85449bf02 100644 --- a/src/pubsub/ls.js +++ b/src/pubsub/ls.js @@ -5,9 +5,9 @@ const { getTopic } = require('./utils') const { getDescribe, getIt, expect } = require('../utils/mocha') const delay = require('delay') -/** @typedef { import("ipfsd-ctl").TestsInterface } TestsInterface */ +/** @typedef { import("ipfsd-ctl/src/factory") } Factory */ /** - * @param {TestsInterface} common + * @param {Factory} common * @param {Object} options */ module.exports = (common, options) => { @@ -20,7 +20,7 @@ module.exports = (common, options) => { let ipfs let subscribedTopics = [] before(async () => { - ipfs = await common.setup() + ipfs = (await common.spawn()).api }) afterEach(async () => { @@ -31,7 +31,7 @@ module.exports = (common, options) => { await delay(100) }) - after(() => common.teardown()) + after(() => common.clean()) it('should return an empty list when no topics are subscribed', async () => { const topics = await ipfs.pubsub.ls() diff --git a/src/pubsub/peers.js b/src/pubsub/peers.js index f93447415..22635fed0 100644 --- a/src/pubsub/peers.js +++ b/src/pubsub/peers.js @@ -5,9 +5,9 @@ const { waitForPeers, getTopic } = require('./utils') const { getDescribe, getIt, expect } = require('../utils/mocha') const delay = require('delay') -/** @typedef { import("ipfsd-ctl").TestsInterface } TestsInterface */ +/** @typedef { import("ipfsd-ctl/src/factory") } Factory */ /** - * @param {TestsInterface} common + * @param {Factory} common * @param {Object} options */ module.exports = (common, options) => { @@ -22,9 +22,9 @@ module.exports = (common, options) => { let ipfs3 let subscribedTopics = [] before(async () => { - ipfs1 = await common.setup() - ipfs2 = await common.setup({ type: 'go' }) - ipfs3 = await common.setup({ type: 'go' }) + ipfs1 = (await common.spawn()).api + ipfs2 = (await common.spawn({ type: 'go' })).api + ipfs3 = (await common.spawn({ type: 'go' })).api 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')) @@ -44,7 +44,7 @@ module.exports = (common, options) => { await delay(100) }) - after(() => common.teardown()) + after(() => common.clean()) it('should not error when not subscribed to a topic', async () => { const topic = getTopic() diff --git a/src/pubsub/publish.js b/src/pubsub/publish.js index c79db160e..f6359f580 100644 --- a/src/pubsub/publish.js +++ b/src/pubsub/publish.js @@ -5,9 +5,9 @@ const hat = require('hat') const { getTopic } = require('./utils') const { getDescribe, getIt } = require('../utils/mocha') -/** @typedef { import("ipfsd-ctl").TestsInterface } TestsInterface */ +/** @typedef { import("ipfsd-ctl/src/factory") } Factory */ /** - * @param {TestsInterface} common + * @param {Factory} common * @param {Object} options */ module.exports = (common, options) => { @@ -19,15 +19,11 @@ module.exports = (common, options) => { let ipfs - before(async function () { - // CI takes longer to instantiate the daemon, so we need to increase the - // timeout for the before step - this.timeout(60 * 1000) - - ipfs = await common.setup() + before(async () => { + ipfs = (await common.spawn()).api }) - after(() => common.teardown()) + after(() => common.clean()) it('should publish message from string', () => { const topic = getTopic() diff --git a/src/pubsub/subscribe.js b/src/pubsub/subscribe.js index 6a48c57d0..759bc133f 100644 --- a/src/pubsub/subscribe.js +++ b/src/pubsub/subscribe.js @@ -7,9 +7,9 @@ const { waitForPeers, getTopic } = require('./utils') const { getDescribe, getIt, expect } = require('../utils/mocha') const delay = require('delay') -/** @typedef { import("ipfsd-ctl").TestsInterface } TestsInterface */ +/** @typedef { import("ipfsd-ctl/src/factory") } Factory */ /** - * @param {TestsInterface} common + * @param {Factory} common * @param {Object} options */ module.exports = (common, options) => { @@ -24,13 +24,9 @@ module.exports = (common, options) => { let topic let subscribedTopics = [] - before(async function () { - // CI takes longer to instantiate the daemon, so we need to increase the - // timeout for the before step - this.timeout(100 * 1000) - - ipfs1 = await common.setup() - ipfs2 = await common.setup({ type: 'go' }) + before(async () => { + ipfs1 = (await common.spawn()).api + ipfs2 = (await common.spawn({ type: 'go' })).api }) beforeEach(() => { @@ -48,7 +44,7 @@ module.exports = (common, options) => { await delay(100) }) - after(() => common.teardown()) + after(() => common.clean()) describe('single node', () => { it('should subscribe to one topic', async () => { diff --git a/src/pubsub/unsubscribe.js b/src/pubsub/unsubscribe.js index 0cd4f8cbf..f58f93089 100644 --- a/src/pubsub/unsubscribe.js +++ b/src/pubsub/unsubscribe.js @@ -6,9 +6,9 @@ const { getTopic } = require('./utils') const { getDescribe, getIt, expect } = require('../utils/mocha') const delay = require('delay') -/** @typedef { import("ipfsd-ctl").TestsInterface } TestsInterface */ +/** @typedef { import("ipfsd-ctl/src/factory") } Factory */ /** - * @param {TestsInterface} common + * @param {Factory} common * @param {Object} options */ module.exports = (common, options) => { @@ -20,15 +20,11 @@ module.exports = (common, options) => { let ipfs - before(async function () { - // CI takes longer to instantiate the daemon, so we need to increase the - // timeout for the before step - this.timeout(60 * 1000) - - ipfs = await common.setup() + before(async () => { + ipfs = (await common.spawn()).api }) - after(() => common.teardown()) + after(() => common.clean()) // Browser/worker has max ~5 open HTTP requests to the same origin const count = isBrowser || isWebWorker || isElectronRenderer ? 5 : 10 diff --git a/src/repo/gc.js b/src/repo/gc.js index 676e1c770..861d062a1 100644 --- a/src/repo/gc.js +++ b/src/repo/gc.js @@ -4,9 +4,9 @@ const { getDescribe, getIt, expect } = require('../utils/mocha') const { DAGNode } = require('ipld-dag-pb') -/** @typedef { import("ipfsd-ctl").TestsInterface } TestsInterface */ +/** @typedef { import("ipfsd-ctl/src/factory") } Factory */ /** - * @param {TestsInterface} common + * @param {Factory} common * @param {Object} options */ module.exports = (common, options) => { @@ -16,15 +16,11 @@ module.exports = (common, options) => { describe('.repo.gc', () => { let ipfs - before(async function () { - // CI takes longer to instantiate the daemon, so we need to increase the - // timeout for the before step - this.timeout(60 * 1000) - - ipfs = await common.setup() + before(async () => { + ipfs = (await common.spawn()).api }) - after(() => common.teardown()) + after(() => common.clean()) it('should run garbage collection', async () => { const res = await ipfs.add(Buffer.from('apples')) diff --git a/src/repo/stat.js b/src/repo/stat.js index bedbc8e60..ae9a00263 100644 --- a/src/repo/stat.js +++ b/src/repo/stat.js @@ -4,9 +4,9 @@ const { expectIsRepo } = require('../stats/utils') const { getDescribe, getIt } = require('../utils/mocha') -/** @typedef { import("ipfsd-ctl").TestsInterface } TestsInterface */ +/** @typedef { import("ipfsd-ctl/src/factory") } Factory */ /** - * @param {TestsInterface} common + * @param {Factory} common * @param {Object} options */ module.exports = (common, options) => { @@ -16,15 +16,11 @@ module.exports = (common, options) => { describe('.repo.stat', () => { let ipfs - before(async function () { - // CI takes longer to instantiate the daemon, so we need to increase the - // timeout for the before step - this.timeout(60 * 1000) - - ipfs = await common.setup() + before(async () => { + ipfs = (await common.spawn()).api }) - after(() => common.teardown()) + after(() => common.clean()) it('should get repo stats', async () => { const res = await ipfs.repo.stat() diff --git a/src/repo/version.js b/src/repo/version.js index e49d5608f..3010424c8 100644 --- a/src/repo/version.js +++ b/src/repo/version.js @@ -3,9 +3,9 @@ const { getDescribe, getIt, expect } = require('../utils/mocha') -/** @typedef { import("ipfsd-ctl").TestsInterface } TestsInterface */ +/** @typedef { import("ipfsd-ctl/src/factory") } Factory */ /** - * @param {TestsInterface} common + * @param {Factory} common * @param {Object} options */ module.exports = (common, options) => { @@ -15,15 +15,11 @@ module.exports = (common, options) => { describe('.repo.version', () => { let ipfs - before(async function () { - // CI takes longer to instantiate the daemon, so we need to increase the - // timeout for the before step - this.timeout(60 * 1000) - - ipfs = await common.setup() + before(async () => { + ipfs = (await common.spawn()).api }) - after(() => common.teardown()) + after(() => common.clean()) it('should get the repo version', async () => { const version = await ipfs.repo.version() diff --git a/src/stats/bitswap.js b/src/stats/bitswap.js index db03f1724..3189cf225 100644 --- a/src/stats/bitswap.js +++ b/src/stats/bitswap.js @@ -4,9 +4,9 @@ const { getDescribe, getIt } = require('../utils/mocha') const { expectIsBitswap } = require('./utils') -/** @typedef { import("ipfsd-ctl").TestsInterface } TestsInterface */ +/** @typedef { import("ipfsd-ctl/src/factory") } Factory */ /** - * @param {TestsInterface} common + * @param {Factory} common * @param {Object} options */ module.exports = (common, options) => { @@ -16,15 +16,11 @@ module.exports = (common, options) => { describe('.stats.bitswap', () => { let ipfs - before(async function () { - // CI takes longer to instantiate the daemon, so we need to increase the - // timeout for the before step - this.timeout(60 * 1000) - - ipfs = await common.setup() + before(async () => { + ipfs = (await common.spawn()).api }) - after(() => common.teardown()) + after(() => common.clean()) it('should get bitswap stats', async () => { const res = await ipfs.stats.bitswap() diff --git a/src/stats/bw-pull-stream.js b/src/stats/bw-pull-stream.js index be97601c2..f2329f322 100644 --- a/src/stats/bw-pull-stream.js +++ b/src/stats/bw-pull-stream.js @@ -5,9 +5,9 @@ const { expectIsBandwidth } = require('./utils') const pullToPromise = require('pull-to-promise') const { getDescribe, getIt } = require('../utils/mocha') -/** @typedef { import("ipfsd-ctl").TestsInterface } TestsInterface */ +/** @typedef { import("ipfsd-ctl/src/factory") } Factory */ /** - * @param {TestsInterface} common + * @param {Factory} common * @param {Object} options */ module.exports = (common, options) => { @@ -17,15 +17,11 @@ module.exports = (common, options) => { describe('.stats.bwPullStream', () => { let ipfs - before(async function () { - // CI takes longer to instantiate the daemon, so we need to increase the - // timeout for the before step - this.timeout(60 * 1000) - - ipfs = await common.setup() + before(async () => { + ipfs = (await common.spawn()).api }) - after(() => common.teardown()) + after(() => common.clean()) it('should get bandwidth stats over pull stream', async () => { const stream = ipfs.stats.bwPullStream() diff --git a/src/stats/bw-readable-stream.js b/src/stats/bw-readable-stream.js index e9ae0db3c..2e6ed7671 100644 --- a/src/stats/bw-readable-stream.js +++ b/src/stats/bw-readable-stream.js @@ -5,9 +5,9 @@ const { expectIsBandwidth } = require('./utils') const { getDescribe, getIt } = require('../utils/mocha') const getStream = require('get-stream') -/** @typedef { import("ipfsd-ctl").TestsInterface } TestsInterface */ +/** @typedef { import("ipfsd-ctl/src/factory") } Factory */ /** - * @param {TestsInterface} common + * @param {Factory} common * @param {Object} options */ module.exports = (common, options) => { @@ -17,15 +17,11 @@ module.exports = (common, options) => { describe('.stats.bwReadableStream', () => { let ipfs - before(async function () { - // CI takes longer to instantiate the daemon, so we need to increase the - // timeout for the before step - this.timeout(60 * 1000) - - ipfs = await common.setup() + before(async () => { + ipfs = (await common.spawn()).api }) - after(() => common.teardown()) + after(() => common.clean()) it('should get bandwidth stats over readable stream', async () => { const stream = ipfs.stats.bwReadableStream() diff --git a/src/stats/bw.js b/src/stats/bw.js index 676a1acda..178eb5f94 100644 --- a/src/stats/bw.js +++ b/src/stats/bw.js @@ -4,9 +4,9 @@ const { expectIsBandwidth } = require('./utils') const { getDescribe, getIt } = require('../utils/mocha') -/** @typedef { import("ipfsd-ctl").TestsInterface } TestsInterface */ +/** @typedef { import("ipfsd-ctl/src/factory") } Factory */ /** - * @param {TestsInterface} common + * @param {Factory} common * @param {Object} options */ module.exports = (common, options) => { @@ -16,15 +16,11 @@ module.exports = (common, options) => { describe('.stats.bw', () => { let ipfs - before(async function () { - // CI takes longer to instantiate the daemon, so we need to increase the - // timeout for the before step - this.timeout(60 * 1000) - - ipfs = await common.setup() + before(async () => { + ipfs = (await common.spawn()).api }) - after(() => common.teardown()) + after(() => common.clean()) it('should get bandwidth stats ', async () => { const res = await ipfs.stats.bw() diff --git a/src/stats/repo.js b/src/stats/repo.js index c2f88f6bb..d6972d539 100644 --- a/src/stats/repo.js +++ b/src/stats/repo.js @@ -4,9 +4,9 @@ const { expectIsRepo } = require('./utils') const { getDescribe, getIt } = require('../utils/mocha') -/** @typedef { import("ipfsd-ctl").TestsInterface } TestsInterface */ +/** @typedef { import("ipfsd-ctl/src/factory") } Factory */ /** - * @param {TestsInterface} common + * @param {Factory} common * @param {Object} options */ module.exports = (common, options) => { @@ -16,15 +16,11 @@ module.exports = (common, options) => { describe('.stats.repo', () => { let ipfs - before(async function () { - // CI takes longer to instantiate the daemon, so we need to increase the - // timeout for the before step - this.timeout(60 * 1000) - - ipfs = await common.setup() + before(async () => { + ipfs = (await common.spawn()).api }) - after(() => common.teardown()) + after(() => common.clean()) it('should get repo stats', async () => { const res = await ipfs.stats.repo() diff --git a/src/swarm/addrs.js b/src/swarm/addrs.js index c1a451588..f7b7eeb4c 100644 --- a/src/swarm/addrs.js +++ b/src/swarm/addrs.js @@ -4,9 +4,9 @@ const PeerInfo = require('peer-info') const { getDescribe, getIt, expect } = require('../utils/mocha') -/** @typedef { import("ipfsd-ctl").TestsInterface } TestsInterface */ +/** @typedef { import("ipfsd-ctl/src/factory") } Factory */ /** - * @param {TestsInterface} common + * @param {Factory} common * @param {Object} options */ module.exports = (common, options) => { @@ -20,12 +20,12 @@ module.exports = (common, options) => { let ipfsB before(async () => { - ipfsA = await common.setup() - ipfsB = await common.setup({ type: 'js' }) + ipfsA = (await common.spawn()).api + ipfsB = (await common.spawn({ type: 'js' })).api await ipfsA.swarm.connect(ipfsB.peerId.addresses[0]) }) - after(() => common.teardown()) + after(() => common.clean()) it('should get a list of node addresses', async () => { const peerInfos = await ipfsA.swarm.addrs() diff --git a/src/swarm/connect.js b/src/swarm/connect.js index 988f2748d..21f501d66 100644 --- a/src/swarm/connect.js +++ b/src/swarm/connect.js @@ -3,9 +3,9 @@ const { getDescribe, getIt, expect } = require('../utils/mocha') -/** @typedef { import("ipfsd-ctl").TestsInterface } TestsInterface */ +/** @typedef { import("ipfsd-ctl/src/factory") } Factory */ /** - * @param {TestsInterface} common + * @param {Factory} common * @param {Object} options */ module.exports = (common, options) => { @@ -18,11 +18,11 @@ module.exports = (common, options) => { let ipfsB before(async () => { - ipfsA = await common.setup() - ipfsB = await common.setup({ type: 'js' }) + ipfsA = (await common.spawn()).api + ipfsB = (await common.spawn({ type: 'js' })).api }) - after(() => common.teardown()) + after(() => common.clean()) it('should connect to a peer', async () => { let peers diff --git a/src/swarm/disconnect.js b/src/swarm/disconnect.js index 02909dba1..09f01a40f 100644 --- a/src/swarm/disconnect.js +++ b/src/swarm/disconnect.js @@ -3,9 +3,9 @@ const { getDescribe, getIt, expect } = require('../utils/mocha') -/** @typedef { import("ipfsd-ctl").TestsInterface } TestsInterface */ +/** @typedef { import("ipfsd-ctl/src/factory") } Factory */ /** - * @param {TestsInterface} common + * @param {Factory} common * @param {Object} options */ module.exports = (common, options) => { @@ -19,12 +19,12 @@ module.exports = (common, options) => { let ipfsB before(async () => { - ipfsA = await common.setup() - ipfsB = await common.setup({ type: 'js' }) + ipfsA = (await common.spawn()).api + ipfsB = (await common.spawn({ type: 'js' })).api await ipfsA.swarm.connect(ipfsB.peerId.addresses[0]) }) - after(() => common.teardown()) + after(() => common.clean()) it('should disconnect from a peer', async () => { let peers diff --git a/src/swarm/local-addrs.js b/src/swarm/local-addrs.js index 1a387c936..6ae57ce3c 100644 --- a/src/swarm/local-addrs.js +++ b/src/swarm/local-addrs.js @@ -3,9 +3,9 @@ const { getDescribe, getIt, expect } = require('../utils/mocha') -/** @typedef { import("ipfsd-ctl").TestsInterface } TestsInterface */ +/** @typedef { import("ipfsd-ctl/src/factory") } Factory */ /** - * @param {TestsInterface} common + * @param {Factory} common * @param {Object} options */ module.exports = (common, options) => { @@ -18,10 +18,10 @@ module.exports = (common, options) => { let ipfs before(async () => { - ipfs = await common.setup() + ipfs = (await common.spawn()).api }) - after(() => common.teardown()) + after(() => common.clean()) it('should list local addresses the node is listening on', async () => { const multiaddrs = await ipfs.swarm.localAddrs() diff --git a/src/swarm/peers.js b/src/swarm/peers.js index 9ec5c7b75..9fa23e247 100644 --- a/src/swarm/peers.js +++ b/src/swarm/peers.js @@ -6,9 +6,9 @@ const PeerId = require('peer-id') const delay = require('delay') const { getDescribe, getIt, expect } = require('../utils/mocha') -/** @typedef { import("ipfsd-ctl").TestsInterface } TestsInterface */ +/** @typedef { import("ipfsd-ctl/src/factory") } Factory */ /** - * @param {TestsInterface} common + * @param {Factory} common * @param {Object} options */ module.exports = (common, options) => { @@ -22,13 +22,15 @@ module.exports = (common, options) => { let ipfsB before(async () => { - ipfsA = await common.setup() - ipfsB = await common.setup({ type: 'go' }) + ipfsA = (await common.spawn()).api + ipfsB = (await common.spawn({ type: 'go' })).api await ipfsA.swarm.connect(ipfsB.peerId.addresses[0]) - await delay(60 * 1000) // wait for open streams in the connection available + /* TODO: Seen if we still need this after this is fixed + https://github.com/ipfs/js-ipfs/issues/2601 gets resolved */ + // await delay(60 * 1000) // wait for open streams in the connection available }) - after(() => common.teardown()) + after(() => common.clean()) it('should list peers this node is connected to', async () => { const peers = await ipfsA.swarm.peers() @@ -84,8 +86,8 @@ module.exports = (common, options) => { } it('should list peers only once', async () => { - const nodeA = await common.setup() - const nodeB = await common.setup({ type: 'go' }) + const nodeA = (await common.spawn()).api + const nodeB = (await common.spawn({ type: 'go' })).api await nodeA.swarm.connect(nodeB.peerId.addresses[0]) await delay(1000) const peersA = await nodeA.swarm.peers() @@ -104,8 +106,8 @@ module.exports = (common, options) => { '/ip4/127.0.0.1/tcp/26545/ws', '/ip4/127.0.0.1/tcp/26546/ws' ]) - const nodeA = await common.setup({ ipfsOptions: { config: configA } }) - const nodeB = await common.setup({ type: 'go', ipfsOptions: { config: configB } }) + const nodeA = (await common.spawn({ ipfsOptions: { config: configA } })).api + const nodeB = (await common.spawn({ type: 'js', ipfsOptions: { config: configB } })).api await nodeA.swarm.connect(nodeB.peerId.addresses[0]) await delay(1000) const peersA = await nodeA.swarm.peers() From d347b2ca1ec923e274edd46a011f849c26020d25 Mon Sep 17 00:00:00 2001 From: Hugo Dias Date: Tue, 10 Dec 2019 14:13:05 +0000 Subject: [PATCH 07/12] fix: add connect to wantlist tests --- src/bitswap/stat.js | 2 +- src/bitswap/wantlist.js | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/src/bitswap/stat.js b/src/bitswap/stat.js index 602c55218..7dd126423 100644 --- a/src/bitswap/stat.js +++ b/src/bitswap/stat.js @@ -13,7 +13,7 @@ module.exports = (common, options) => { const describe = getDescribe(options) const it = getIt(options) - describe('.bitswap.stat', () => { + describe('.bitswap.stat', function () { this.timeout(60 * 1000) let ipfs diff --git a/src/bitswap/wantlist.js b/src/bitswap/wantlist.js index 788fed8a3..7a79ebf1e 100644 --- a/src/bitswap/wantlist.js +++ b/src/bitswap/wantlist.js @@ -24,6 +24,7 @@ module.exports = (common, options) => { ipfsB = (await common.spawn({ type: 'go' })).api // Add key to the wantlist for ipfsB ipfsB.block.get(key).catch(() => {}) + await ipfsA.swarm.connect(ipfsB.peerId.addresses[0]) }) after(() => common.clean()) From d29c6610742eb11be8f4aa8a597458a616f17352 Mon Sep 17 00:00:00 2001 From: Hugo Dias Date: Wed, 11 Dec 2019 02:14:08 +0000 Subject: [PATCH 08/12] fix: fix pubsub tests in firefox --- src/pubsub/subscribe.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/pubsub/subscribe.js b/src/pubsub/subscribe.js index 759bc133f..664f46179 100644 --- a/src/pubsub/subscribe.js +++ b/src/pubsub/subscribe.js @@ -26,7 +26,8 @@ module.exports = (common, options) => { before(async () => { ipfs1 = (await common.spawn()).api - ipfs2 = (await common.spawn({ type: 'go' })).api + // TODO 'multiple connected nodes' tests fails with go in Firefox + ipfs2 = (await common.spawn({ type: 'js' })).api }) beforeEach(() => { From 2b105a7455a8bcf53949b8940848a0a50c043628 Mon Sep 17 00:00:00 2001 From: Hugo Dias Date: Wed, 11 Dec 2019 02:32:38 +0000 Subject: [PATCH 09/12] fix: increase timeout findprovs --- src/dht/find-provs.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/dht/find-provs.js b/src/dht/find-provs.js index 76cae20c7..52787f6ff 100644 --- a/src/dht/find-provs.js +++ b/src/dht/find-provs.js @@ -22,7 +22,8 @@ module.exports = (common, options) => { const describe = getDescribe(options) const it = getIt(options) - describe('.dht.findProvs', () => { + describe('.dht.findProvs', function () { + this.timeout(20000) let nodeA let nodeB let nodeC From 887e4e258d47bffb5c12ab1cd827d2f5aa8d88c2 Mon Sep 17 00:00:00 2001 From: Hugo Dias Date: Wed, 11 Dec 2019 03:13:06 +0000 Subject: [PATCH 10/12] fix: revert pubsub to go --- src/pubsub/subscribe.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/pubsub/subscribe.js b/src/pubsub/subscribe.js index 664f46179..73d5b3a24 100644 --- a/src/pubsub/subscribe.js +++ b/src/pubsub/subscribe.js @@ -27,7 +27,7 @@ module.exports = (common, options) => { before(async () => { ipfs1 = (await common.spawn()).api // TODO 'multiple connected nodes' tests fails with go in Firefox - ipfs2 = (await common.spawn({ type: 'js' })).api + ipfs2 = (await common.spawn({ type: 'go' })).api }) beforeEach(() => { From 617da5551e641d85b0ce85fc81bbf68b39697a9a Mon Sep 17 00:00:00 2001 From: Hugo Dias Date: Wed, 11 Dec 2019 03:14:20 +0000 Subject: [PATCH 11/12] fix: add more info --- src/pubsub/subscribe.js | 1 + 1 file changed, 1 insertion(+) diff --git a/src/pubsub/subscribe.js b/src/pubsub/subscribe.js index 73d5b3a24..f2b91faac 100644 --- a/src/pubsub/subscribe.js +++ b/src/pubsub/subscribe.js @@ -27,6 +27,7 @@ module.exports = (common, options) => { before(async () => { ipfs1 = (await common.spawn()).api // TODO 'multiple connected nodes' tests fails with go in Firefox + // and JS is flaky everywhere ipfs2 = (await common.spawn({ type: 'go' })).api }) From af682d1577c09e3b45736c2ef6b9e331f25275b4 Mon Sep 17 00:00:00 2001 From: Hugo Dias Date: Wed, 11 Dec 2019 16:21:17 +0000 Subject: [PATCH 12/12] chore: bump ipfsd-ctl --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 669fba18c..3ef42401e 100644 --- a/package.json +++ b/package.json @@ -76,7 +76,7 @@ }, "devDependencies": { "aegir": "^20.3.2", - "ipfsd-ctl": "github:ipfs/js-ipfsd-ctl#feat/interface-tests" + "ipfsd-ctl": "^1.0.0" }, "contributors": [ "Alan Shaw ",