From 392437d5eab0ef099188b5e2519ee6be3671bbc3 Mon Sep 17 00:00:00 2001 From: haad Date: Thu, 16 Feb 2017 13:17:30 +0100 Subject: [PATCH 1/3] dependencies(ipfsd-ctl): Use ipfsd-ctl 0.19.0 (go-ipfs 0.4.5) Change node factory to pass Multiaddr to the api instead of string Use ipfsd-ctl v0.19.0 which includes go-ipfs 0.4.5 Fix name tests --- package.json | 2 +- test/constructor.spec.js | 24 ++++++++++++++---------- test/ipfs-factory/client.js | 6 ++++-- test/ipfs-factory/server-routes.js | 2 +- test/name.spec.js | 4 ++-- 5 files changed, 22 insertions(+), 16 deletions(-) diff --git a/package.json b/package.json index e86096350..ddb1d95c6 100644 --- a/package.json +++ b/package.json @@ -66,7 +66,7 @@ "gulp": "^3.9.1", "hapi": "^16.1.0", "interface-ipfs-core": "~0.24.1", - "ipfsd-ctl": "~0.18.2", + "ipfsd-ctl": "~0.19.0", "pre-commit": "^1.2.2", "socket.io": "^1.7.2", "socket.io-client": "^1.7.2", diff --git a/test/constructor.spec.js b/test/constructor.spec.js index d46bc39f8..9f927629b 100644 --- a/test/constructor.spec.js +++ b/test/constructor.spec.js @@ -18,15 +18,20 @@ function clientWorks (client, done) { describe('ipfs-api constructor tests', () => { describe('parameter permuations', () => { - let apiAddr let fc + let apiAddr + let host + let port before(function (done) { this.timeout(20 * 1000) // slow CI fc = new FactoryClient() fc.spawnNode((err, node) => { expect(err).to.not.exist + expect(node.apiAddr).to.exist apiAddr = node.apiAddr + host = apiAddr.nodeAddress().address + port = apiAddr.nodeAddress().port done() }) }) @@ -34,10 +39,9 @@ describe('ipfs-api constructor tests', () => { after((done) => fc.dismantle(done)) it('opts', (done) => { - const splitted = apiAddr.split('/') clientWorks(ipfsAPI({ - host: splitted[2], - port: splitted[4], + host: host, + port: port, protocol: 'http' }), done) }) @@ -46,16 +50,16 @@ describe('ipfs-api constructor tests', () => { clientWorks(ipfsAPI(apiAddr, { protocol: 'http' }), done) }) - it('host, port', (done) => { - const splitted = apiAddr.split('/') + it('multiaddr (string), opts', (done) => { + clientWorks(ipfsAPI(apiAddr.toString(), { protocol: 'http' }), done) + }) - clientWorks(ipfsAPI(splitted[2], splitted[4]), done) + it('host, port', (done) => { + clientWorks(ipfsAPI(host, port), done) }) it('host, port, opts', (done) => { - const splitted = apiAddr.split('/') - - clientWorks(ipfsAPI(splitted[2], splitted[4], { protocol: 'http' }), done) + clientWorks(ipfsAPI(host, port, { protocol: 'http' }), done) }) }) }) diff --git a/test/ipfs-factory/client.js b/test/ipfs-factory/client.js index 5d2685b5c..1d016e1b4 100644 --- a/test/ipfs-factory/client.js +++ b/test/ipfs-factory/client.js @@ -2,6 +2,7 @@ const io = require('socket.io-client') const ipfsAPI = require('../../src') +const Multiaddr = require('multiaddr') module.exports = Factory @@ -40,8 +41,9 @@ function Factory () { function spawnNode () { ioC.once('fc-node', (apiAddr) => { - const ipfs = ipfsAPI(apiAddr) - ipfs.apiAddr = apiAddr + const addr = new Multiaddr(apiAddr) + const ipfs = ipfsAPI(addr) + ipfs.apiAddr = addr callback(null, ipfs) }) ioC.emit('fs-spawn-node', repoPath, config) diff --git a/test/ipfs-factory/server-routes.js b/test/ipfs-factory/server-routes.js index 4b0d655fe..4b83dd962 100644 --- a/test/ipfs-factory/server-routes.js +++ b/test/ipfs-factory/server-routes.js @@ -19,7 +19,7 @@ module.exports = (http) => { if (err) { throw err } - this.emit('fc-node', apiAddr) + this.emit('fc-node', apiAddr.toString()) }) } diff --git a/test/name.spec.js b/test/name.spec.js index 85d8405b7..9e08fd035 100644 --- a/test/name.spec.js +++ b/test/name.spec.js @@ -76,7 +76,7 @@ describe('.name', () => { expect(err).to.not.exist expect(res).to.exist expect(res).to.be.eql({ - Path: '/ipfs/' + name.Value + Path: name.Value }) done() }) @@ -99,7 +99,7 @@ describe('.name', () => { .then((res) => { expect(res).to.exist expect(res).to.be.eql({ - Path: '/ipfs/' + name.Value + Path: name.Value }) }) }) From 723a1e538eb1409f625cd4df13f60db142615cab Mon Sep 17 00:00:00 2001 From: Friedel Ziegelmayer Date: Mon, 20 Feb 2017 15:38:16 +0100 Subject: [PATCH 2/3] try to work around memory hungry webpack --- .travis.yml | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index ec2e62243..9996046fe 100644 --- a/.travis.yml +++ b/.travis.yml @@ -16,9 +16,12 @@ matrix: before_install: - npm install -g npm -script: +before_script: - npm run lint - - npm run test + +script: + - npm run test:node + - npm run test:browser - npm run coverage before_script: From 98128fbe0e38694989d358de02ab98697fa93cdb Mon Sep 17 00:00:00 2001 From: haad Date: Tue, 21 Feb 2017 13:56:33 +0100 Subject: [PATCH 3/3] Try fix Travis with bigger heap for tests --- package.json | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/package.json b/package.json index ddb1d95c6..23713a3d2 100644 --- a/package.json +++ b/package.json @@ -10,9 +10,9 @@ "http": "stream-http" }, "scripts": { - "test": "gulp test", - "test:node": "gulp test:node", - "test:browser": "gulp test:browser", + "test": "node --max_old_space_size=4096 node_modules/.bin/gulp test", + "test:node": "node --max_old_space_size=4096 node_modules/.bin/gulp test:node", + "test:browser": "node --max_old_space_size=4096 node_modules/.bin/gulp test:browser", "lint": "aegir-lint", "build": "gulp build", "release": "gulp release",