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 a563b6b7..fe926c90 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 de99bc4a..93f919de 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 63ca125d..3a4e8a2a 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 e07e68d5..576ab72a 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 ec8d3ffb..b29daef6 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 e5fe1fe0..327d02c7 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 baa7a66f..a048e9db 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 c4a8440d..1191e8e7 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 03392057..eaef06f5 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 f8e20040..02f6f9fe 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 9470c1b6..3b219316 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 ca0b9126..6a399091 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 ffe57238..67640fa0 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 67496a7d..da17794b 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 1e29d923..5f88d3ce 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 dc8ee9ee..97788284 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 eb52106c..b0d5edd3 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 fe982620..9451b936 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 5c6c3b4e..d0ab85ea 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 9e301666..1230279d 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 0fe6df9e..c0651e45 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 c4c6fafd..63c6d73e 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 04a795c5..a569e80d 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 015147d4..7a0a82f3 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 400fe88a..f53d5517 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 fb53808c..6c284df6 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 72f6563f..3506cd55 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 c32cfd70..262b341f 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 0cf36c66..0633d62d 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 4c2baf6b..e7524ac2 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 fa54d598..93ffd8e9 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 45b9af8d..a34cf0c8 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 d8344ee1..acd14c2a 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 91c6e533..0d316f4b 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 9d13ca06..84dfbdef 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 b0619ea1..6afb87e3 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 f81a1a36..d7e2c74e 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 dc5f892d..bd058986 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 9df66ee3..0dbedcc5 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 d1e68baa..e6b09371 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 9606e249..9b5c79d0 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 6b5d33ea..43eb2b5f 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 9faa3775..71a22c60 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 18842d13..c8b72823 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 17778b66..2eced04c 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 41523adf..ddf9afa2 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 ee50075e..9ef7a710 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 ed1837bb..d0ae755b 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 8a940f2b..2491eed7 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 8b9ff173..8d9491a2 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 ccf27dc6..d3b6f96d 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 6e32e6bc..af3721c6 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 6d5cda04..1d3a2962 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 3725800d..caa67547 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 70d1588f..f122ebf9 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 726cfdb0..dc85c639 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 4ed73ba3..8272014c 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 b8b1af78..762fc5e0 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 a3f5333c..6d57a371 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 3607b93a..59f46ca3 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 9a68ea80..fade59bc 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 2ba82464..cdf2f0ef 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 6eb65819..60bf1224 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 58ee8bea..4e9e2f9b 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 c38af691..6235470f 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 2a887ca1..934aaa27 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 13ec1e08..70c5197e 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 1d3e2dd0..1128c467 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 7c4733db..055087ec 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 94ff8249..e78c282a 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 e2eeb515..ddefef3b 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 c4f662df..4c355b2f 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 0770ef21..ca5fb57b 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 6f20522d..a05867b7 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 1e97a70b..0a7f7b16 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 0364c12e..f8df8eab 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 f12ffefa..21c29a38 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 1163b952..3d89f288 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 c1383e7f..337b9b30 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 12c80b7d..a8cf80f8 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 d8789080..4bf409f9 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 47caed6c..2ce29ed1 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 6be13eff..405f5f5a 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 e9e65add..0c378128 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 3c69fc36..13c0ca35 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 030a77f1..a23ed251 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 daf2e358..25f7ea98 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 88bef2d6..6392cf22 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 3b8e93fc..c79db160 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 103aa937..fdaf302b 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 2fe522df..0cd4f8cb 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 2c29c2de..676e1c77 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 aaa7ad4b..bedbc8e6 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 d8384e38..e49d5608 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 61bca7e6..db03f172 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 97d96193..be97601c 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 50e0a8c0..e9ae0db3 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 7994bca8..676a1acd 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 e6fae8d3..c2f88f6b 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 03196577..f4d3730a 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 9de40265..4ac818fd 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 51551001..a71da9b7 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 0c534e6e..1a387c93 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 f37471c9..d8d8daa2 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 fade59bc..d7f478cb 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 fe926c90..669fba18 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 3a4e8a2a..19a510f5 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 60bf1224..0bd003c5 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 0c378128..96b85746 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 13c0ca35..2ac8ce33 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 a23ed251..d4e74d2b 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 6392cf22..38f148f1 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 fdaf302b..5162677f 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 f4d3730a..c1a45158 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 4ac818fd..988f2748 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 a71da9b7..02909dba 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 d8d8daa2..485e1bc2 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 93f919de..699b26a4 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 19a510f5..7d04afd3 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 0bd003c5..8d271ef1 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 4e9e2f9b..7f1d8458 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 38f148f1..f9344741 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 5162677f..6a48c57d 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 485e1bc2..9ec5c7b7 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 7d04afd3..14a137c0 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 699b26a4..602c5521 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 14a137c0..788fed8a 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 576ab72a..413654a1 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 b29daef6..87745733 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 327d02c7..72665a5b 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 a048e9db..e2354b7e 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 1191e8e7..510888f6 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 eaef06f5..9dd335ef 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 02f6f9fe..839eb499 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 3b219316..7f8efeca 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 6a399091..3466a716 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 67640fa0..ca6187fb 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 da17794b..5fe2e4d5 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 5f88d3ce..fbb8ff35 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 97788284..67a25cda 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 b0d5edd3..1dd03108 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 9451b936..36a20673 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 d0ab85ea..4237b0d4 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 1230279d..76cae20c 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 c0651e45..356a4122 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 63c6d73e..696f3aa7 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 a569e80d..1f006cda 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 7a0a82f3..f5fea5ec 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 f53d5517..0515d83e 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 6c284df6..54c74cdc 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 3506cd55..0674fa7b 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 262b341f..fab1c3ad 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 0633d62d..5497f49a 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 e7524ac2..0c35e5ec 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 93ffd8e9..d5c9bcc6 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 a34cf0c8..ccd0c0f9 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 acd14c2a..c3f87101 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 0d316f4b..46467768 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 84dfbdef..9a91e0d3 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 6afb87e3..9640b30d 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 d7e2c74e..0fb3a72e 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 bd058986..a20a0171 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 0dbedcc5..5762cb70 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 e6b09371..0fa60577 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 9b5c79d0..dd408114 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 43eb2b5f..f2a32c87 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 71a22c60..c1fbaaa7 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 c8b72823..70b4cedc 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 2eced04c..85a935c8 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 ddf9afa2..f3429759 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 9ef7a710..070ebfba 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 d0ae755b..7a66915a 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 2491eed7..8f15d0a9 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 8d9491a2..699574fa 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 d3b6f96d..42e39fe0 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 af3721c6..4c365487 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 1d3a2962..663a8e26 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 caa67547..d974614f 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 f122ebf9..48fdb731 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 dc85c639..c6afda3c 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 8272014c..8fc2162f 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 762fc5e0..7cf88bef 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 6d57a371..d18c2a28 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 59f46ca3..8e86c1e4 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 d7f478cb..585557c1 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 cdf2f0ef..3d25a045 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 8d271ef1..ccf4851b 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 7f1d8458..b6f3bd3b 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 6235470f..82349177 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 934aaa27..30cf5e81 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 70c5197e..01da8dba 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 1128c467..9b4764ff 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 055087ec..c40abf3a 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 e78c282a..d83d6845 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 ddefef3b..4224b36d 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 4c355b2f..5e7ecdf4 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 ca5fb57b..a3b3c45e 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 a05867b7..3faa3c05 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 0a7f7b16..cea45a53 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 f8df8eab..97b42c17 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 21c29a38..9ec9a7c4 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 3d89f288..309a57a7 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 337b9b30..e26c3bcc 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 a8cf80f8..25c60d27 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 4bf409f9..1f2e9417 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 2ce29ed1..780c3e3d 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 405f5f5a..28ba073c 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 96b85746..23c48077 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 2ac8ce33..75b3ff84 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 d4e74d2b..00e42b6c 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 25f7ea98..85449bf0 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 f9344741..22635fed 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 c79db160..f6359f58 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 6a48c57d..759bc133 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 0cd4f8cb..f58f9308 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 676e1c77..861d062a 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 bedbc8e6..ae9a0026 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 e49d5608..3010424c 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 db03f172..3189cf22 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 be97601c..f2329f32 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 e9ae0db3..2e6ed767 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 676a1acd..178eb5f9 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 c2f88f6b..d6972d53 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 c1a45158..f7b7eeb4 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 988f2748..21f501d6 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 02909dba..09f01a40 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 1a387c93..6ae57ce3 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 9ec5c7b7..9fa23e24 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 602c5521..7dd12642 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 788fed8a..7a79ebf1 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 759bc133..664f4617 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 76cae20c..52787f6f 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 664f4617..73d5b3a2 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 73d5b3a2..f2b91faa 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 669fba18..3ef42401 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 ",