From 0c73e99b3816e82a4cea5724b70b3c408298fad1 Mon Sep 17 00:00:00 2001 From: Vasco Santos Date: Thu, 7 Feb 2019 16:42:28 +0000 Subject: [PATCH] fix: make ci happy again --- package.json | 2 +- test/core/interface.spec.js | 4 --- test/core/preload.spec.js | 49 +++++++++++++------------- test/http-api/interface.js | 4 --- test/http-api/routes.js | 15 +++++--- test/utils/interface-common-factory.js | 15 +++++++- 6 files changed, 50 insertions(+), 39 deletions(-) diff --git a/package.json b/package.json index 95566fb395..eacbfc1937 100644 --- a/package.json +++ b/package.json @@ -129,7 +129,7 @@ "joi": "^14.3.0", "joi-browser": "^13.4.0", "joi-multiaddr": "^4.0.0", - "libp2p": "libp2p/js-libp2p#master", + "libp2p": "~0.25.0-rc.0", "libp2p-bootstrap": "~0.9.3", "libp2p-crypto": "~0.16.0", "libp2p-kad-dht": "~0.14.4", diff --git a/test/core/interface.spec.js b/test/core/interface.spec.js index b7aaace791..49e3c36d4f 100644 --- a/test/core/interface.spec.js +++ b/test/core/interface.spec.js @@ -184,10 +184,6 @@ describe('interface-ipfs-core tests', function () { config = null } - config = config || { - Bootstrap: [] - } - const spawnOptions = { repoPath, config, initOptions: { bits: 512 } } ipfsFactory.spawn(spawnOptions, (err, _ipfsd) => { diff --git a/test/core/preload.spec.js b/test/core/preload.spec.js index c153e95d59..4d4bd4848f 100644 --- a/test/core/preload.spec.js +++ b/test/core/preload.spec.js @@ -19,7 +19,7 @@ describe('preload', () => { let repo before(function (done) { - this.timeout(20 * 1000) + this.timeout(50 * 1000) repo = createTempRepo() ipfs = new IPFS({ @@ -27,7 +27,8 @@ describe('preload', () => { config: { Addresses: { Swarm: [] - } + }, + Bootstrap: [] }, preload: { enabled: true, @@ -44,17 +45,17 @@ describe('preload', () => { }) after(function (done) { - this.timeout(20 * 1000) + this.timeout(50 * 1000) ipfs.stop(done) }) after(function (done) { - this.timeout(20 * 1000) + this.timeout(50 * 1000) repo.teardown(done) }) it('should preload content added with add', function (done) { - this.timeout(20 * 1000) + this.timeout(50 * 1000) ipfs.add(Buffer.from(hat()), (err, res) => { expect(err).to.not.exist() MockPreloadNode.waitForCids(res[0].hash, done) @@ -62,7 +63,7 @@ describe('preload', () => { }) it('should preload multiple content added with add', function (done) { - this.timeout(20 * 1000) + this.timeout(50 * 1000) ipfs.add([{ content: Buffer.from(hat()) }, { @@ -76,7 +77,7 @@ describe('preload', () => { }) it('should preload multiple content and intermediate dirs added with add', function (done) { - this.timeout(20 * 1000) + this.timeout(50 * 1000) ipfs.add([{ path: 'dir0/dir1/file0', content: Buffer.from(hat()) @@ -97,7 +98,7 @@ describe('preload', () => { }) it('should preload multiple content and wrapping dir for content added with add and wrapWithDirectory option', function (done) { - this.timeout(20 * 1000) + this.timeout(50 * 1000) ipfs.add([{ path: 'dir0/dir1/file0', content: Buffer.from(hat()) @@ -118,7 +119,7 @@ describe('preload', () => { }) it('should preload content retrieved with cat', function (done) { - this.timeout(20 * 1000) + this.timeout(50 * 1000) ipfs.add(Buffer.from(hat()), { preload: false }, (err, res) => { expect(err).to.not.exist() ipfs.cat(res[0].hash, (err) => { @@ -129,7 +130,7 @@ describe('preload', () => { }) it('should preload content retrieved with get', function (done) { - this.timeout(20 * 1000) + this.timeout(50 * 1000) ipfs.add(Buffer.from(hat()), { preload: false }, (err, res) => { expect(err).to.not.exist() ipfs.get(res[0].hash, (err) => { @@ -140,7 +141,7 @@ describe('preload', () => { }) it('should preload content retrieved with ls', function (done) { - this.timeout(20 * 1000) + this.timeout(50 * 1000) ipfs.add([{ path: 'dir0/dir1/file0', content: Buffer.from(hat()) @@ -169,7 +170,7 @@ describe('preload', () => { }) it('should preload content added with object.new', function (done) { - this.timeout(20 * 1000) + this.timeout(50 * 1000) ipfs.object.new((err, cid) => { expect(err).to.not.exist() MockPreloadNode.waitForCids(cid.toBaseEncodedString(), done) @@ -177,7 +178,7 @@ describe('preload', () => { }) it('should preload content added with object.put', function (done) { - this.timeout(20 * 1000) + this.timeout(50 * 1000) ipfs.object.put({ Data: Buffer.from(hat()), Links: [] }, (err, cid) => { expect(err).to.not.exist() MockPreloadNode.waitForCids(cid.toBaseEncodedString(), done) @@ -185,7 +186,7 @@ describe('preload', () => { }) it('should preload content added with object.patch.addLink', function (done) { - this.timeout(20 * 1000) + this.timeout(50 * 1000) parallel({ parent: (cb) => { waterfall([ @@ -214,7 +215,7 @@ describe('preload', () => { }) it('should preload content added with object.patch.rmLink', function (done) { - this.timeout(20 * 1000) + this.timeout(50 * 1000) waterfall([ (cb) => ipfs.object.put({ Data: Buffer.from(hat()), Links: [] }, cb), (cid, cb) => ipfs.object.get(cid, (err, node) => cb(err, { node, cid })), @@ -239,7 +240,7 @@ describe('preload', () => { }) it('should preload content added with object.patch.setData', function (done) { - this.timeout(20 * 1000) + this.timeout(50 * 1000) ipfs.object.put({ Data: Buffer.from(hat()), Links: [] }, (err, cid) => { expect(err).to.not.exist() @@ -251,7 +252,7 @@ describe('preload', () => { }) it('should preload content added with object.patch.appendData', function (done) { - this.timeout(20 * 1000) + this.timeout(50 * 1000) ipfs.object.put({ Data: Buffer.from(hat()), Links: [] }, (err, cid) => { expect(err).to.not.exist() @@ -263,7 +264,7 @@ describe('preload', () => { }) it('should preload content retrieved with object.get', function (done) { - this.timeout(20 * 1000) + this.timeout(50 * 1000) ipfs.object.new(null, { preload: false }, (err, cid) => { expect(err).to.not.exist() @@ -275,7 +276,7 @@ describe('preload', () => { }) it('should preload content added with block.put', function (done) { - this.timeout(20 * 1000) + this.timeout(50 * 1000) ipfs.block.put(Buffer.from(hat()), (err, block) => { expect(err).to.not.exist() MockPreloadNode.waitForCids(block.cid.toBaseEncodedString(), done) @@ -283,7 +284,7 @@ describe('preload', () => { }) it('should preload content retrieved with block.get', function (done) { - this.timeout(20 * 1000) + this.timeout(50 * 1000) ipfs.block.put(Buffer.from(hat()), { preload: false }, (err, block) => { expect(err).to.not.exist() ipfs.block.get(block.cid, (err) => { @@ -294,7 +295,7 @@ describe('preload', () => { }) it('should preload content retrieved with block.stat', function (done) { - this.timeout(20 * 1000) + this.timeout(50 * 1000) ipfs.block.put(Buffer.from(hat()), { preload: false }, (err, block) => { expect(err).to.not.exist() ipfs.block.stat(block.cid, (err) => { @@ -305,7 +306,7 @@ describe('preload', () => { }) it('should preload content added with dag.put', function (done) { - this.timeout(20 * 1000) + this.timeout(50 * 1000) const obj = { test: hat() } ipfs.dag.put(obj, { format: 'dag-cbor', hashAlg: 'sha2-256' }, (err, cid) => { expect(err).to.not.exist() @@ -314,7 +315,7 @@ describe('preload', () => { }) it('should preload content retrieved with dag.get', function (done) { - this.timeout(20 * 1000) + this.timeout(50 * 1000) const obj = { test: hat() } const opts = { format: 'dag-cbor', hashAlg: 'sha2-256', preload: false } ipfs.dag.put(obj, opts, (err, cid) => { @@ -328,7 +329,7 @@ describe('preload', () => { }) describe('preload disabled', function () { - this.timeout(20 * 1000) + this.timeout(50 * 1000) let ipfs let repo diff --git a/test/http-api/interface.js b/test/http-api/interface.js index 12572cdff9..3372cde3af 100644 --- a/test/http-api/interface.js +++ b/test/http-api/interface.js @@ -113,10 +113,6 @@ describe('interface-ipfs-core over ipfs-http-client tests', () => { config = undefined } - config = config || { - Bootstrap: [] - } - const spawnOptions = { repoPath, config, initOptions: { bits: 512 } } ipfsFactory.spawn(spawnOptions, (err, _ipfsd) => { diff --git a/test/http-api/routes.js b/test/http-api/routes.js index 70459438ca..0fa6fdf7df 100644 --- a/test/http-api/routes.js +++ b/test/http-api/routes.js @@ -17,7 +17,7 @@ describe('HTTP API', () => { const repoTests = path.join(__dirname, '../repo-tests-run') // bootstrap nodes get the set up too slow and gets timed out - const testsForCustomConfig = ['dht.js', 'name.js', 'ping.js'] + const testsForCustomConfig = ['dht.js', 'files.js', 'name.js', 'pin.js', 'ping.js'] let http = {} @@ -49,15 +49,18 @@ describe('HTTP API', () => { before(async function () { this.timeout(60 * 1000) + await startHttpAPI(config) }) - after(async () => { + after(async function () { + this.timeout(50 * 1000) + await http.api.stop() clean(repoTests) }) - describe('## http-api spec tests', () => { + describe('## http-api spec tests for custom config', () => { fs.readdirSync(path.join(`${__dirname}/inject/`)) .forEach((file) => testsForCustomConfig.includes(file) && require(`./inject/${file}`)(http)) }) @@ -73,12 +76,14 @@ describe('HTTP API', () => { await startHttpAPI(config) }) - after(async () => { + after(async function () { + this.timeout(50 * 1000) + await http.api.stop() clean(repoTests) }) - describe('## http-api spec tests', () => { + describe('## http-api spec tests for default config', () => { fs.readdirSync(path.join(`${__dirname}/inject/`)) .forEach((file) => !testsForCustomConfig.includes(file) && require(`./inject/${file}`)(http)) }) diff --git a/test/utils/interface-common-factory.js b/test/utils/interface-common-factory.js index 3eb4988b02..756e79c1cb 100644 --- a/test/utils/interface-common-factory.js +++ b/test/utils/interface-common-factory.js @@ -10,7 +10,20 @@ function createFactory (options) { options = options || {} options.factoryOptions = options.factoryOptions || { type: 'proc', exec: IPFS } - options.spawnOptions = options.spawnOptions || { initOptions: { bits: 512 }, config: { Bootstrap: [] } } + options.spawnOptions = options.spawnOptions || { + initOptions: { bits: 512 }, + config: { + Bootstrap: [], + Discovery: { + MDNS: { + Enabled: false + }, + webRTCStar: { + Enabled: false + } + } + } + } if (options.factoryOptions.type !== 'proc') { options.factoryOptions.IpfsClient = options.factoryOptions.IpfsClient || ipfsClient