diff --git a/.aegir.js b/.aegir.js index 06490c5f1f..f1fe0a7b8a 100644 --- a/.aegir.js +++ b/.aegir.js @@ -1,12 +1,48 @@ 'use strict' +const parallel = require('async/parallel') +const ads = require('./test/utils/another-daemon-spawner') +const js = ads.spawnJsNode +const go = ads.spawnGoNode +const stop = ads.stopNodes + +/* + * spawns a daemon with ports numbers starting in 10 and ending in `num` + */ +function start (done) { + const base = '/ip4/127.0.0.1/tcp' + + if (!process.env.IPFS_TEST) { + parallel([ + (cb) => js([`${base}/10007`, `${base}/20007/ws`], true, 31007, 32007, cb), + (cb) => js([`${base}/10008`, `${base}/20008/ws`], true, 31008, 32008, cb), + (cb) => js([`${base}/10012`, `${base}/20012/ws`], true, 31012, 32012, cb), + (cb) => js([`${base}/10013`, `${base}/20013/ws`], true, 31013, 32013, cb), + (cb) => js([`${base}/10014`, `${base}/20014/ws`], true, 31014, 32014, cb), + (cb) => js([`${base}/10015`, `${base}/20015/ws`], true, 31015, 32015, cb) + ], done) + } else { + parallel([ + (cb) => go([`${base}/10027`, `${base}/20027/ws`], true, 33027, 44027, cb), + (cb) => go([`${base}/10028`, `${base}/20028/ws`], true, 33028, 44028, cb), + (cb) => go([`${base}/10031`, `${base}/20031/ws`], true, 33031, 44031, cb), + (cb) => go([`${base}/10032`, `${base}/20032/ws`], true, 33032, 44032, cb) + ], done) + } +} + module.exports = { karma: { files: [{ pattern: 'node_modules/interface-ipfs-core/test/fixtures/**/*', watched: false, served: true, - included: false + included: false, + singleRun: false }] + }, + hooks: { + pre: start, + post: stop } } diff --git a/examples/exchange-files-in-browser/public/js/app.js b/examples/exchange-files-in-browser/public/js/app.js index 8d14ce7c6d..1e1b7e5e07 100644 --- a/examples/exchange-files-in-browser/public/js/app.js +++ b/examples/exchange-files-in-browser/public/js/app.js @@ -33,7 +33,7 @@ function start () { if (!node) { updateView('starting', node) - node = new self.Ipfs({repo: 'ipfs-' + Math.random()}) + node = new self.Ipfs({ repo: 'ipfs-' + Math.random() }) node.on('start', () => { node.id().then((id) => { @@ -55,7 +55,7 @@ function stop () { */ function createFileBlob (data, multihash) { - const file = new window.Blob(data, {type: 'application/octet-binary'}) + const file = new window.Blob(data, { type: 'application/octet-binary' }) const fileUrl = window.URL.createObjectURL(file) const listItem = document.createElement('div') @@ -151,7 +151,7 @@ function onDrop (event) { let myReadableStreamBuffer = new streamBuffers.ReadableStreamBuffer({ // frequency: 10, // in milliseconds. - chunkSize: 32048 // in bytes. + chunkSize: 32048 // in bytes. }) node.files.createAddStream((err, stream) => { @@ -200,8 +200,8 @@ function onDrop (event) { if (files && files.length) { $multihashInput.value = files[0].hash $filesStatus.innerHTML = files - .map((e) => `Added ${e.path} as ${e.hash}`) - .join('
') + .map((e) => `Added ${e.path} as ${e.hash}`) + .join('
') } }) .catch(onError) diff --git a/examples/traverse-ipld-graphs/get-path-accross-formats.js b/examples/traverse-ipld-graphs/get-path-accross-formats.js index f3abae4d40..004c93171b 100644 --- a/examples/traverse-ipld-graphs/get-path-accross-formats.js +++ b/examples/traverse-ipld-graphs/get-path-accross-formats.js @@ -16,7 +16,7 @@ createNode((err, ipfs) => { series([ (cb) => { - const someData = new Buffer('capoeira') + const someData = Buffer.from('capoeira') dagPB.DAGNode.create(someData, (err, node) => { if (err) { diff --git a/examples/traverse-ipld-graphs/tree.js b/examples/traverse-ipld-graphs/tree.js index 6608faed27..920f7a2bb3 100644 --- a/examples/traverse-ipld-graphs/tree.js +++ b/examples/traverse-ipld-graphs/tree.js @@ -16,7 +16,7 @@ createNode((err, ipfs) => { series([ (cb) => { - const someData = new Buffer('capoeira') + const someData = Buffer.from('capoeira') dagPB.DAGNode.create(someData, (err, node) => { if (err) { diff --git a/gulpfile.js b/gulpfile.js deleted file mode 100644 index 26304b51a1..0000000000 --- a/gulpfile.js +++ /dev/null @@ -1,64 +0,0 @@ -'use strict' - -const gulp = require('gulp') -const parallel = require('async/parallel') -const series = require('async/series') -const createTempRepo = require('./test/utils/create-repo-nodejs.js') -const HTTPAPI = require('./src/http') -const leftPad = require('left-pad') - -let nodes = [] - -/* - * spawns a daemon with ports numbers starting in 10 and ending in `num` - */ -function spawnDaemon (num, callback) { - num = leftPad(num, 3, 0) - - const config = { - Addresses: { - Swarm: [ - `/ip4/127.0.0.1/tcp/10${num}`, - `/ip4/127.0.0.1/tcp/20${num}/ws` - ], - API: `/ip4/127.0.0.1/tcp/31${num}`, - Gateway: `/ip4/127.0.0.1/tcp/32${num}` - }, - Bootstrap: [], - Discovery: { - MDNS: { - Enabled: false - }, - webRTCStar: { - Enabled: false - } - } - } - - const daemon = new HTTPAPI(createTempRepo(), config) - nodes.push(daemon) - daemon.start(true, callback) -} - -gulp.task('libnode:start', (done) => { - nodes = [] - parallel([ - (cb) => spawnDaemon(7, cb), - (cb) => spawnDaemon(8, cb), - (cb) => spawnDaemon(12, cb), - (cb) => spawnDaemon(13, cb) - ], done) -}) - -gulp.task('libnode:stop', (done) => { - series(nodes.map((node) => (cb) => { - setTimeout(() => node.stop(cb), 100) - }), done) -}) - -gulp.task('test:browser:before', ['libnode:start']) -gulp.task('test:node:before', ['libnode:start']) -gulp.task('test:browser:after', ['libnode:stop']) -gulp.task('test:node:after', ['libnode:stop']) - -require('aegir/gulp')(gulp) diff --git a/package.json b/package.json index 00e02568d2..e4639e6274 100644 --- a/package.json +++ b/package.json @@ -19,29 +19,29 @@ "npm": ">=3.0.0" }, "scripts": { - "lint": "aegir-lint", - "coverage": "gulp coverage", - "test": "gulp test --dom", - "test:node": "npm run test:unit:node", - "test:browser": "npm run test:unit:browser", - "test:unit:node": "gulp test:node", - "test:unit:node:core": "TEST=core npm run test:unit:node", - "test:unit:node:http": "TEST=http npm run test:unit:node", - "test:unit:node:gateway": "TEST=gateway npm run test:unit:node", - "test:unit:node:cli": "TEST=cli npm run test:unit:node", - "test:unit:browser": "gulp test:browser", - "test:interop": "npm run test:interop:node", - "test:interop:node": "mocha -t 60000 test/interop/node.js", - "test:interop:browser": "mocha -t 60000 test/interop/browser.js", + "lint": "aegir lint", + "build": "aegir build", + "test": "aegir test -t node -t browser --no-cors", + "test:node": "aegir test -t node", + "test:browser": "aegir test -t browser -t webworker --no-cors", + "release": "aegir release -t node -t browser", + "release-minor": "aegir release --type minor -t node -t browser", + "release-major": "aegir release --type major -t node -t browser", + "test:unit:node": "aegir test -t node", + "test:unit:node:core": "aegir test -t node -f test/core/*.js", + "test:unit:node:http": "aegir test -t node -f test/http-api/index.js", + "test:unit:node:gateway": "aegir test -t node -f test/gateway/index.js", + "test:unit:node:cli": "aegir test -t node -f test/cli/index.js", + "test:unit:browser": "aegir test -t browser --no-cors", + "test:interop": "IPFS_TEST=interop aegir test -t node -t browser -f test/interop", + "test:interop:node": "IPFS_TEST=interop aegir test -t node -f test/interop/node.js", + "test:interop:browser": "IPFS_TEST=interop aegir test -t browser -f test/interop/browser.js", "test:benchmark": "echo \"Error: no benchmarks yet\" && exit 1", "test:benchmark:node": "echo \"Error: no benchmarks yet\" && exit 1", "test:benchmark:node:core": "echo \"Error: no benchmarks yet\" && exit 1", "test:benchmark:node:http": "echo \"Error: no benchmarks yet\" && exit 1", "test:benchmark:browser": "echo \"Error: no benchmarks yet\" && exit 1", - "build": "gulp build", - "release": "gulp release", - "release-minor": "gulp release --type minor", - "release-major": "gulp release --type major", + "coverage": "aegir coverage", "coverage-publish": "aegir-coverage publish" }, "pre-commit": [ @@ -62,7 +62,7 @@ }, "homepage": "https://github.com/ipfs/js-ipfs#readme", "devDependencies": { - "aegir": "^11.0.2", + "aegir": "^12.1.3", "buffer-loader": "0.0.1", "chai": "^4.1.2", "delay": "^2.0.0", @@ -74,7 +74,7 @@ "expose-loader": "^0.7.3", "form-data": "^2.3.1", "gulp": "^3.9.1", - "interface-ipfs-core": "~0.32.1", + "interface-ipfs-core": "~0.33.1", "ipfsd-ctl": "~0.24.0", "left-pad": "^1.1.3", "lodash": "^4.17.4", @@ -90,9 +90,9 @@ "transform-loader": "^0.2.4" }, "dependencies": { - "async": "^2.5.0", + "async": "^2.6.0", "bl": "^1.2.1", - "boom": "^6.0.0", + "boom": "^7.1.1", "byteman": "^1.3.5", "cids": "^0.5.2", "debug": "^3.1.0", @@ -103,20 +103,21 @@ "glob": "^7.1.2", "hapi": "^16.6.2", "hapi-set-header": "^1.0.2", - "hoek": "^5.0.0", - "ipfs-api": "^14.3.7", + "hoek": "^5.0.2", + "ipfs-api": "^15.0.1", "ipfs-bitswap": "~0.17.2", - "ipfs-block": "~0.6.0", - "ipfs-block-service": "~0.12.0", + "ipfs-block": "~0.6.1", + "ipfs-block-service": "~0.13.0", "ipfs-multipart": "~0.1.0", - "ipfs-repo": "~0.17.0", - "ipfs-unixfs": "~0.1.13", - "ipfs-unixfs-engine": "~0.22.5", - "ipld-resolver": "~0.13.4", + "ipfs-repo": "~0.18.3", + "ipfs-unixfs": "~0.1.14", + "ipfs-unixfs-engine": "~0.23.0", + "ipld-resolver": "~0.14.1", "is-ipfs": "^0.3.2", "is-stream": "^1.1.0", "joi": "^13.0.1", - "libp2p": "~0.12.4", + "libp2p": "~0.13.0", + "libp2p-circuit": "~0.1.4", "libp2p-floodsub": "~0.11.1", "libp2p-kad-dht": "~0.5.1", "libp2p-mdns": "~0.9.1", @@ -125,12 +126,12 @@ "libp2p-secio": "~0.8.1", "libp2p-tcp": "~0.11.1", "libp2p-webrtc-star": "~0.13.2", - "libp2p-websockets": "~0.10.2", + "libp2p-websockets": "~0.10.4", "lodash.flatmap": "^4.5.0", "lodash.get": "^4.4.2", "lodash.sortby": "^4.7.0", "lodash.values": "^4.3.0", - "mafmt": "^3.0.1", + "mafmt": "^3.0.2", "mime-types": "^2.1.17", "mkdirp": "~0.5.1", "multiaddr": "^3.0.1", @@ -151,7 +152,7 @@ "pull-stream": "^3.6.1", "pull-stream-to-stream": "^1.3.4", "pull-zip": "^2.0.1", - "read-pkg-up": "^2.0.0", + "read-pkg-up": "^3.0.0", "readable-stream": "2.3.3", "safe-buffer": "^5.1.1", "stream-to-pull-stream": "^1.7.2", @@ -159,10 +160,10 @@ "temp": "~0.8.3", "through2": "^2.0.3", "update-notifier": "^2.3.0", - "yargs": "9.0.1" + "yargs": "^10.0.3" }, "optionalDependencies": { - "prom-client": "^10.2.0", + "prom-client": "^10.2.2", "prometheus-gc-stats": "^0.5.0" }, "contributors": [ diff --git a/src/cli/commands/bitswap/stat.js b/src/cli/commands/bitswap/stat.js index f19d5d9f08..ef55ec0d1c 100644 --- a/src/cli/commands/bitswap/stat.js +++ b/src/cli/commands/bitswap/stat.js @@ -18,7 +18,7 @@ module.exports = { stats.Wantlist = stats.Wantlist || [] stats.Wantlist = stats.Wantlist.map((entry) => { - const buf = new Buffer(entry.cid.hash.data) + const buf = Buffer.from(entry.cid.hash.data) const cid = new CID(entry.cid.version, entry.cid.codec, buf) return cid.toBaseEncodedString() }) diff --git a/src/cli/commands/config/edit.js b/src/cli/commands/config/edit.js index 4d0c5ef865..1238e4b4ad 100644 --- a/src/cli/commands/config/edit.js +++ b/src/cli/commands/config/edit.js @@ -81,7 +81,7 @@ module.exports = { function saveConfig (config, next) { config = utils.isDaemonOn() - ? new Buffer(JSON.stringify(config)) : config + ? Buffer.from(JSON.stringify(config)) : config argv.ipfs.config.replace(config, (err) => { if (err) { diff --git a/src/cli/commands/pubsub/pub.js b/src/cli/commands/pubsub/pub.js index bed5232805..e0567cdaf7 100644 --- a/src/cli/commands/pubsub/pub.js +++ b/src/cli/commands/pubsub/pub.js @@ -8,7 +8,7 @@ module.exports = { builder: {}, handler (argv) { - const data = new Buffer(String(argv.data)) + const data = Buffer.from(String(argv.data)) argv.ipfs.pubsub.publish(argv.topic, data, (err) => { if (err) { diff --git a/src/core/boot.js b/src/core/boot.js index 5ba2e3b5b6..64f62ca631 100644 --- a/src/core/boot.js +++ b/src/core/boot.js @@ -41,9 +41,9 @@ module.exports = (self) => { // fail the whole process. // TODO: improve datastore and ipfs-repo implemenations so this error is a bit more unified if (err.message.match(/not found/) || // indexeddb - err.message.match(/ENOENT/) || // fs - err.message.match(/No value/) // memory - ) { + err.message.match(/ENOENT/) || // fs + err.message.match(/No value/) // memory + ) { return cb(null, false) } return cb(err) diff --git a/src/core/components/id.js b/src/core/components/id.js index af4eceeeb4..dedad190fd 100644 --- a/src/core/components/id.js +++ b/src/core/components/id.js @@ -14,10 +14,10 @@ module.exports = function id (self) { id: self._peerInfo.id.toB58String(), publicKey: self._peerInfo.id.pubKey.bytes.toString('base64'), addresses: self._peerInfo.multiaddrs - .toArray() - .map((ma) => ma.toString()) - .filter((ma) => ma.indexOf('ipfs') >= 0) - .sort(), + .toArray() + .map((ma) => ma.toString()) + .filter((ma) => ma.indexOf('ipfs') >= 0) + .sort(), agentVersion: 'js-ipfs', protocolVersion: '9000' })) diff --git a/src/core/components/init-assets.js b/src/core/components/init-assets.js index 1d6d46baad..af47565d20 100644 --- a/src/core/components/init-assets.js +++ b/src/core/components/init-assets.js @@ -15,20 +15,14 @@ module.exports = function addDefaultAssets (self, log, callback) { pull( pull.values([initDocsPath]), - pull.asyncMap((val, cb) => { - glob(path.join(val, '/**/*'), cb) - }), + pull.asyncMap((val, cb) => glob(path.join(val, '/**/*'), cb)), pull.flatten(), pull.map((element) => { const addPath = element.substring(index + 1) - if (fs.statSync(element).isDirectory()) { - return - } - return { - path: addPath, - content: file(element) - } + if (fs.statSync(element).isDirectory()) { return } + + return { path: addPath, content: file(element) } }), // Filter out directories, which are undefined from above pull.filter(Boolean), diff --git a/src/core/components/init.js b/src/core/components/init.js index 46084c2eb5..87e9072811 100644 --- a/src/core/components/init.js +++ b/src/core/components/init.js @@ -49,7 +49,7 @@ module.exports = function init (self) { // Generate peer identity keypair + transform to desired format + add to config. opts.log(`generating ${opts.bits}-bit RSA keypair...`, false) self.log('generating peer id: %s bits', opts.bits) - peerId.create({bits: opts.bits}, cb) + peerId.create({ bits: opts.bits }, cb) }, (keys, cb) => { self.log('identity generated') diff --git a/src/core/components/libp2p.js b/src/core/components/libp2p.js index 79064a6a5b..4ddd86d135 100644 --- a/src/core/components/libp2p.js +++ b/src/core/components/libp2p.js @@ -20,7 +20,14 @@ module.exports = function libp2p (self) { webRTCStar: get(config, 'Discovery.webRTCStar.Enabled'), bootstrap: get(config, 'Bootstrap'), dht: get(self._options, 'EXPERIMENTAL.dht'), - modules: self._libp2pModules + modules: self._libp2pModules, + relay: { + enabled: !get(config, 'EXPERIMENTAL.Swarm.DisableRelay', false), + hop: { + enabled: get(config, 'EXPERIMENTAL.Swarm.EnableRelayHop', false), + active: get(config, 'EXPERIMENTAL.Swarm.RelayHopActive', false) + } + } } self._libp2pNode = new Node(self._peerInfo, self._peerInfoBook, options) diff --git a/src/core/components/object.js b/src/core/components/object.js index 4c716c4504..1b1f51e0e1 100644 --- a/src/core/components/object.js +++ b/src/core/components/object.js @@ -16,7 +16,7 @@ function normalizeMultihash (multihash, enc) { return multihash } - return new Buffer(multihash, enc) + return Buffer.from(multihash, enc) } else if (Buffer.isBuffer(multihash)) { return multihash } else { @@ -49,7 +49,7 @@ function parseJSONBuffer (buf, callback) { mh.fromB58String(link.Hash || link.hash || link.multihash) ) }) - data = new Buffer(parsed.Data) + data = Buffer.from(parsed.Data) } catch (err) { return callback(new Error('failed to parse JSON: ' + err)) } @@ -104,7 +104,7 @@ module.exports = function object (self) { assert(template === 'unixfs-dir', 'unkown template') data = (new Unixfs('directory')).marshal() } else { - data = new Buffer(0) + data = Buffer.alloc(0) } DAGNode.create(data, (err, node) => { diff --git a/src/core/components/pre-start.js b/src/core/components/pre-start.js index 1e6fa1e370..4534513026 100644 --- a/src/core/components/pre-start.js +++ b/src/core/components/pre-start.js @@ -4,7 +4,6 @@ const peerId = require('peer-id') const PeerInfo = require('peer-info') const multiaddr = require('multiaddr') const waterfall = require('async/waterfall') -const mafmt = require('mafmt') /* * Load stuff from Repo into memory @@ -26,7 +25,7 @@ module.exports = function preStart (self) { config.Addresses.Swarm.forEach((addr) => { let ma = multiaddr(addr) - if (!mafmt.IPFS.matches(ma)) { + if (ma.getPeerId()) { ma = ma.encapsulate('/ipfs/' + self._peerInfo.id.toB58String()) } diff --git a/src/core/components/pubsub.js b/src/core/components/pubsub.js index 5feadfaf68..f42a620878 100644 --- a/src/core/components/pubsub.js +++ b/src/core/components/pubsub.js @@ -73,8 +73,8 @@ module.exports = function pubsub (self) { } const peers = Array.from(self._pubsub.peers.values()) - .filter((peer) => peer.topics.has(topic)) - .map((peer) => peer.info.id.toB58String()) + .filter((peer) => peer.topics.has(topic)) + .map((peer) => peer.info.id.toB58String()) setImmediate(() => callback(null, peers)) }), diff --git a/src/core/index.js b/src/core/index.js index 6f01d7f2ef..1b85e38291 100644 --- a/src/core/index.js +++ b/src/core/index.js @@ -106,6 +106,9 @@ class IPFS extends EventEmitter { if (this._options.EXPERIMENTAL.dht) { this.log('EXPERIMENTAL Kademlia DHT is enabled') } + if (this._options.EXPERIMENTAL.relay) { + this.log('EXPERIMENTAL Relay is enabled') + } this.state = require('./state')(this) diff --git a/src/http/api/resources/object.js b/src/http/api/resources/object.js index 4a366f4e60..16f5db9c8d 100644 --- a/src/http/api/resources/object.js +++ b/src/http/api/resources/object.js @@ -149,7 +149,7 @@ exports.put = { }) } - file = new Buffer(JSON.stringify(answer)) + file = Buffer.from(JSON.stringify(answer)) finished = true }) } else { @@ -190,7 +190,7 @@ exports.put = { series([ (cb) => { - DAGNode.create(new Buffer(node.Data), node.Links, (err, _node) => { + DAGNode.create(Buffer.from(node.Data), node.Links, (err, _node) => { if (err) { return cb(err) } diff --git a/src/http/api/resources/pubsub.js b/src/http/api/resources/pubsub.js index 39ece9935c..8d35abce97 100644 --- a/src/http/api/resources/pubsub.js +++ b/src/http/api/resources/pubsub.js @@ -68,7 +68,7 @@ exports.publish = { return reply(new Error('Missing buf')) } - ipfs.pubsub.publish(topic, new Buffer(String(buf)), (err) => { + ipfs.pubsub.publish(topic, Buffer.from(String(buf)), (err) => { if (err) { return reply(new Error(`Failed to publish to topic ${topic}: ${err}`)) } diff --git a/src/http/gateway/resources/gateway.js b/src/http/gateway/resources/gateway.js index 24f7bedd7e..54375c49b3 100644 --- a/src/http/gateway/resources/gateway.js +++ b/src/http/gateway/resources/gateway.js @@ -63,10 +63,10 @@ module.exports = { return reply(errorToString).code(404) case (errorToString.startsWith('Error: multihash length inconsistent')): case (errorToString.startsWith('Error: Non-base58 character')): - return reply({Message: errorToString, code: 0}).code(400) + return reply({ Message: errorToString, code: 0 }).code(400) default: log.error(err) - return reply({Message: errorToString, code: 0}).code(500) + return reply({ Message: errorToString, code: 0 }).code(500) } } } @@ -83,10 +83,10 @@ module.exports = { } if (ref.endsWith('/')) { - // remove trailing slash for files + // remove trailing slash for files return reply - .redirect(PathUtils.removeTrailingSlash(ref)) - .permanent(true) + .redirect(PathUtils.removeTrailingSlash(ref)) + .permanent(true) } else { if (!stream._read) { stream._read = () => {} @@ -95,7 +95,7 @@ module.exports = { // response.continue() let filetypeChecked = false - let stream2 = new Stream.PassThrough({highWaterMark: 1}) + let stream2 = new Stream.PassThrough({ highWaterMark: 1 }) let response = reply(stream2).hold() pull( diff --git a/test/cli/block.js b/test/cli/block.js index 5e328d7627..7d13fb5605 100644 --- a/test/cli/block.js +++ b/test/cli/block.js @@ -12,13 +12,13 @@ describe('block', () => runOnAndOff((thing) => { }) it('put', () => { - return ipfs('block put test/test-data/hello').then((out) => { + return ipfs('block put test/fixtures/test-data/hello').then((out) => { expect(out).to.eql('QmZjTnYw2TFhn9Nn7tjmPSoTBoY7YRkwPzwSrSbabY24Kp\n') }) }) it('put with flags, format and mhtype', () => { - return ipfs('block put --format eth-block --mhtype keccak-256 test/test-data/eth-block') + return ipfs('block put --format eth-block --mhtype keccak-256 test/fixtures/test-data/eth-block') .then((out) => expect(out).to.eql('z43AaGF23fmvRnDP56Ub9WcJCfzSfqtmzNCCvmz5eudT8dtdCDS\n')) }) @@ -29,11 +29,11 @@ describe('block', () => runOnAndOff((thing) => { }) it('get block from file without a final newline', () => { - return ipfs('block put test/test-data/no-newline').then((out) => { + return ipfs('block put test/fixtures/test-data/no-newline').then((out) => { expect(out).to.eql('QmTwbQs4sGcCiPxV97SpbHS7QgmVg9SiKxcG1AcF1Ly2SL\n') return ipfs('block get QmTwbQs4sGcCiPxV97SpbHS7QgmVg9SiKxcG1AcF1Ly2SL') }) - .then((out) => expect(out).to.eql('there is no newline at end of this file')) + .then((out) => expect(out).to.eql('there is no newline at end of this file')) }) it('stat', () => { diff --git a/test/cli/bootstrap.js b/test/cli/bootstrap.js index d042b51167..c5e440b85b 100644 --- a/test/cli/bootstrap.js +++ b/test/cli/bootstrap.js @@ -8,7 +8,8 @@ const runOnAndOff = require('../utils/on-and-off') describe('bootstrap', () => runOnAndOff((thing) => { let ipfs - before(() => { + before(function () { + this.timeout(30 * 1000) ipfs = thing.ipfs }) diff --git a/test/cli/commands.js b/test/cli/commands.js index 3305da9efe..94ffb4aad4 100644 --- a/test/cli/commands.js +++ b/test/cli/commands.js @@ -9,7 +9,8 @@ const commandCount = 56 describe('commands', () => runOnAndOff((thing) => { let ipfs - before(() => { + before(function () { + this.timeout(30 * 1000) ipfs = thing.ipfs }) diff --git a/test/cli/config.js b/test/cli/config.js index 9f13d81b25..840a7ae0ec 100644 --- a/test/cli/config.js +++ b/test/cli/config.js @@ -19,7 +19,7 @@ describe('config', () => runOnAndOff((thing) => { before(() => { ipfs = thing.ipfs configPath = path.join(ipfs.repoPath, 'config') - originalConfigPath = path.join(__dirname, '../go-ipfs-repo/config') + originalConfigPath = path.join(__dirname, '../fixtures/go-ipfs-repo/config') updatedConfig = () => JSON.parse(fs.readFileSync(configPath, 'utf8')) restoreConfig = () => fs.writeFileSync(configPath, fs.readFileSync(originalConfigPath, 'utf8'), 'utf8') }) @@ -74,7 +74,7 @@ describe('config', () => runOnAndOff((thing) => { describe('replace', () => { it('replace config with file', () => { - const filePath = 'test/test-data/otherconfig' + const filePath = 'test/fixtures/test-data/otherconfig' const expectedConfig = JSON.parse(fs.readFileSync(filePath, 'utf8')) return ipfs(`config replace ${filePath}`).then((out) => { diff --git a/test/cli/dag.js b/test/cli/dag.js index 5fd77a79e9..3a4a29785b 100644 --- a/test/cli/dag.js +++ b/test/cli/dag.js @@ -13,12 +13,12 @@ describe('dag', () => runOnAndOff.off((thing) => { it('get', () => { // put test eth-block - return ipfs('block put --format eth-block --mhtype keccak-256 test/test-data/eth-block').then((out) => { + return ipfs('block put --format eth-block --mhtype keccak-256 test/fixtures/test-data/eth-block').then((out) => { expect(out).to.eql('z43AaGF23fmvRnDP56Ub9WcJCfzSfqtmzNCCvmz5eudT8dtdCDS\n') // lookup path on eth-block return ipfs('dag get z43AaGF23fmvRnDP56Ub9WcJCfzSfqtmzNCCvmz5eudT8dtdCDS/parentHash') }).then((out) => { - let expectHash = new Buffer('c8c0a17305adea9bbb4b98a52d44f0c1478f5c48fc4b64739ee805242501b256', 'hex') + let expectHash = Buffer.from('c8c0a17305adea9bbb4b98a52d44f0c1478f5c48fc4b64739ee805242501b256', 'hex') expect(out).to.be.eql('0x' + expectHash.toString('hex') + '\n') }) }) diff --git a/test/cli/files.js b/test/cli/files.js index 6896e9e95c..c07762e1f3 100644 --- a/test/cli/files.js +++ b/test/cli/files.js @@ -11,7 +11,7 @@ const runOnAndOff = require('../utils/on-and-off') describe('files', () => runOnAndOff((thing) => { let ipfs const readme = fs.readFileSync(path.join(process.cwd(), '/src/init-files/init-docs/readme')) - .toString('utf-8') + .toString('utf-8') const recursiveGetDirResults = [ 'added QmR56UJmAaZLXLdTT1ALrE9vVqV8soUEekm9BMd4FnuYqV recursive-get-dir/version', @@ -131,14 +131,14 @@ describe('files', () => runOnAndOff((thing) => { }) it('add recursively test', () => { - return ipfs('files add -r test/test-data/recursive-get-dir') + return ipfs('files add -r test/fixtures/test-data/recursive-get-dir') .then((out) => { expect(out).to.eql(recursiveGetDirResults.join('\n') + '\n') }) }) it('add directory with trailing slash test', () => { - return ipfs('files add -r test/test-data/recursive-get-dir/') + return ipfs('files add -r test/fixtures/test-data/recursive-get-dir/') .then((out) => { expect(out).to.eql(recursiveGetDirResults.join('\n') + '\n') }) @@ -217,7 +217,7 @@ describe('files', () => runOnAndOff((thing) => { }) it('add --quieter', () => { - return ipfs('files add -Q -w test/test-data/hello test/test-data/node.json') + return ipfs('files add -Q -w test/fixtures/test-data/hello test/test-data/node.json') .then((out) => { expect(out) .to.eql('QmYRMUVULBfj7WrdPESnwnyZmtayN6Sdrwh1nKcQ9QgQeZ\n') @@ -228,7 +228,7 @@ describe('files', () => runOnAndOff((thing) => { return ipfs('files add --silent src/init-files/init-docs/readme') .then((out) => { expect(out) - .to.eql('') + .to.eql('') }) }) @@ -293,7 +293,7 @@ describe('files', () => runOnAndOff((thing) => { ) const outDir = path.join(process.cwd(), 'QmYmW4HiZhotsoSqnv2o1oUusvkRM8b9RweBoH7ao5nki2') - const expectedDir = path.join(process.cwd(), 'test', 'test-data', 'recursive-get-dir') + const expectedDir = path.join(process.cwd(), 'test', 'fixtures', 'test-data', 'recursive-get-dir') const compareResult = compareDir(outDir, expectedDir, { compareContent: true, diff --git a/test/cli/id.js b/test/cli/id.js index 2770ede88b..412837d386 100644 --- a/test/cli/id.js +++ b/test/cli/id.js @@ -7,7 +7,8 @@ const runOnAndOff = require('../utils/on-and-off') describe('id', () => runOnAndOff((thing) => { let ipfs - before(() => { + before(function () { + this.timeout(30 * 1000) ipfs = thing.ipfs }) diff --git a/test/cli/init.js b/test/cli/init.js index 7953f0fcaf..7ffa915f70 100644 --- a/test/cli/init.js +++ b/test/cli/init.js @@ -13,7 +13,7 @@ describe('init', () => { let ipfs const readme = fs.readFileSync(path.join(process.cwd(), '/src/init-files/init-docs/readme')) - .toString('utf-8') + .toString('utf-8') const repoExistsSync = (p) => fs.existsSync(path.join(repoPath, p)) @@ -29,7 +29,8 @@ describe('init', () => { afterEach(() => clean(repoPath)) - it('basic', () => { + it('basic', function () { + this.timeout(20 * 1000) return ipfs('init').then((out) => { expect(repoDirSync('blocks')).to.have.length.above(2) expect(repoExistsSync('config')).to.equal(true) @@ -40,7 +41,7 @@ describe('init', () => { let command = out.substring(out.indexOf('files cat'), out.length - 2 /* omit the newline char */) return ipfs(command) }).then((out) => expect(out).to.equal(readme)) - }).timeout(8000) + }) it('bits', () => { return ipfs('init --bits 1024').then(() => { diff --git a/test/cli/object.js b/test/cli/object.js index 91b38e9b17..3a6439d143 100644 --- a/test/cli/object.js +++ b/test/cli/object.js @@ -37,7 +37,7 @@ describe('object', () => runOnAndOff((thing) => { }) it('put', () => { - return ipfs('object put test/test-data/node.json').then((out) => { + return ipfs('object put test/fixtures/test-data/node.json').then((out) => { expect(out).to.eql( 'added QmZZmY4KCu9r3e7M2Pcn46Fc5qbn6NpzaAGaYb22kbfTqm\n' ) @@ -72,7 +72,7 @@ describe('object', () => runOnAndOff((thing) => { describe('patch', () => { it('append-data', () => { - return ipfs('object patch append-data QmdfTbBqBPQ7VNxZEYEj14VmRuZBkqFbiwReogJgS1zR1n test/test-data/badconfig').then((out) => { + return ipfs('object patch append-data QmdfTbBqBPQ7VNxZEYEj14VmRuZBkqFbiwReogJgS1zR1n test/fixtures/test-data/badconfig').then((out) => { expect(out).to.eql( 'QmfY37rjbPCZRnhvvJuQ46htW3VCAWziVB991P79h6WSv6\n' ) @@ -80,7 +80,7 @@ describe('object', () => runOnAndOff((thing) => { }) it('set-data', () => { - return ipfs('object patch set-data QmfY37rjbPCZRnhvvJuQ46htW3VCAWziVB991P79h6WSv6 test/test-data/badconfig').then((out) => { + return ipfs('object patch set-data QmfY37rjbPCZRnhvvJuQ46htW3VCAWziVB991P79h6WSv6 test/fixtures/test-data/badconfig').then((out) => { expect(out).to.eql( 'QmfY37rjbPCZRnhvvJuQ46htW3VCAWziVB991P79h6WSv6\n' ) diff --git a/test/cli/swarm.js b/test/cli/swarm.js index b286abcf49..546984b707 100644 --- a/test/cli/swarm.js +++ b/test/cli/swarm.js @@ -19,7 +19,7 @@ describe('swarm', () => { // CI takes longer to instantiate the daemon, // so we need to increase the timeout for the // before step - this.timeout(20 * 1000) + this.timeout(25 * 1000) factory = new Factory() @@ -46,7 +46,9 @@ describe('swarm', () => { after((done) => factory.dismantle(done)) - describe('daemon on (through http-api)', () => { + describe('daemon on (through http-api)', function () { + this.timeout(10 * 1000) + it('connect', () => { return ipfsA('swarm', 'connect', bMultiaddr).then((out) => { expect(out).to.eql(`connect ${bMultiaddr} success\n`) @@ -55,7 +57,7 @@ describe('swarm', () => { it('peers', () => { return ipfsA('swarm peers').then((out) => { - expect(out).to.be.eql(bMultiaddr + '\n') + expect(out).to.eql(bMultiaddr + '\n') }) }) diff --git a/test/cli/version.js b/test/cli/version.js index e5f0710dae..44986adf77 100644 --- a/test/cli/version.js +++ b/test/cli/version.js @@ -14,7 +14,7 @@ describe('version', () => runOnAndOff((thing) => { it('get the version', () => { return ipfs('version').then((out) => { - expect(out).to.be.eql( + expect(out).to.eql( `js-ipfs version: ${pkgversion}\n` ) }) diff --git a/test/core/bitswap.spec.js b/test/core/bitswap.spec.js index ec8044d0e3..9c6341636e 100644 --- a/test/core/bitswap.spec.js +++ b/test/core/bitswap.spec.js @@ -18,66 +18,63 @@ const multiaddr = require('multiaddr') const isNode = require('detect-node') const multihashing = require('multihashing-async') const CID = require('cids') -const Buffer = require('safe-buffer').Buffer // This gets replaced by '../utils/create-repo-browser.js' in the browser const createTempRepo = require('../utils/create-repo-nodejs.js') const IPFS = require('../../src/core') -function makeBlock (cb) { +function makeBlock (callback) { const d = Buffer.from(`IPFS is awesome ${Math.random()}`) multihashing(d, 'sha2-256', (err, multihash) => { if (err) { - return cb(err) + return callback(err) } - cb(null, new Block(d, new CID(multihash))) + callback(null, new Block(d, new CID(multihash))) }) } describe('bitswap', () => { let inProcNode // Node spawned inside this process - beforeEach((done) => { - const repo = createTempRepo() + beforeEach(function (done) { + this.timeout(15 * 1000) + + let config = { + repo: createTempRepo(), + config: { + Addresses: { + Swarm: [] + }, + Discovery: { + MDNS: { + Enabled: false + } + }, + Bootstrap: [] + } + } - if (!isNode) { - inProcNode = new IPFS({ - repo: repo, - config: { - Addresses: { - Swarm: [] - }, - Discovery: { - MDNS: { - Enabled: false - } - }, - Bootstrap: [] - } - }) - } else { - inProcNode = new IPFS({ - repo: repo, + if (isNode) { + config = Object.assign(config, { config: { Addresses: { - Swarm: [ '/ip4/127.0.0.1/tcp/0' ] - }, - Discovery: { - MDNS: { - Enabled: false - } - }, - Bootstrap: [] + Swarm: ['/ip4/127.0.0.1/tcp/0'] + } } }) } + inProcNode = new IPFS(config) inProcNode.on('start', () => done()) }) - afterEach((done) => inProcNode.stop(() => done())) + afterEach(function (done) { + this.timeout(15 * 1000) + + inProcNode.stop(() => done()) + }) describe('connections', () => { function wire (targetNode, dialerNode, done) { @@ -103,11 +100,9 @@ describe('bitswap', () => { function connectNodes (remoteNode, ipn, done) { series([ (cb) => wire(remoteNode, ipn, cb), - (cb) => setTimeout(() => { - // need timeout so we wait for identify to happen. - // This call is just to ensure identify happened - wire(ipn, remoteNode, cb) - }, 300) + // need timeout so we wait for identify to happen. + // This call is just to ensure identify happened + (cb) => setTimeout(() => wire(ipn, remoteNode, cb), 300) ], done) } @@ -121,7 +116,9 @@ describe('bitswap', () => { } describe('fetches a remote block', () => { - it('2 peers', (done) => { + it('2 peers', function (done) { + this.timeout(10 * 1000) + let remoteNode let block waterfall([ @@ -137,14 +134,14 @@ describe('bitswap', () => { (cb) => remoteNode.block.put(block, cb), (key, cb) => inProcNode.block.get(block.cid, cb), (b, cb) => { - expect(b.data).to.be.eql(block.data) + expect(b.data).to.eql(block.data) cb() } ], done) }) it('3 peers', function (done) { - this.timeout(60 * 1000) + this.timeout(20 * 1000) let blocks const remoteNodes = [] @@ -192,7 +189,7 @@ describe('bitswap', () => { describe('fetches a remote file', () => { it('2 peers', (done) => { - const file = new Buffer(`I love IPFS <3 ${Math.random()}`) + const file = Buffer.from(`I love IPFS <3 ${Math.random()}`) waterfall([ // 0. Start node @@ -221,7 +218,9 @@ describe('bitswap', () => { describe('bitswap API', () => { let node - before((done) => { + before(function (done) { + this.timeout(15 * 1000) + node = new IPFS({ repo: createTempRepo(), start: false, @@ -236,7 +235,7 @@ describe('bitswap', () => { } } }) - setTimeout(() => done(), 500) + node.on('ready', () => done()) }) describe('while offline', () => { @@ -255,7 +254,9 @@ describe('bitswap', () => { }) describe('while online', () => { - before((done) => { + before(function (done) { + this.timeout(15 * 1000) + node.start(() => done()) }) diff --git a/test/core/circuit-relay.spec.js b/test/core/circuit-relay.spec.js new file mode 100644 index 0000000000..2068eec4a8 --- /dev/null +++ b/test/core/circuit-relay.spec.js @@ -0,0 +1,143 @@ +/* eslint max-nested-callbacks: ["error", 8] */ +/* eslint-env mocha */ +'use strict' + +const chai = require('chai') +const dirtyChai = require('dirty-chai') +const expect = chai.expect +chai.use(dirtyChai) +const parallel = require('async/parallel') +const series = require('async/series') +const waterfall = require('async/waterfall') +const API = require('ipfs-api') +const bl = require('bl') +const PeerInfo = require('peer-info') +const PeerId = require('peer-id') +const multiaddr = require('multiaddr') +const isNode = require('detect-node') +const crypto = require('crypto') +const IPFSFactory = require('../utils/ipfs-factory-instance') + +function peerInfoFromObj (obj, callback) { + waterfall([ + (cb) => PeerInfo.create(PeerId.createFromB58String(obj.id), cb), + (peer, cb) => { + obj.addresses.forEach((a) => peer.multiaddrs.add(multiaddr(a))) + cb(null, peer) + } + ], callback) +} + +describe('circuit', function () { + this.timeout(20 * 1000) + + let factory + + let jsRelay = new API(`/ip4/127.0.0.1/tcp/31015`) + // let goRelay = new API(`/ip4/127.0.0.1/tcp/33031`) + let node1 + let node2 + + let jsRelayId + let goRelayId + + // let nodeId1 + let nodeId2 + + before((done) => { + factory = new IPFSFactory() + + const base = { + EXPERIMENTAL: { + Relay: { + Enabled: true + } + }, + Addresses: { + Swarm: [] + } + } + + parallel([ + (cb) => factory.spawnNode(null, Object.assign(base, { + Addresses: { + Swarm: [ (isNode ? `/ip4/127.0.0.1/tcp/0` : '') ] + } + }), cb), + (cb) => factory.spawnNode(null, Object.assign(base, { + Addresses: { + Swarm: [ (isNode ? `/ip4/127.0.0.1/tcp/0/ws` : '') ] + } + }), cb) + ], (err, nodes) => { + expect(err).to.not.exist() + node1 = nodes[0] + node2 = nodes[1] + + parallel([ + (cb) => jsRelay.id(cb), + // (cb) => goRelay.id(cb), + (cb) => node1.id(cb), + (cb) => node2.id(cb) + ], (err, res2) => { + expect(err).to.not.exist() + parallel([ + (cb) => peerInfoFromObj(res2[0], cb), + // (cb) => peerInfoFromObj(res2[1], cb), + (cb) => peerInfoFromObj(res2[1], cb), + (cb) => peerInfoFromObj(res2[2], cb) + ], (err, res3) => { + expect(err).to.not.exist() + jsRelayId = res3[0] + // goRelayId = res3[1] + // nodeId1 = res3[2] + nodeId2 = res3[2] + done() + }) + }) + }) + }) + + after((done) => factory.dismantle(done)) + + // TODO: 1) figure out why this test hangs randomly + // TODO: 2) move this test to the interop batch + it.skip('node1 <-> goRelay <-> node2', (done) => { + const data = crypto.randomBytes(128) + + series([ + (cb) => node1.swarm.connect(goRelayId, cb), + (cb) => setTimeout(cb, 1000), + (cb) => node2.swarm.connect(goRelayId, cb), + (cb) => setTimeout(cb, 1000), + (cb) => node1.swarm.connect(nodeId2, cb) + ], (err) => { + expect(err).to.not.exist() + waterfall([ + (cb) => node1.files.add(data, cb), + (filesAdded, cb) => node2.files.cat(filesAdded[0].hash, cb), + (stream, cb) => stream.pipe(bl(cb)) + ], done) + }) + }) + + it('node1 <-> jsRelay <-> node2', (done) => { + const data = crypto.randomBytes(128) + + series([ + (cb) => node1.swarm.connect(jsRelayId, cb), + (cb) => setTimeout(cb, 1000), + (cb) => node2.swarm.connect(jsRelayId, cb), + (cb) => setTimeout(cb, 1000), + (cb) => node1.swarm.connect(nodeId2, cb) + ], (err) => { + expect(err).to.not.exist() + + waterfall([ + (cb) => node1.files.add(data, cb), + (filesAdded, cb) => node2.files.cat(filesAdded[0].hash, cb), + (stream, cb) => stream.pipe(bl(cb)) + ], done) + }) + }) +}) diff --git a/test/core/create-node.spec.js b/test/core/create-node.spec.js index eff0dc8cae..0719fd8eac 100644 --- a/test/core/create-node.spec.js +++ b/test/core/create-node.spec.js @@ -15,7 +15,9 @@ const IPFS = require('../../src/core') const createTempRepo = require('../utils/create-repo-nodejs.js') describe('create node', () => { - it('custom repoPath', (done) => { + it('custom repoPath', function (done) { + this.timeout(15 * 1000) + const node = new IPFS({ repo: '/tmp/ipfs-repo-' + Math.random(), config: { @@ -38,7 +40,9 @@ describe('create node', () => { }) }) - it('custom repo', (done) => { + it('custom repo', function (done) { + this.timeout(15 * 1000) + const node = new IPFS({ repo: createTempRepo(), config: { @@ -60,7 +64,8 @@ describe('create node', () => { }) }) - it('IPFS.createNode', (done) => { + it('IPFS.createNode', function (done) { + this.timeout(15 * 1000) const node = IPFS.createNode({ repo: createTempRepo(), config: { @@ -154,7 +159,8 @@ describe('create node', () => { }, 250) }) - it('init: true, start: false', (done) => { + it('init: true, start: false', function (done) { + this.timeout(20 * 1000) const node = new IPFS({ repo: createTempRepo(), init: true, @@ -174,7 +180,9 @@ describe('create node', () => { node.once('ready', () => node.start()) }) - it('init: true, start: false, use callback', (done) => { + it('init: true, start: false, use callback', function (done) { + this.timeout(20 * 1000) + const node = new IPFS({ repo: createTempRepo(), init: true, @@ -188,12 +196,12 @@ describe('create node', () => { }) node.once('error', done) - node.once('ready', () => { - node.start(() => node.stop(done)) - }) + node.once('ready', () => node.start(() => node.stop(done))) }) - it('overload config', (done) => { + it('overload config', function (done) { + this.timeout(20 * 1000) + if (!isNode) { return done() } @@ -223,7 +231,9 @@ describe('create node', () => { }) }) - it('start and stop, start and stop', (done) => { + it('start and stop, start and stop', function (done) { + this.timeout(15 * 1000) + const node = new IPFS({ repo: createTempRepo(), config: { @@ -242,7 +252,9 @@ describe('create node', () => { ], done) }) - it('can start node twice without crash', (done) => { + it('can start node twice without crash', function (done) { + this.timeout(15 * 1000) + const options = { repo: createTempRepo(), config: { diff --git a/test/core/files-sharding.spec.js b/test/core/files-sharding.spec.js index 1b9167dfbb..588281b3c4 100644 --- a/test/core/files-sharding.spec.js +++ b/test/core/files-sharding.spec.js @@ -7,7 +7,6 @@ const dirtyChai = require('dirty-chai') const expect = chai.expect chai.use(dirtyChai) const pull = require('pull-stream') -const Buffer = require('safe-buffer').Buffer const IPFS = require('../../src/core') const createTempRepo = require('../utils/create-repo-nodejs.js') @@ -24,7 +23,9 @@ describe('files dir', () => { describe('without sharding', () => { let ipfs - before((done) => { + before(function (done) { + this.timeout(15 * 1000) + ipfs = new IPFS({ repo: createTempRepo(), config: { @@ -39,7 +40,9 @@ describe('files dir', () => { after((done) => ipfs.stop(done)) - it('should be able to add dir without sharding', (done) => { + it('should be able to add dir without sharding', function (done) { + this.timeout(15 * 1000) + pull( pull.values(files), ipfs.files.createAddPullStream(), @@ -61,7 +64,9 @@ describe('files dir', () => { describe('with sharding', () => { let ipfs - before((done) => { + before(function (done) { + this.timeout(15 * 1000) + ipfs = new IPFS({ repo: createTempRepo(), config: { @@ -77,11 +82,11 @@ describe('files dir', () => { ipfs.once('start', done) }) - after((done) => { - ipfs.stop(() => done()) // ignore stop errors - }) + after((done) => ipfs.stop(done)) + + it('should be able to add dir with sharding', function (done) { + this.timeout(15 * 1000) - it('should be able to add dir with sharding', (done) => { pull( pull.values(files), ipfs.files.createAddPullStream(), diff --git a/test/core/init.spec.js b/test/core/init.spec.js index 309ef2265b..b9a61fe209 100644 --- a/test/core/init.spec.js +++ b/test/core/init.spec.js @@ -18,7 +18,9 @@ const IPFS = require('../../src/core') const createTempRepo = require('../utils/create-repo-nodejs.js') describe('init', () => { - if (!isNode) { return } + if (!isNode) { + return + } let ipfs let repo @@ -52,7 +54,8 @@ describe('init', () => { }) }) - it('set # of bits in key', (done) => { + it('set # of bits in key', function (done) { + this.timeout(20 * 1000) ipfs.init({ bits: 2048 }, (err) => { expect(err).to.not.exist() @@ -82,7 +85,7 @@ describe('init', () => { expect(err).to.not.exist() // Should not have default assets - const multihash = new Buffer('12205e7c3ce237f936c76faf625e90f7751a9f5eeb048f59873303c215e9cce87599', 'hex') + const multihash = Buffer.from('12205e7c3ce237f936c76faf625e90f7751a9f5eeb048f59873303c215e9cce87599', 'hex') ipfs.object.get(multihash, {}, (err, node) => { expect(err).to.exist() diff --git a/test/core/kad-dht.node.js b/test/core/kad-dht.node.js index f7167dc319..63a527c532 100644 --- a/test/core/kad-dht.node.js +++ b/test/core/kad-dht.node.js @@ -8,7 +8,6 @@ const expect = chai.expect chai.use(dirtyChai) const bl = require('bl') const parallel = require('async/parallel') -const Buffer = require('safe-buffer') const IPFSFactory = require('../utils/ipfs-factory-instance') describe('verify that kad-dht is doing its thing', () => { @@ -62,7 +61,7 @@ describe('verify that kad-dht is doing its thing', () => { expect(err).to.not.exist() stream.pipe(bl((err, data) => { expect(err).to.not.exist() - expect(data).to.eql(new Buffer('hello kad')) + expect(data).to.eql(Buffer.from('hello kad')) done() })) }) diff --git a/test/go-ipfs-repo/blocks/2F/CIQEUWUVLBXVFYSYCHHSCRTXCYHGIOBXKWUMKFR3UPAFHQ5WK5362FQ.data b/test/fixtures/go-ipfs-repo/blocks/2F/CIQEUWUVLBXVFYSYCHHSCRTXCYHGIOBXKWUMKFR3UPAFHQ5WK5362FQ.data similarity index 100% rename from test/go-ipfs-repo/blocks/2F/CIQEUWUVLBXVFYSYCHHSCRTXCYHGIOBXKWUMKFR3UPAFHQ5WK5362FQ.data rename to test/fixtures/go-ipfs-repo/blocks/2F/CIQEUWUVLBXVFYSYCHHSCRTXCYHGIOBXKWUMKFR3UPAFHQ5WK5362FQ.data diff --git a/test/go-ipfs-repo/blocks/5V/CIQFFRR4O52TS2Z7QLDDTF32OIR4FWLKT5YLL7MLDVIT7DC3NHOK5VA.data b/test/fixtures/go-ipfs-repo/blocks/5V/CIQFFRR4O52TS2Z7QLDDTF32OIR4FWLKT5YLL7MLDVIT7DC3NHOK5VA.data similarity index 100% rename from test/go-ipfs-repo/blocks/5V/CIQFFRR4O52TS2Z7QLDDTF32OIR4FWLKT5YLL7MLDVIT7DC3NHOK5VA.data rename to test/fixtures/go-ipfs-repo/blocks/5V/CIQFFRR4O52TS2Z7QLDDTF32OIR4FWLKT5YLL7MLDVIT7DC3NHOK5VA.data diff --git a/test/go-ipfs-repo/blocks/5X/CIQJ23BL4UHXA2KTI6NLTXZM4PW4VEFWQBJ4ACZQAS37BLGL4HUO5XY.data b/test/fixtures/go-ipfs-repo/blocks/5X/CIQJ23BL4UHXA2KTI6NLTXZM4PW4VEFWQBJ4ACZQAS37BLGL4HUO5XY.data similarity index 100% rename from test/go-ipfs-repo/blocks/5X/CIQJ23BL4UHXA2KTI6NLTXZM4PW4VEFWQBJ4ACZQAS37BLGL4HUO5XY.data rename to test/fixtures/go-ipfs-repo/blocks/5X/CIQJ23BL4UHXA2KTI6NLTXZM4PW4VEFWQBJ4ACZQAS37BLGL4HUO5XY.data diff --git a/test/go-ipfs-repo/blocks/75/CIQMB7DLJFKD267QJ2B5FJNHZPTSVA7IB6OHXSQ2XSVEEKMKK6RT75I.data b/test/fixtures/go-ipfs-repo/blocks/75/CIQMB7DLJFKD267QJ2B5FJNHZPTSVA7IB6OHXSQ2XSVEEKMKK6RT75I.data similarity index 100% rename from test/go-ipfs-repo/blocks/75/CIQMB7DLJFKD267QJ2B5FJNHZPTSVA7IB6OHXSQ2XSVEEKMKK6RT75I.data rename to test/fixtures/go-ipfs-repo/blocks/75/CIQMB7DLJFKD267QJ2B5FJNHZPTSVA7IB6OHXSQ2XSVEEKMKK6RT75I.data diff --git a/test/go-ipfs-repo/blocks/7J/CIQKKLBWAIBQZOIS5X7E32LQAL6236OUKZTMHPQSFIXPWXNZHQOV7JQ.data b/test/fixtures/go-ipfs-repo/blocks/7J/CIQKKLBWAIBQZOIS5X7E32LQAL6236OUKZTMHPQSFIXPWXNZHQOV7JQ.data similarity index 100% rename from test/go-ipfs-repo/blocks/7J/CIQKKLBWAIBQZOIS5X7E32LQAL6236OUKZTMHPQSFIXPWXNZHQOV7JQ.data rename to test/fixtures/go-ipfs-repo/blocks/7J/CIQKKLBWAIBQZOIS5X7E32LQAL6236OUKZTMHPQSFIXPWXNZHQOV7JQ.data diff --git a/test/go-ipfs-repo/blocks/AE/CIQONICFQZH7QVU6IPSIM3AK7AD554D3BWZPAGEAQYQOWMFZQDUUAEI.data b/test/fixtures/go-ipfs-repo/blocks/AE/CIQONICFQZH7QVU6IPSIM3AK7AD554D3BWZPAGEAQYQOWMFZQDUUAEI.data similarity index 100% rename from test/go-ipfs-repo/blocks/AE/CIQONICFQZH7QVU6IPSIM3AK7AD554D3BWZPAGEAQYQOWMFZQDUUAEI.data rename to test/fixtures/go-ipfs-repo/blocks/AE/CIQONICFQZH7QVU6IPSIM3AK7AD554D3BWZPAGEAQYQOWMFZQDUUAEI.data diff --git a/test/go-ipfs-repo/blocks/AP/CIQHAKDLTL5GMIFGN5YVY4BA22FPHUIODJEXS4LCTQDWA275XAJDAPI.data b/test/fixtures/go-ipfs-repo/blocks/AP/CIQHAKDLTL5GMIFGN5YVY4BA22FPHUIODJEXS4LCTQDWA275XAJDAPI.data similarity index 100% rename from test/go-ipfs-repo/blocks/AP/CIQHAKDLTL5GMIFGN5YVY4BA22FPHUIODJEXS4LCTQDWA275XAJDAPI.data rename to test/fixtures/go-ipfs-repo/blocks/AP/CIQHAKDLTL5GMIFGN5YVY4BA22FPHUIODJEXS4LCTQDWA275XAJDAPI.data diff --git a/test/go-ipfs-repo/blocks/C4/CIQDDZ5EDQK5AP7LRTLZHQZUR2R3GECRFV3WPKNL7PL2SKFIL2LXC4Y.data b/test/fixtures/go-ipfs-repo/blocks/C4/CIQDDZ5EDQK5AP7LRTLZHQZUR2R3GECRFV3WPKNL7PL2SKFIL2LXC4Y.data similarity index 100% rename from test/go-ipfs-repo/blocks/C4/CIQDDZ5EDQK5AP7LRTLZHQZUR2R3GECRFV3WPKNL7PL2SKFIL2LXC4Y.data rename to test/fixtures/go-ipfs-repo/blocks/C4/CIQDDZ5EDQK5AP7LRTLZHQZUR2R3GECRFV3WPKNL7PL2SKFIL2LXC4Y.data diff --git a/test/go-ipfs-repo/blocks/CY/CIQDMKFEUGKSLXMEXO774EZOYCYNHPRVFD53ZSAU7237F67XDSQGCYQ.data b/test/fixtures/go-ipfs-repo/blocks/CY/CIQDMKFEUGKSLXMEXO774EZOYCYNHPRVFD53ZSAU7237F67XDSQGCYQ.data similarity index 100% rename from test/go-ipfs-repo/blocks/CY/CIQDMKFEUGKSLXMEXO774EZOYCYNHPRVFD53ZSAU7237F67XDSQGCYQ.data rename to test/fixtures/go-ipfs-repo/blocks/CY/CIQDMKFEUGKSLXMEXO774EZOYCYNHPRVFD53ZSAU7237F67XDSQGCYQ.data diff --git a/test/go-ipfs-repo/blocks/DU/CIQLBK52T5EHVHZY5URTG5JS3JCUJDQM2DRB5RVF33DCUUOFJNGVDUI.data b/test/fixtures/go-ipfs-repo/blocks/DU/CIQLBK52T5EHVHZY5URTG5JS3JCUJDQM2DRB5RVF33DCUUOFJNGVDUI.data similarity index 100% rename from test/go-ipfs-repo/blocks/DU/CIQLBK52T5EHVHZY5URTG5JS3JCUJDQM2DRB5RVF33DCUUOFJNGVDUI.data rename to test/fixtures/go-ipfs-repo/blocks/DU/CIQLBK52T5EHVHZY5URTG5JS3JCUJDQM2DRB5RVF33DCUUOFJNGVDUI.data diff --git a/test/go-ipfs-repo/blocks/DX/CIQPDQJBGYDZNMOAGGYNRNMP2VDKWBWGAEDDEJDACM3SGG3VIANDDXI.data b/test/fixtures/go-ipfs-repo/blocks/DX/CIQPDQJBGYDZNMOAGGYNRNMP2VDKWBWGAEDDEJDACM3SGG3VIANDDXI.data similarity index 100% rename from test/go-ipfs-repo/blocks/DX/CIQPDQJBGYDZNMOAGGYNRNMP2VDKWBWGAEDDEJDACM3SGG3VIANDDXI.data rename to test/fixtures/go-ipfs-repo/blocks/DX/CIQPDQJBGYDZNMOAGGYNRNMP2VDKWBWGAEDDEJDACM3SGG3VIANDDXI.data diff --git a/test/go-ipfs-repo/blocks/FN/CIQIXBZMUTXFC5QIGMLJNXLLHZOPGSL2PBC65D4UIVWM6TI5F5TAFNI.data b/test/fixtures/go-ipfs-repo/blocks/FN/CIQIXBZMUTXFC5QIGMLJNXLLHZOPGSL2PBC65D4UIVWM6TI5F5TAFNI.data similarity index 100% rename from test/go-ipfs-repo/blocks/FN/CIQIXBZMUTXFC5QIGMLJNXLLHZOPGSL2PBC65D4UIVWM6TI5F5TAFNI.data rename to test/fixtures/go-ipfs-repo/blocks/FN/CIQIXBZMUTXFC5QIGMLJNXLLHZOPGSL2PBC65D4UIVWM6TI5F5TAFNI.data diff --git a/test/go-ipfs-repo/blocks/GQ/CIQH7OEYWXL34RWYL7VXLWEU4FWPVGT24VJT7DUZPTNLF25N25IGGQA.data b/test/fixtures/go-ipfs-repo/blocks/GQ/CIQH7OEYWXL34RWYL7VXLWEU4FWPVGT24VJT7DUZPTNLF25N25IGGQA.data similarity index 100% rename from test/go-ipfs-repo/blocks/GQ/CIQH7OEYWXL34RWYL7VXLWEU4FWPVGT24VJT7DUZPTNLF25N25IGGQA.data rename to test/fixtures/go-ipfs-repo/blocks/GQ/CIQH7OEYWXL34RWYL7VXLWEU4FWPVGT24VJT7DUZPTNLF25N25IGGQA.data diff --git a/test/go-ipfs-repo/blocks/HD/CIQDDVW2EZIJF4NQH7WJNESD7XHQSXA5EGJVNTPVHD7444C2KLKXHDI.data b/test/fixtures/go-ipfs-repo/blocks/HD/CIQDDVW2EZIJF4NQH7WJNESD7XHQSXA5EGJVNTPVHD7444C2KLKXHDI.data similarity index 100% rename from test/go-ipfs-repo/blocks/HD/CIQDDVW2EZIJF4NQH7WJNESD7XHQSXA5EGJVNTPVHD7444C2KLKXHDI.data rename to test/fixtures/go-ipfs-repo/blocks/HD/CIQDDVW2EZIJF4NQH7WJNESD7XHQSXA5EGJVNTPVHD7444C2KLKXHDI.data diff --git a/test/go-ipfs-repo/blocks/IL/CIQJFGRQHQ45VCQLM7AJNF2GF5UHUAGGHC6LLAH6VYDEKLQMD4QLILY.data b/test/fixtures/go-ipfs-repo/blocks/IL/CIQJFGRQHQ45VCQLM7AJNF2GF5UHUAGGHC6LLAH6VYDEKLQMD4QLILY.data similarity index 100% rename from test/go-ipfs-repo/blocks/IL/CIQJFGRQHQ45VCQLM7AJNF2GF5UHUAGGHC6LLAH6VYDEKLQMD4QLILY.data rename to test/fixtures/go-ipfs-repo/blocks/IL/CIQJFGRQHQ45VCQLM7AJNF2GF5UHUAGGHC6LLAH6VYDEKLQMD4QLILY.data diff --git a/test/go-ipfs-repo/blocks/IR/CIQERMRAAFXUAUOX3V2DCW7R77FRIVHQ3V5OIPPS3XQBX34KRPNOIRQ.data b/test/fixtures/go-ipfs-repo/blocks/IR/CIQERMRAAFXUAUOX3V2DCW7R77FRIVHQ3V5OIPPS3XQBX34KRPNOIRQ.data similarity index 100% rename from test/go-ipfs-repo/blocks/IR/CIQERMRAAFXUAUOX3V2DCW7R77FRIVHQ3V5OIPPS3XQBX34KRPNOIRQ.data rename to test/fixtures/go-ipfs-repo/blocks/IR/CIQERMRAAFXUAUOX3V2DCW7R77FRIVHQ3V5OIPPS3XQBX34KRPNOIRQ.data diff --git a/test/go-ipfs-repo/blocks/LG/CIQJBQD2O6K4CGJVCCTJNUP57QHR4SKHZ74OIITBBGLOMCO3ZOLWLGA.data b/test/fixtures/go-ipfs-repo/blocks/LG/CIQJBQD2O6K4CGJVCCTJNUP57QHR4SKHZ74OIITBBGLOMCO3ZOLWLGA.data similarity index 100% rename from test/go-ipfs-repo/blocks/LG/CIQJBQD2O6K4CGJVCCTJNUP57QHR4SKHZ74OIITBBGLOMCO3ZOLWLGA.data rename to test/fixtures/go-ipfs-repo/blocks/LG/CIQJBQD2O6K4CGJVCCTJNUP57QHR4SKHZ74OIITBBGLOMCO3ZOLWLGA.data diff --git a/test/go-ipfs-repo/blocks/M4/CIQOLBQZSZAODJGGH6RYYVBUXHTS3SM5EORZDU63LYPEFUAFE4SBM4I.data b/test/fixtures/go-ipfs-repo/blocks/M4/CIQOLBQZSZAODJGGH6RYYVBUXHTS3SM5EORZDU63LYPEFUAFE4SBM4I.data similarity index 100% rename from test/go-ipfs-repo/blocks/M4/CIQOLBQZSZAODJGGH6RYYVBUXHTS3SM5EORZDU63LYPEFUAFE4SBM4I.data rename to test/fixtures/go-ipfs-repo/blocks/M4/CIQOLBQZSZAODJGGH6RYYVBUXHTS3SM5EORZDU63LYPEFUAFE4SBM4I.data diff --git a/test/go-ipfs-repo/blocks/O6/CIQOYW2THIZBRGI7IN33ROGCKOFZLXJJ2MPKYZBTV4H3N7GYHXMAO6A.data b/test/fixtures/go-ipfs-repo/blocks/O6/CIQOYW2THIZBRGI7IN33ROGCKOFZLXJJ2MPKYZBTV4H3N7GYHXMAO6A.data similarity index 100% rename from test/go-ipfs-repo/blocks/O6/CIQOYW2THIZBRGI7IN33ROGCKOFZLXJJ2MPKYZBTV4H3N7GYHXMAO6A.data rename to test/fixtures/go-ipfs-repo/blocks/O6/CIQOYW2THIZBRGI7IN33ROGCKOFZLXJJ2MPKYZBTV4H3N7GYHXMAO6A.data diff --git a/test/go-ipfs-repo/blocks/QF/CIQGPALRQ24P6NS4OWHTQ7R247ZI7KJWP3QWPQYS43LFULQC5ANLQFI.data b/test/fixtures/go-ipfs-repo/blocks/QF/CIQGPALRQ24P6NS4OWHTQ7R247ZI7KJWP3QWPQYS43LFULQC5ANLQFI.data similarity index 100% rename from test/go-ipfs-repo/blocks/QF/CIQGPALRQ24P6NS4OWHTQ7R247ZI7KJWP3QWPQYS43LFULQC5ANLQFI.data rename to test/fixtures/go-ipfs-repo/blocks/QF/CIQGPALRQ24P6NS4OWHTQ7R247ZI7KJWP3QWPQYS43LFULQC5ANLQFI.data diff --git a/test/go-ipfs-repo/blocks/QV/CIQOHMGEIKMPYHAUTL57JSEZN64SIJ5OIHSGJG4TJSSJLGI3PBJLQVI.data b/test/fixtures/go-ipfs-repo/blocks/QV/CIQOHMGEIKMPYHAUTL57JSEZN64SIJ5OIHSGJG4TJSSJLGI3PBJLQVI.data similarity index 100% rename from test/go-ipfs-repo/blocks/QV/CIQOHMGEIKMPYHAUTL57JSEZN64SIJ5OIHSGJG4TJSSJLGI3PBJLQVI.data rename to test/fixtures/go-ipfs-repo/blocks/QV/CIQOHMGEIKMPYHAUTL57JSEZN64SIJ5OIHSGJG4TJSSJLGI3PBJLQVI.data diff --git a/test/go-ipfs-repo/blocks/R3/CIQBED3K6YA5I3QQWLJOCHWXDRK5EXZQILBCKAPEDUJENZ5B5HJ5R3A.data b/test/fixtures/go-ipfs-repo/blocks/R3/CIQBED3K6YA5I3QQWLJOCHWXDRK5EXZQILBCKAPEDUJENZ5B5HJ5R3A.data similarity index 100% rename from test/go-ipfs-repo/blocks/R3/CIQBED3K6YA5I3QQWLJOCHWXDRK5EXZQILBCKAPEDUJENZ5B5HJ5R3A.data rename to test/fixtures/go-ipfs-repo/blocks/R3/CIQBED3K6YA5I3QQWLJOCHWXDRK5EXZQILBCKAPEDUJENZ5B5HJ5R3A.data diff --git a/test/go-ipfs-repo/blocks/S5/CIQHBGZNZRPWVEFNMTLP4OS5EAVHFMCX2HD7FZUC2B3WUU3D4LGKS5A.data b/test/fixtures/go-ipfs-repo/blocks/S5/CIQHBGZNZRPWVEFNMTLP4OS5EAVHFMCX2HD7FZUC2B3WUU3D4LGKS5A.data similarity index 100% rename from test/go-ipfs-repo/blocks/S5/CIQHBGZNZRPWVEFNMTLP4OS5EAVHFMCX2HD7FZUC2B3WUU3D4LGKS5A.data rename to test/fixtures/go-ipfs-repo/blocks/S5/CIQHBGZNZRPWVEFNMTLP4OS5EAVHFMCX2HD7FZUC2B3WUU3D4LGKS5A.data diff --git a/test/go-ipfs-repo/blocks/SHARDING b/test/fixtures/go-ipfs-repo/blocks/SHARDING similarity index 100% rename from test/go-ipfs-repo/blocks/SHARDING rename to test/fixtures/go-ipfs-repo/blocks/SHARDING diff --git a/test/go-ipfs-repo/blocks/SW/CIQHPUVCWD6JA6AFUVD6VA64TGWP67KYA3AIMBUMVWGZ5AQN2L2HSWQ.data b/test/fixtures/go-ipfs-repo/blocks/SW/CIQHPUVCWD6JA6AFUVD6VA64TGWP67KYA3AIMBUMVWGZ5AQN2L2HSWQ.data similarity index 100% rename from test/go-ipfs-repo/blocks/SW/CIQHPUVCWD6JA6AFUVD6VA64TGWP67KYA3AIMBUMVWGZ5AQN2L2HSWQ.data rename to test/fixtures/go-ipfs-repo/blocks/SW/CIQHPUVCWD6JA6AFUVD6VA64TGWP67KYA3AIMBUMVWGZ5AQN2L2HSWQ.data diff --git a/test/go-ipfs-repo/blocks/TW/CIQFEAGMNNXXTYKYQSANT6IBNTFN7WR5RPD5F6GN6MBKUUO25DNOTWQ.data b/test/fixtures/go-ipfs-repo/blocks/TW/CIQFEAGMNNXXTYKYQSANT6IBNTFN7WR5RPD5F6GN6MBKUUO25DNOTWQ.data similarity index 100% rename from test/go-ipfs-repo/blocks/TW/CIQFEAGMNNXXTYKYQSANT6IBNTFN7WR5RPD5F6GN6MBKUUO25DNOTWQ.data rename to test/fixtures/go-ipfs-repo/blocks/TW/CIQFEAGMNNXXTYKYQSANT6IBNTFN7WR5RPD5F6GN6MBKUUO25DNOTWQ.data diff --git a/test/go-ipfs-repo/blocks/UN/CIQOMBKARLB7PAITVSNH7VEGIQJRPL6J7FT2XYVKAXT4MQPXXPUYUNY.data b/test/fixtures/go-ipfs-repo/blocks/UN/CIQOMBKARLB7PAITVSNH7VEGIQJRPL6J7FT2XYVKAXT4MQPXXPUYUNY.data similarity index 100% rename from test/go-ipfs-repo/blocks/UN/CIQOMBKARLB7PAITVSNH7VEGIQJRPL6J7FT2XYVKAXT4MQPXXPUYUNY.data rename to test/fixtures/go-ipfs-repo/blocks/UN/CIQOMBKARLB7PAITVSNH7VEGIQJRPL6J7FT2XYVKAXT4MQPXXPUYUNY.data diff --git a/test/go-ipfs-repo/blocks/UW/CIQDVKITASFS55MC2TXCX5XMZLMGTYVODWPEDIW7JYEG7YXBIA7IUWY.data b/test/fixtures/go-ipfs-repo/blocks/UW/CIQDVKITASFS55MC2TXCX5XMZLMGTYVODWPEDIW7JYEG7YXBIA7IUWY.data similarity index 100% rename from test/go-ipfs-repo/blocks/UW/CIQDVKITASFS55MC2TXCX5XMZLMGTYVODWPEDIW7JYEG7YXBIA7IUWY.data rename to test/fixtures/go-ipfs-repo/blocks/UW/CIQDVKITASFS55MC2TXCX5XMZLMGTYVODWPEDIW7JYEG7YXBIA7IUWY.data diff --git a/test/go-ipfs-repo/blocks/VO/CIQGFTQ7FSI2COUXWWLOQ45VUM2GUZCGAXLWCTOKKPGTUWPXHBNIVOY.data b/test/fixtures/go-ipfs-repo/blocks/VO/CIQGFTQ7FSI2COUXWWLOQ45VUM2GUZCGAXLWCTOKKPGTUWPXHBNIVOY.data similarity index 100% rename from test/go-ipfs-repo/blocks/VO/CIQGFTQ7FSI2COUXWWLOQ45VUM2GUZCGAXLWCTOKKPGTUWPXHBNIVOY.data rename to test/fixtures/go-ipfs-repo/blocks/VO/CIQGFTQ7FSI2COUXWWLOQ45VUM2GUZCGAXLWCTOKKPGTUWPXHBNIVOY.data diff --git a/test/go-ipfs-repo/blocks/X3/CIQFTFEEHEDF6KLBT32BFAGLXEZL4UWFNWM4LFTLMXQBCERZ6CMLX3Y.data b/test/fixtures/go-ipfs-repo/blocks/X3/CIQFTFEEHEDF6KLBT32BFAGLXEZL4UWFNWM4LFTLMXQBCERZ6CMLX3Y.data similarity index 100% rename from test/go-ipfs-repo/blocks/X3/CIQFTFEEHEDF6KLBT32BFAGLXEZL4UWFNWM4LFTLMXQBCERZ6CMLX3Y.data rename to test/fixtures/go-ipfs-repo/blocks/X3/CIQFTFEEHEDF6KLBT32BFAGLXEZL4UWFNWM4LFTLMXQBCERZ6CMLX3Y.data diff --git a/test/go-ipfs-repo/blocks/XO/CIQJGO2B2N75IUEM372FSMG76VV256I4PXBULZZ5ASNLK4FL4EG7XOI.data b/test/fixtures/go-ipfs-repo/blocks/XO/CIQJGO2B2N75IUEM372FSMG76VV256I4PXBULZZ5ASNLK4FL4EG7XOI.data similarity index 100% rename from test/go-ipfs-repo/blocks/XO/CIQJGO2B2N75IUEM372FSMG76VV256I4PXBULZZ5ASNLK4FL4EG7XOI.data rename to test/fixtures/go-ipfs-repo/blocks/XO/CIQJGO2B2N75IUEM372FSMG76VV256I4PXBULZZ5ASNLK4FL4EG7XOI.data diff --git a/test/go-ipfs-repo/blocks/YD/CIQENVCICS44LLYUDQ5KVN6ALXC6QRHK2X4R6EUFRMBB5OSFO2FUYDQ.data b/test/fixtures/go-ipfs-repo/blocks/YD/CIQENVCICS44LLYUDQ5KVN6ALXC6QRHK2X4R6EUFRMBB5OSFO2FUYDQ.data similarity index 100% rename from test/go-ipfs-repo/blocks/YD/CIQENVCICS44LLYUDQ5KVN6ALXC6QRHK2X4R6EUFRMBB5OSFO2FUYDQ.data rename to test/fixtures/go-ipfs-repo/blocks/YD/CIQENVCICS44LLYUDQ5KVN6ALXC6QRHK2X4R6EUFRMBB5OSFO2FUYDQ.data diff --git a/test/go-ipfs-repo/blocks/ZF/CIQLBS5HG4PRCRQ7O4EBXFD5QN6MTI5YBYMCVQJDXPKCOVR6RMLHZFQ.data b/test/fixtures/go-ipfs-repo/blocks/ZF/CIQLBS5HG4PRCRQ7O4EBXFD5QN6MTI5YBYMCVQJDXPKCOVR6RMLHZFQ.data similarity index 100% rename from test/go-ipfs-repo/blocks/ZF/CIQLBS5HG4PRCRQ7O4EBXFD5QN6MTI5YBYMCVQJDXPKCOVR6RMLHZFQ.data rename to test/fixtures/go-ipfs-repo/blocks/ZF/CIQLBS5HG4PRCRQ7O4EBXFD5QN6MTI5YBYMCVQJDXPKCOVR6RMLHZFQ.data diff --git a/test/go-ipfs-repo/blocks/_README b/test/fixtures/go-ipfs-repo/blocks/_README similarity index 100% rename from test/go-ipfs-repo/blocks/_README rename to test/fixtures/go-ipfs-repo/blocks/_README diff --git a/test/go-ipfs-repo/config b/test/fixtures/go-ipfs-repo/config similarity index 100% rename from test/go-ipfs-repo/config rename to test/fixtures/go-ipfs-repo/config diff --git a/test/go-ipfs-repo/datastore/000002.ldb b/test/fixtures/go-ipfs-repo/datastore/000002.ldb similarity index 100% rename from test/go-ipfs-repo/datastore/000002.ldb rename to test/fixtures/go-ipfs-repo/datastore/000002.ldb diff --git a/test/go-ipfs-repo/datastore/000005.ldb b/test/fixtures/go-ipfs-repo/datastore/000005.ldb similarity index 100% rename from test/go-ipfs-repo/datastore/000005.ldb rename to test/fixtures/go-ipfs-repo/datastore/000005.ldb diff --git a/test/go-ipfs-repo/datastore/000010.ldb b/test/fixtures/go-ipfs-repo/datastore/000010.ldb similarity index 100% rename from test/go-ipfs-repo/datastore/000010.ldb rename to test/fixtures/go-ipfs-repo/datastore/000010.ldb diff --git a/test/go-ipfs-repo/datastore/CURRENT b/test/fixtures/go-ipfs-repo/datastore/CURRENT similarity index 100% rename from test/go-ipfs-repo/datastore/CURRENT rename to test/fixtures/go-ipfs-repo/datastore/CURRENT diff --git a/test/go-ipfs-repo/datastore/LOCK b/test/fixtures/go-ipfs-repo/datastore/LOCK similarity index 100% rename from test/go-ipfs-repo/datastore/LOCK rename to test/fixtures/go-ipfs-repo/datastore/LOCK diff --git a/test/go-ipfs-repo/datastore/LOG b/test/fixtures/go-ipfs-repo/datastore/LOG similarity index 100% rename from test/go-ipfs-repo/datastore/LOG rename to test/fixtures/go-ipfs-repo/datastore/LOG diff --git a/test/go-ipfs-repo/datastore/LOG.old b/test/fixtures/go-ipfs-repo/datastore/LOG.old similarity index 100% rename from test/go-ipfs-repo/datastore/LOG.old rename to test/fixtures/go-ipfs-repo/datastore/LOG.old diff --git a/test/go-ipfs-repo/datastore/MANIFEST-000014 b/test/fixtures/go-ipfs-repo/datastore/MANIFEST-000014 similarity index 100% rename from test/go-ipfs-repo/datastore/MANIFEST-000014 rename to test/fixtures/go-ipfs-repo/datastore/MANIFEST-000014 diff --git a/test/go-ipfs-repo/version b/test/fixtures/go-ipfs-repo/version similarity index 100% rename from test/go-ipfs-repo/version rename to test/fixtures/go-ipfs-repo/version diff --git a/test/test-data/badconfig b/test/fixtures/test-data/badconfig similarity index 100% rename from test/test-data/badconfig rename to test/fixtures/test-data/badconfig diff --git a/test/test-data/badnode.json b/test/fixtures/test-data/badnode.json similarity index 100% rename from test/test-data/badnode.json rename to test/fixtures/test-data/badnode.json diff --git a/test/test-data/eth-block b/test/fixtures/test-data/eth-block similarity index 100% rename from test/test-data/eth-block rename to test/fixtures/test-data/eth-block diff --git a/test/test-data/hello b/test/fixtures/test-data/hello similarity index 100% rename from test/test-data/hello rename to test/fixtures/test-data/hello diff --git a/test/test-data/no-newline b/test/fixtures/test-data/no-newline similarity index 100% rename from test/test-data/no-newline rename to test/fixtures/test-data/no-newline diff --git a/test/test-data/node.json b/test/fixtures/test-data/node.json similarity index 100% rename from test/test-data/node.json rename to test/fixtures/test-data/node.json diff --git a/test/test-data/otherconfig b/test/fixtures/test-data/otherconfig similarity index 100% rename from test/test-data/otherconfig rename to test/fixtures/test-data/otherconfig diff --git a/test/test-data/recursive-get-dir/blocks/CIQBE/CIQBED3K6YA5I3QQWLJOCHWXDRK5EXZQILBCKAPEDUJENZ5B5HJ5R3A.data b/test/fixtures/test-data/recursive-get-dir/blocks/CIQBE/CIQBED3K6YA5I3QQWLJOCHWXDRK5EXZQILBCKAPEDUJENZ5B5HJ5R3A.data similarity index 100% rename from test/test-data/recursive-get-dir/blocks/CIQBE/CIQBED3K6YA5I3QQWLJOCHWXDRK5EXZQILBCKAPEDUJENZ5B5HJ5R3A.data rename to test/fixtures/test-data/recursive-get-dir/blocks/CIQBE/CIQBED3K6YA5I3QQWLJOCHWXDRK5EXZQILBCKAPEDUJENZ5B5HJ5R3A.data diff --git a/test/test-data/recursive-get-dir/blocks/CIQDD/CIQDDVW2EZIJF4NQH7WJNESD7XHQSXA5EGJVNTPVHD7444C2KLKXHDI.data b/test/fixtures/test-data/recursive-get-dir/blocks/CIQDD/CIQDDVW2EZIJF4NQH7WJNESD7XHQSXA5EGJVNTPVHD7444C2KLKXHDI.data similarity index 100% rename from test/test-data/recursive-get-dir/blocks/CIQDD/CIQDDVW2EZIJF4NQH7WJNESD7XHQSXA5EGJVNTPVHD7444C2KLKXHDI.data rename to test/fixtures/test-data/recursive-get-dir/blocks/CIQDD/CIQDDVW2EZIJF4NQH7WJNESD7XHQSXA5EGJVNTPVHD7444C2KLKXHDI.data diff --git a/test/test-data/recursive-get-dir/blocks/CIQDD/CIQDDZ5EDQK5AP7LRTLZHQZUR2R3GECRFV3WPKNL7PL2SKFIL2LXC4Y.data b/test/fixtures/test-data/recursive-get-dir/blocks/CIQDD/CIQDDZ5EDQK5AP7LRTLZHQZUR2R3GECRFV3WPKNL7PL2SKFIL2LXC4Y.data similarity index 100% rename from test/test-data/recursive-get-dir/blocks/CIQDD/CIQDDZ5EDQK5AP7LRTLZHQZUR2R3GECRFV3WPKNL7PL2SKFIL2LXC4Y.data rename to test/fixtures/test-data/recursive-get-dir/blocks/CIQDD/CIQDDZ5EDQK5AP7LRTLZHQZUR2R3GECRFV3WPKNL7PL2SKFIL2LXC4Y.data diff --git a/test/test-data/recursive-get-dir/blocks/CIQDM/CIQDMKFEUGKSLXMEXO774EZOYCYNHPRVFD53ZSAU7237F67XDSQGCYQ.data b/test/fixtures/test-data/recursive-get-dir/blocks/CIQDM/CIQDMKFEUGKSLXMEXO774EZOYCYNHPRVFD53ZSAU7237F67XDSQGCYQ.data similarity index 100% rename from test/test-data/recursive-get-dir/blocks/CIQDM/CIQDMKFEUGKSLXMEXO774EZOYCYNHPRVFD53ZSAU7237F67XDSQGCYQ.data rename to test/fixtures/test-data/recursive-get-dir/blocks/CIQDM/CIQDMKFEUGKSLXMEXO774EZOYCYNHPRVFD53ZSAU7237F67XDSQGCYQ.data diff --git a/test/test-data/recursive-get-dir/blocks/CIQDV/CIQDVKITASFS55MC2TXCX5XMZLMGTYVODWPEDIW7JYEG7YXBIA7IUWY.data b/test/fixtures/test-data/recursive-get-dir/blocks/CIQDV/CIQDVKITASFS55MC2TXCX5XMZLMGTYVODWPEDIW7JYEG7YXBIA7IUWY.data similarity index 100% rename from test/test-data/recursive-get-dir/blocks/CIQDV/CIQDVKITASFS55MC2TXCX5XMZLMGTYVODWPEDIW7JYEG7YXBIA7IUWY.data rename to test/fixtures/test-data/recursive-get-dir/blocks/CIQDV/CIQDVKITASFS55MC2TXCX5XMZLMGTYVODWPEDIW7JYEG7YXBIA7IUWY.data diff --git a/test/test-data/recursive-get-dir/blocks/CIQEN/CIQENVCICS44LLYUDQ5KVN6ALXC6QRHK2X4R6EUFRMBB5OSFO2FUYDQ.data b/test/fixtures/test-data/recursive-get-dir/blocks/CIQEN/CIQENVCICS44LLYUDQ5KVN6ALXC6QRHK2X4R6EUFRMBB5OSFO2FUYDQ.data similarity index 100% rename from test/test-data/recursive-get-dir/blocks/CIQEN/CIQENVCICS44LLYUDQ5KVN6ALXC6QRHK2X4R6EUFRMBB5OSFO2FUYDQ.data rename to test/fixtures/test-data/recursive-get-dir/blocks/CIQEN/CIQENVCICS44LLYUDQ5KVN6ALXC6QRHK2X4R6EUFRMBB5OSFO2FUYDQ.data diff --git a/test/test-data/recursive-get-dir/blocks/CIQER/CIQERMRAAFXUAUOX3V2DCW7R77FRIVHQ3V5OIPPS3XQBX34KRPNOIRQ.data b/test/fixtures/test-data/recursive-get-dir/blocks/CIQER/CIQERMRAAFXUAUOX3V2DCW7R77FRIVHQ3V5OIPPS3XQBX34KRPNOIRQ.data similarity index 100% rename from test/test-data/recursive-get-dir/blocks/CIQER/CIQERMRAAFXUAUOX3V2DCW7R77FRIVHQ3V5OIPPS3XQBX34KRPNOIRQ.data rename to test/fixtures/test-data/recursive-get-dir/blocks/CIQER/CIQERMRAAFXUAUOX3V2DCW7R77FRIVHQ3V5OIPPS3XQBX34KRPNOIRQ.data diff --git a/test/test-data/recursive-get-dir/blocks/CIQEU/CIQEUWUVLBXVFYSYCHHSCRTXCYHGIOBXKWUMKFR3UPAFHQ5WK5362FQ.data b/test/fixtures/test-data/recursive-get-dir/blocks/CIQEU/CIQEUWUVLBXVFYSYCHHSCRTXCYHGIOBXKWUMKFR3UPAFHQ5WK5362FQ.data similarity index 100% rename from test/test-data/recursive-get-dir/blocks/CIQEU/CIQEUWUVLBXVFYSYCHHSCRTXCYHGIOBXKWUMKFR3UPAFHQ5WK5362FQ.data rename to test/fixtures/test-data/recursive-get-dir/blocks/CIQEU/CIQEUWUVLBXVFYSYCHHSCRTXCYHGIOBXKWUMKFR3UPAFHQ5WK5362FQ.data diff --git a/test/test-data/recursive-get-dir/blocks/CIQFE/CIQFEAGMNNXXTYKYQSANT6IBNTFN7WR5RPD5F6GN6MBKUUO25DNOTWQ.data b/test/fixtures/test-data/recursive-get-dir/blocks/CIQFE/CIQFEAGMNNXXTYKYQSANT6IBNTFN7WR5RPD5F6GN6MBKUUO25DNOTWQ.data similarity index 100% rename from test/test-data/recursive-get-dir/blocks/CIQFE/CIQFEAGMNNXXTYKYQSANT6IBNTFN7WR5RPD5F6GN6MBKUUO25DNOTWQ.data rename to test/fixtures/test-data/recursive-get-dir/blocks/CIQFE/CIQFEAGMNNXXTYKYQSANT6IBNTFN7WR5RPD5F6GN6MBKUUO25DNOTWQ.data diff --git a/test/test-data/recursive-get-dir/blocks/CIQFF/CIQFFRR4O52TS2Z7QLDDTF32OIR4FWLKT5YLL7MLDVIT7DC3NHOK5VA.data b/test/fixtures/test-data/recursive-get-dir/blocks/CIQFF/CIQFFRR4O52TS2Z7QLDDTF32OIR4FWLKT5YLL7MLDVIT7DC3NHOK5VA.data similarity index 100% rename from test/test-data/recursive-get-dir/blocks/CIQFF/CIQFFRR4O52TS2Z7QLDDTF32OIR4FWLKT5YLL7MLDVIT7DC3NHOK5VA.data rename to test/fixtures/test-data/recursive-get-dir/blocks/CIQFF/CIQFFRR4O52TS2Z7QLDDTF32OIR4FWLKT5YLL7MLDVIT7DC3NHOK5VA.data diff --git a/test/test-data/recursive-get-dir/blocks/CIQFT/CIQFTFEEHEDF6KLBT32BFAGLXEZL4UWFNWM4LFTLMXQBCERZ6CMLX3Y.data b/test/fixtures/test-data/recursive-get-dir/blocks/CIQFT/CIQFTFEEHEDF6KLBT32BFAGLXEZL4UWFNWM4LFTLMXQBCERZ6CMLX3Y.data similarity index 100% rename from test/test-data/recursive-get-dir/blocks/CIQFT/CIQFTFEEHEDF6KLBT32BFAGLXEZL4UWFNWM4LFTLMXQBCERZ6CMLX3Y.data rename to test/fixtures/test-data/recursive-get-dir/blocks/CIQFT/CIQFTFEEHEDF6KLBT32BFAGLXEZL4UWFNWM4LFTLMXQBCERZ6CMLX3Y.data diff --git a/test/test-data/recursive-get-dir/blocks/CIQGF/CIQGFTQ7FSI2COUXWWLOQ45VUM2GUZCGAXLWCTOKKPGTUWPXHBNIVOY.data b/test/fixtures/test-data/recursive-get-dir/blocks/CIQGF/CIQGFTQ7FSI2COUXWWLOQ45VUM2GUZCGAXLWCTOKKPGTUWPXHBNIVOY.data similarity index 100% rename from test/test-data/recursive-get-dir/blocks/CIQGF/CIQGFTQ7FSI2COUXWWLOQ45VUM2GUZCGAXLWCTOKKPGTUWPXHBNIVOY.data rename to test/fixtures/test-data/recursive-get-dir/blocks/CIQGF/CIQGFTQ7FSI2COUXWWLOQ45VUM2GUZCGAXLWCTOKKPGTUWPXHBNIVOY.data diff --git a/test/test-data/recursive-get-dir/blocks/CIQGP/CIQGPALRQ24P6NS4OWHTQ7R247ZI7KJWP3QWPQYS43LFULQC5ANLQFI.data b/test/fixtures/test-data/recursive-get-dir/blocks/CIQGP/CIQGPALRQ24P6NS4OWHTQ7R247ZI7KJWP3QWPQYS43LFULQC5ANLQFI.data similarity index 100% rename from test/test-data/recursive-get-dir/blocks/CIQGP/CIQGPALRQ24P6NS4OWHTQ7R247ZI7KJWP3QWPQYS43LFULQC5ANLQFI.data rename to test/fixtures/test-data/recursive-get-dir/blocks/CIQGP/CIQGPALRQ24P6NS4OWHTQ7R247ZI7KJWP3QWPQYS43LFULQC5ANLQFI.data diff --git a/test/test-data/recursive-get-dir/blocks/CIQH7/CIQH7OEYWXL34RWYL7VXLWEU4FWPVGT24VJT7DUZPTNLF25N25IGGQA.data b/test/fixtures/test-data/recursive-get-dir/blocks/CIQH7/CIQH7OEYWXL34RWYL7VXLWEU4FWPVGT24VJT7DUZPTNLF25N25IGGQA.data similarity index 100% rename from test/test-data/recursive-get-dir/blocks/CIQH7/CIQH7OEYWXL34RWYL7VXLWEU4FWPVGT24VJT7DUZPTNLF25N25IGGQA.data rename to test/fixtures/test-data/recursive-get-dir/blocks/CIQH7/CIQH7OEYWXL34RWYL7VXLWEU4FWPVGT24VJT7DUZPTNLF25N25IGGQA.data diff --git a/test/test-data/recursive-get-dir/blocks/CIQHA/CIQHAKDLTL5GMIFGN5YVY4BA22FPHUIODJEXS4LCTQDWA275XAJDAPI.data b/test/fixtures/test-data/recursive-get-dir/blocks/CIQHA/CIQHAKDLTL5GMIFGN5YVY4BA22FPHUIODJEXS4LCTQDWA275XAJDAPI.data similarity index 100% rename from test/test-data/recursive-get-dir/blocks/CIQHA/CIQHAKDLTL5GMIFGN5YVY4BA22FPHUIODJEXS4LCTQDWA275XAJDAPI.data rename to test/fixtures/test-data/recursive-get-dir/blocks/CIQHA/CIQHAKDLTL5GMIFGN5YVY4BA22FPHUIODJEXS4LCTQDWA275XAJDAPI.data diff --git a/test/test-data/recursive-get-dir/blocks/CIQHB/CIQHBGZNZRPWVEFNMTLP4OS5EAVHFMCX2HD7FZUC2B3WUU3D4LGKS5A.data b/test/fixtures/test-data/recursive-get-dir/blocks/CIQHB/CIQHBGZNZRPWVEFNMTLP4OS5EAVHFMCX2HD7FZUC2B3WUU3D4LGKS5A.data similarity index 100% rename from test/test-data/recursive-get-dir/blocks/CIQHB/CIQHBGZNZRPWVEFNMTLP4OS5EAVHFMCX2HD7FZUC2B3WUU3D4LGKS5A.data rename to test/fixtures/test-data/recursive-get-dir/blocks/CIQHB/CIQHBGZNZRPWVEFNMTLP4OS5EAVHFMCX2HD7FZUC2B3WUU3D4LGKS5A.data diff --git a/test/test-data/recursive-get-dir/blocks/CIQHP/CIQHPUVCWD6JA6AFUVD6VA64TGWP67KYA3AIMBUMVWGZ5AQN2L2HSWQ.data b/test/fixtures/test-data/recursive-get-dir/blocks/CIQHP/CIQHPUVCWD6JA6AFUVD6VA64TGWP67KYA3AIMBUMVWGZ5AQN2L2HSWQ.data similarity index 100% rename from test/test-data/recursive-get-dir/blocks/CIQHP/CIQHPUVCWD6JA6AFUVD6VA64TGWP67KYA3AIMBUMVWGZ5AQN2L2HSWQ.data rename to test/fixtures/test-data/recursive-get-dir/blocks/CIQHP/CIQHPUVCWD6JA6AFUVD6VA64TGWP67KYA3AIMBUMVWGZ5AQN2L2HSWQ.data diff --git a/test/test-data/recursive-get-dir/blocks/CIQIX/CIQIXBZMUTXFC5QIGMLJNXLLHZOPGSL2PBC65D4UIVWM6TI5F5TAFNI.data b/test/fixtures/test-data/recursive-get-dir/blocks/CIQIX/CIQIXBZMUTXFC5QIGMLJNXLLHZOPGSL2PBC65D4UIVWM6TI5F5TAFNI.data similarity index 100% rename from test/test-data/recursive-get-dir/blocks/CIQIX/CIQIXBZMUTXFC5QIGMLJNXLLHZOPGSL2PBC65D4UIVWM6TI5F5TAFNI.data rename to test/fixtures/test-data/recursive-get-dir/blocks/CIQIX/CIQIXBZMUTXFC5QIGMLJNXLLHZOPGSL2PBC65D4UIVWM6TI5F5TAFNI.data diff --git a/test/test-data/recursive-get-dir/blocks/CIQJ2/CIQJ23BL4UHXA2KTI6NLTXZM4PW4VEFWQBJ4ACZQAS37BLGL4HUO5XY.data b/test/fixtures/test-data/recursive-get-dir/blocks/CIQJ2/CIQJ23BL4UHXA2KTI6NLTXZM4PW4VEFWQBJ4ACZQAS37BLGL4HUO5XY.data similarity index 100% rename from test/test-data/recursive-get-dir/blocks/CIQJ2/CIQJ23BL4UHXA2KTI6NLTXZM4PW4VEFWQBJ4ACZQAS37BLGL4HUO5XY.data rename to test/fixtures/test-data/recursive-get-dir/blocks/CIQJ2/CIQJ23BL4UHXA2KTI6NLTXZM4PW4VEFWQBJ4ACZQAS37BLGL4HUO5XY.data diff --git a/test/test-data/recursive-get-dir/blocks/CIQJB/CIQJBQD2O6K4CGJVCCTJNUP57QHR4SKHZ74OIITBBGLOMCO3ZOLWLGA.data b/test/fixtures/test-data/recursive-get-dir/blocks/CIQJB/CIQJBQD2O6K4CGJVCCTJNUP57QHR4SKHZ74OIITBBGLOMCO3ZOLWLGA.data similarity index 100% rename from test/test-data/recursive-get-dir/blocks/CIQJB/CIQJBQD2O6K4CGJVCCTJNUP57QHR4SKHZ74OIITBBGLOMCO3ZOLWLGA.data rename to test/fixtures/test-data/recursive-get-dir/blocks/CIQJB/CIQJBQD2O6K4CGJVCCTJNUP57QHR4SKHZ74OIITBBGLOMCO3ZOLWLGA.data diff --git a/test/test-data/recursive-get-dir/blocks/CIQJF/CIQJFGRQHQ45VCQLM7AJNF2GF5UHUAGGHC6LLAH6VYDEKLQMD4QLILY.data b/test/fixtures/test-data/recursive-get-dir/blocks/CIQJF/CIQJFGRQHQ45VCQLM7AJNF2GF5UHUAGGHC6LLAH6VYDEKLQMD4QLILY.data similarity index 100% rename from test/test-data/recursive-get-dir/blocks/CIQJF/CIQJFGRQHQ45VCQLM7AJNF2GF5UHUAGGHC6LLAH6VYDEKLQMD4QLILY.data rename to test/fixtures/test-data/recursive-get-dir/blocks/CIQJF/CIQJFGRQHQ45VCQLM7AJNF2GF5UHUAGGHC6LLAH6VYDEKLQMD4QLILY.data diff --git a/test/test-data/recursive-get-dir/blocks/CIQJG/CIQJGO2B2N75IUEM372FSMG76VV256I4PXBULZZ5ASNLK4FL4EG7XOI.data b/test/fixtures/test-data/recursive-get-dir/blocks/CIQJG/CIQJGO2B2N75IUEM372FSMG76VV256I4PXBULZZ5ASNLK4FL4EG7XOI.data similarity index 100% rename from test/test-data/recursive-get-dir/blocks/CIQJG/CIQJGO2B2N75IUEM372FSMG76VV256I4PXBULZZ5ASNLK4FL4EG7XOI.data rename to test/fixtures/test-data/recursive-get-dir/blocks/CIQJG/CIQJGO2B2N75IUEM372FSMG76VV256I4PXBULZZ5ASNLK4FL4EG7XOI.data diff --git a/test/test-data/recursive-get-dir/blocks/CIQKK/CIQKKLBWAIBQZOIS5X7E32LQAL6236OUKZTMHPQSFIXPWXNZHQOV7JQ.data b/test/fixtures/test-data/recursive-get-dir/blocks/CIQKK/CIQKKLBWAIBQZOIS5X7E32LQAL6236OUKZTMHPQSFIXPWXNZHQOV7JQ.data similarity index 100% rename from test/test-data/recursive-get-dir/blocks/CIQKK/CIQKKLBWAIBQZOIS5X7E32LQAL6236OUKZTMHPQSFIXPWXNZHQOV7JQ.data rename to test/fixtures/test-data/recursive-get-dir/blocks/CIQKK/CIQKKLBWAIBQZOIS5X7E32LQAL6236OUKZTMHPQSFIXPWXNZHQOV7JQ.data diff --git a/test/test-data/recursive-get-dir/blocks/CIQLB/CIQLBK52T5EHVHZY5URTG5JS3JCUJDQM2DRB5RVF33DCUUOFJNGVDUI.data b/test/fixtures/test-data/recursive-get-dir/blocks/CIQLB/CIQLBK52T5EHVHZY5URTG5JS3JCUJDQM2DRB5RVF33DCUUOFJNGVDUI.data similarity index 100% rename from test/test-data/recursive-get-dir/blocks/CIQLB/CIQLBK52T5EHVHZY5URTG5JS3JCUJDQM2DRB5RVF33DCUUOFJNGVDUI.data rename to test/fixtures/test-data/recursive-get-dir/blocks/CIQLB/CIQLBK52T5EHVHZY5URTG5JS3JCUJDQM2DRB5RVF33DCUUOFJNGVDUI.data diff --git a/test/test-data/recursive-get-dir/blocks/CIQLB/CIQLBS5HG4PRCRQ7O4EBXFD5QN6MTI5YBYMCVQJDXPKCOVR6RMLHZFQ.data b/test/fixtures/test-data/recursive-get-dir/blocks/CIQLB/CIQLBS5HG4PRCRQ7O4EBXFD5QN6MTI5YBYMCVQJDXPKCOVR6RMLHZFQ.data similarity index 100% rename from test/test-data/recursive-get-dir/blocks/CIQLB/CIQLBS5HG4PRCRQ7O4EBXFD5QN6MTI5YBYMCVQJDXPKCOVR6RMLHZFQ.data rename to test/fixtures/test-data/recursive-get-dir/blocks/CIQLB/CIQLBS5HG4PRCRQ7O4EBXFD5QN6MTI5YBYMCVQJDXPKCOVR6RMLHZFQ.data diff --git a/test/test-data/recursive-get-dir/blocks/CIQMB/CIQMB7DLJFKD267QJ2B5FJNHZPTSVA7IB6OHXSQ2XSVEEKMKK6RT75I.data b/test/fixtures/test-data/recursive-get-dir/blocks/CIQMB/CIQMB7DLJFKD267QJ2B5FJNHZPTSVA7IB6OHXSQ2XSVEEKMKK6RT75I.data similarity index 100% rename from test/test-data/recursive-get-dir/blocks/CIQMB/CIQMB7DLJFKD267QJ2B5FJNHZPTSVA7IB6OHXSQ2XSVEEKMKK6RT75I.data rename to test/fixtures/test-data/recursive-get-dir/blocks/CIQMB/CIQMB7DLJFKD267QJ2B5FJNHZPTSVA7IB6OHXSQ2XSVEEKMKK6RT75I.data diff --git a/test/test-data/recursive-get-dir/blocks/CIQOH/CIQOHMGEIKMPYHAUTL57JSEZN64SIJ5OIHSGJG4TJSSJLGI3PBJLQVI.data b/test/fixtures/test-data/recursive-get-dir/blocks/CIQOH/CIQOHMGEIKMPYHAUTL57JSEZN64SIJ5OIHSGJG4TJSSJLGI3PBJLQVI.data similarity index 100% rename from test/test-data/recursive-get-dir/blocks/CIQOH/CIQOHMGEIKMPYHAUTL57JSEZN64SIJ5OIHSGJG4TJSSJLGI3PBJLQVI.data rename to test/fixtures/test-data/recursive-get-dir/blocks/CIQOH/CIQOHMGEIKMPYHAUTL57JSEZN64SIJ5OIHSGJG4TJSSJLGI3PBJLQVI.data diff --git a/test/test-data/recursive-get-dir/blocks/CIQOL/CIQOLBQZSZAODJGGH6RYYVBUXHTS3SM5EORZDU63LYPEFUAFE4SBM4I.data b/test/fixtures/test-data/recursive-get-dir/blocks/CIQOL/CIQOLBQZSZAODJGGH6RYYVBUXHTS3SM5EORZDU63LYPEFUAFE4SBM4I.data similarity index 100% rename from test/test-data/recursive-get-dir/blocks/CIQOL/CIQOLBQZSZAODJGGH6RYYVBUXHTS3SM5EORZDU63LYPEFUAFE4SBM4I.data rename to test/fixtures/test-data/recursive-get-dir/blocks/CIQOL/CIQOLBQZSZAODJGGH6RYYVBUXHTS3SM5EORZDU63LYPEFUAFE4SBM4I.data diff --git a/test/test-data/recursive-get-dir/blocks/CIQOM/CIQOMBKARLB7PAITVSNH7VEGIQJRPL6J7FT2XYVKAXT4MQPXXPUYUNY.data b/test/fixtures/test-data/recursive-get-dir/blocks/CIQOM/CIQOMBKARLB7PAITVSNH7VEGIQJRPL6J7FT2XYVKAXT4MQPXXPUYUNY.data similarity index 100% rename from test/test-data/recursive-get-dir/blocks/CIQOM/CIQOMBKARLB7PAITVSNH7VEGIQJRPL6J7FT2XYVKAXT4MQPXXPUYUNY.data rename to test/fixtures/test-data/recursive-get-dir/blocks/CIQOM/CIQOMBKARLB7PAITVSNH7VEGIQJRPL6J7FT2XYVKAXT4MQPXXPUYUNY.data diff --git a/test/test-data/recursive-get-dir/blocks/CIQON/CIQONICFQZH7QVU6IPSIM3AK7AD554D3BWZPAGEAQYQOWMFZQDUUAEI.data b/test/fixtures/test-data/recursive-get-dir/blocks/CIQON/CIQONICFQZH7QVU6IPSIM3AK7AD554D3BWZPAGEAQYQOWMFZQDUUAEI.data similarity index 100% rename from test/test-data/recursive-get-dir/blocks/CIQON/CIQONICFQZH7QVU6IPSIM3AK7AD554D3BWZPAGEAQYQOWMFZQDUUAEI.data rename to test/fixtures/test-data/recursive-get-dir/blocks/CIQON/CIQONICFQZH7QVU6IPSIM3AK7AD554D3BWZPAGEAQYQOWMFZQDUUAEI.data diff --git a/test/test-data/recursive-get-dir/blocks/CIQOY/CIQOYW2THIZBRGI7IN33ROGCKOFZLXJJ2MPKYZBTV4H3N7GYHXMAO6A.data b/test/fixtures/test-data/recursive-get-dir/blocks/CIQOY/CIQOYW2THIZBRGI7IN33ROGCKOFZLXJJ2MPKYZBTV4H3N7GYHXMAO6A.data similarity index 100% rename from test/test-data/recursive-get-dir/blocks/CIQOY/CIQOYW2THIZBRGI7IN33ROGCKOFZLXJJ2MPKYZBTV4H3N7GYHXMAO6A.data rename to test/fixtures/test-data/recursive-get-dir/blocks/CIQOY/CIQOYW2THIZBRGI7IN33ROGCKOFZLXJJ2MPKYZBTV4H3N7GYHXMAO6A.data diff --git a/test/test-data/recursive-get-dir/blocks/CIQPD/CIQPDQJBGYDZNMOAGGYNRNMP2VDKWBWGAEDDEJDACM3SGG3VIANDDXI.data b/test/fixtures/test-data/recursive-get-dir/blocks/CIQPD/CIQPDQJBGYDZNMOAGGYNRNMP2VDKWBWGAEDDEJDACM3SGG3VIANDDXI.data similarity index 100% rename from test/test-data/recursive-get-dir/blocks/CIQPD/CIQPDQJBGYDZNMOAGGYNRNMP2VDKWBWGAEDDEJDACM3SGG3VIANDDXI.data rename to test/fixtures/test-data/recursive-get-dir/blocks/CIQPD/CIQPDQJBGYDZNMOAGGYNRNMP2VDKWBWGAEDDEJDACM3SGG3VIANDDXI.data diff --git a/test/test-data/recursive-get-dir/config b/test/fixtures/test-data/recursive-get-dir/config similarity index 100% rename from test/test-data/recursive-get-dir/config rename to test/fixtures/test-data/recursive-get-dir/config diff --git a/test/test-data/recursive-get-dir/datastore/000002.ldb b/test/fixtures/test-data/recursive-get-dir/datastore/000002.ldb similarity index 100% rename from test/test-data/recursive-get-dir/datastore/000002.ldb rename to test/fixtures/test-data/recursive-get-dir/datastore/000002.ldb diff --git a/test/test-data/recursive-get-dir/datastore/000005.ldb b/test/fixtures/test-data/recursive-get-dir/datastore/000005.ldb similarity index 100% rename from test/test-data/recursive-get-dir/datastore/000005.ldb rename to test/fixtures/test-data/recursive-get-dir/datastore/000005.ldb diff --git a/test/test-data/recursive-get-dir/datastore/000010.ldb b/test/fixtures/test-data/recursive-get-dir/datastore/000010.ldb similarity index 100% rename from test/test-data/recursive-get-dir/datastore/000010.ldb rename to test/fixtures/test-data/recursive-get-dir/datastore/000010.ldb diff --git a/test/test-data/recursive-get-dir/datastore/CURRENT b/test/fixtures/test-data/recursive-get-dir/datastore/CURRENT similarity index 100% rename from test/test-data/recursive-get-dir/datastore/CURRENT rename to test/fixtures/test-data/recursive-get-dir/datastore/CURRENT diff --git a/test/test-data/recursive-get-dir/datastore/LOCK b/test/fixtures/test-data/recursive-get-dir/datastore/LOCK similarity index 100% rename from test/test-data/recursive-get-dir/datastore/LOCK rename to test/fixtures/test-data/recursive-get-dir/datastore/LOCK diff --git a/test/test-data/recursive-get-dir/datastore/LOG b/test/fixtures/test-data/recursive-get-dir/datastore/LOG similarity index 100% rename from test/test-data/recursive-get-dir/datastore/LOG rename to test/fixtures/test-data/recursive-get-dir/datastore/LOG diff --git a/test/test-data/recursive-get-dir/datastore/LOG.old b/test/fixtures/test-data/recursive-get-dir/datastore/LOG.old similarity index 100% rename from test/test-data/recursive-get-dir/datastore/LOG.old rename to test/fixtures/test-data/recursive-get-dir/datastore/LOG.old diff --git a/test/test-data/recursive-get-dir/datastore/MANIFEST-000014 b/test/fixtures/test-data/recursive-get-dir/datastore/MANIFEST-000014 similarity index 100% rename from test/test-data/recursive-get-dir/datastore/MANIFEST-000014 rename to test/fixtures/test-data/recursive-get-dir/datastore/MANIFEST-000014 diff --git a/test/test-data/recursive-get-dir/init-docs/about b/test/fixtures/test-data/recursive-get-dir/init-docs/about similarity index 100% rename from test/test-data/recursive-get-dir/init-docs/about rename to test/fixtures/test-data/recursive-get-dir/init-docs/about diff --git a/test/test-data/recursive-get-dir/init-docs/contact b/test/fixtures/test-data/recursive-get-dir/init-docs/contact similarity index 100% rename from test/test-data/recursive-get-dir/init-docs/contact rename to test/fixtures/test-data/recursive-get-dir/init-docs/contact diff --git a/test/test-data/recursive-get-dir/init-docs/docs/index b/test/fixtures/test-data/recursive-get-dir/init-docs/docs/index similarity index 100% rename from test/test-data/recursive-get-dir/init-docs/docs/index rename to test/fixtures/test-data/recursive-get-dir/init-docs/docs/index diff --git a/test/test-data/recursive-get-dir/init-docs/help b/test/fixtures/test-data/recursive-get-dir/init-docs/help similarity index 100% rename from test/test-data/recursive-get-dir/init-docs/help rename to test/fixtures/test-data/recursive-get-dir/init-docs/help diff --git a/test/test-data/recursive-get-dir/init-docs/quick-start b/test/fixtures/test-data/recursive-get-dir/init-docs/quick-start similarity index 100% rename from test/test-data/recursive-get-dir/init-docs/quick-start rename to test/fixtures/test-data/recursive-get-dir/init-docs/quick-start diff --git a/test/test-data/recursive-get-dir/init-docs/readme b/test/fixtures/test-data/recursive-get-dir/init-docs/readme similarity index 100% rename from test/test-data/recursive-get-dir/init-docs/readme rename to test/fixtures/test-data/recursive-get-dir/init-docs/readme diff --git a/test/test-data/recursive-get-dir/init-docs/security-notes b/test/fixtures/test-data/recursive-get-dir/init-docs/security-notes similarity index 100% rename from test/test-data/recursive-get-dir/init-docs/security-notes rename to test/fixtures/test-data/recursive-get-dir/init-docs/security-notes diff --git a/test/test-data/recursive-get-dir/init-docs/tour/0.0-intro b/test/fixtures/test-data/recursive-get-dir/init-docs/tour/0.0-intro similarity index 100% rename from test/test-data/recursive-get-dir/init-docs/tour/0.0-intro rename to test/fixtures/test-data/recursive-get-dir/init-docs/tour/0.0-intro diff --git a/test/test-data/recursive-get-dir/version b/test/fixtures/test-data/recursive-get-dir/version similarity index 100% rename from test/test-data/recursive-get-dir/version rename to test/fixtures/test-data/recursive-get-dir/version diff --git a/test/gateway/index.js b/test/gateway/index.js index b45a350dbc..3471c915ee 100644 --- a/test/gateway/index.js +++ b/test/gateway/index.js @@ -25,7 +25,8 @@ describe('HTTP Gateway', () => { let http = {} let gateway - before((done) => { + before(function (done) { + this.timeout(20 * 1000) const repoPath = path.join( os.tmpdir(), '/ipfs-' + Math.random().toString().substring(2, 8) + '-' + Date.now() @@ -113,7 +114,8 @@ describe('HTTP Gateway', () => { after((done) => http.api.stop(done)) - describe('## HTTP Gateway', () => { + describe('## HTTP Gateway', function () { + this.timeout(20 * 1000) it('returns 400 for request without argument', (done) => { gateway.inject({ method: 'GET', diff --git a/test/http-api/index.js b/test/http-api/index.js index 16e535322e..e2c7f34ce3 100644 --- a/test/http-api/index.js +++ b/test/http-api/index.js @@ -13,7 +13,7 @@ const path = require('path') const clean = require('../utils/clean') describe('HTTP API', () => { - const repoExample = path.join(__dirname, '../go-ipfs-repo') + const repoExample = path.join(__dirname, '../fixtures/go-ipfs-repo') const repoTests = path.join(__dirname, '../repo-tests-run') let http = {} diff --git a/test/http-api/over-ipfs-api/block.js b/test/http-api/over-ipfs-api/block.js index 2555386587..dd66c99836 100644 --- a/test/http-api/over-ipfs-api/block.js +++ b/test/http-api/over-ipfs-api/block.js @@ -13,7 +13,7 @@ module.exports = (ctl) => { describe('.block', () => { describe('.put', () => { it('updates value', (done) => { - const data = new Buffer('hello world\n') + const data = Buffer.from('hello world\n') const expectedResult = { key: 'QmZjTnYw2TFhn9Nn7tjmPSoTBoY7YRkwPzwSrSbabY24Kp', size: 12 diff --git a/test/http-api/over-ipfs-api/config.js b/test/http-api/over-ipfs-api/config.js index 044c8be008..bda245544a 100644 --- a/test/http-api/over-ipfs-api/config.js +++ b/test/http-api/over-ipfs-api/config.js @@ -74,7 +74,7 @@ module.exports = (ctl) => { // what to do with the .replace command describe('.replace', () => { it('returns error if the config is invalid', (done) => { - const filePath = 'test/test-data/badconfig' + const filePath = 'test/fixtures/test-data/badconfig' ctl.config.replace(filePath, (err) => { expect(err).to.exist() @@ -83,7 +83,7 @@ module.exports = (ctl) => { }) it('updates value', (done) => { - const filePath = 'test/test-data/otherconfig' + const filePath = 'test/fixtures/test-data/otherconfig' const expectedConfig = JSON.parse(fs.readFileSync(filePath, 'utf8')) ctl.config.replace(filePath, (err) => { diff --git a/test/http-api/over-ipfs-api/object.js b/test/http-api/over-ipfs-api/object.js index 105b25bdd3..913e0b3d08 100644 --- a/test/http-api/over-ipfs-api/object.js +++ b/test/http-api/over-ipfs-api/object.js @@ -50,7 +50,7 @@ module.exports = (ctl) => { ctl.object.get('QmdfTbBqBPQ7VNxZEYEj14VmRuZBkqFbiwReogJgS1zR1n', {enc: 'base58'}, asJson((err, res) => { expect(err).to.not.exist() expect(res.links).to.be.eql([]) - expect(res.data).to.eql(new Buffer('')) + expect(res.data).to.eql(Buffer.from('')) done() })) }) @@ -58,7 +58,7 @@ module.exports = (ctl) => { describe('.put', () => { it('returns error if the node is invalid', (done) => { - const filePath = 'test/test-data/badnode.json' + const filePath = 'test/fixtures/test-data/badnode.json' ctl.object.put(filePath, {enc: 'json'}, (err) => { expect(err).to.exist() @@ -67,9 +67,9 @@ module.exports = (ctl) => { }) it('updates value', (done) => { - const filePath = fs.readFileSync('test/test-data/node.json') + const filePath = fs.readFileSync('test/fixtures/test-data/node.json') const expectedResult = { - data: new Buffer('another'), + data: Buffer.from('another'), multihash: 'QmZZmY4KCu9r3e7M2Pcn46Fc5qbn6NpzaAGaYb22kbfTqm', links: [{ name: 'some link', @@ -179,7 +179,7 @@ module.exports = (ctl) => { }) it('returns error for request without data', (done) => { - const filePath = 'test/test-data/badnode.json' + const filePath = 'test/fixtures/test-data/badnode.json' ctl.object.patch.appendData(null, filePath, (err) => { expect(err).to.exist() @@ -189,7 +189,7 @@ module.exports = (ctl) => { it('updates value', (done) => { const key = 'QmdfTbBqBPQ7VNxZEYEj14VmRuZBkqFbiwReogJgS1zR1n' - const filePath = 'test/test-data/badnode.json' + const filePath = 'test/fixtures/test-data/badnode.json' const expectedResult = { data: fs.readFileSync(filePath), multihash: 'QmfY37rjbPCZRnhvvJuQ46htW3VCAWziVB991P79h6WSv6', @@ -214,7 +214,7 @@ module.exports = (ctl) => { }) it('returns error for request without data', (done) => { - const filePath = 'test/test-data/badnode.json' + const filePath = 'test/fixtures/test-data/badnode.json' ctl.object.patch.setData(null, filePath, (err) => { expect(err).to.exist() @@ -224,7 +224,7 @@ module.exports = (ctl) => { it('updates value', (done) => { const key = 'QmfY37rjbPCZRnhvvJuQ46htW3VCAWziVB991P79h6WSv6' - const filePath = 'test/test-data/badnode.json' + const filePath = 'test/fixtures/test-data/badnode.json' const expectedResult = { data: fs.readFileSync(filePath), multihash: 'QmfY37rjbPCZRnhvvJuQ46htW3VCAWziVB991P79h6WSv6', diff --git a/test/http-api/spec/block.js b/test/http-api/spec/block.js index c3bfda135a..643fd0b766 100644 --- a/test/http-api/spec/block.js +++ b/test/http-api/spec/block.js @@ -35,7 +35,7 @@ module.exports = (http) => { it('updates value', (done) => { const form = new FormData() - const filePath = 'test/test-data/hello' + const filePath = 'test/fixtures/test-data/hello' form.append('data', fs.createReadStream(filePath)) const headers = form.getHeaders() const expectedResult = { diff --git a/test/http-api/spec/config.js b/test/http-api/spec/config.js index 43cc49409b..e9e8886cdb 100644 --- a/test/http-api/spec/config.js +++ b/test/http-api/spec/config.js @@ -10,7 +10,7 @@ const path = require('path') module.exports = (http) => { describe('/config', () => { const configPath = path.join(__dirname, '../../repo-tests-run/config') - const originalConfigPath = path.join(__dirname, '../../go-ipfs-repo/config') + const originalConfigPath = path.join(__dirname, '../../fixtures/go-ipfs-repo/config') let updatedConfig let api @@ -173,7 +173,7 @@ module.exports = (http) => { it('returns 500 if the config is invalid', (done) => { const form = new FormData() - const filePath = 'test/test-data/badconfig' + const filePath = 'test/fixtures/test-data/badconfig' form.append('file', fs.createReadStream(filePath)) const headers = form.getHeaders() @@ -192,7 +192,7 @@ module.exports = (http) => { it('updates value', (done) => { const form = new FormData() - const filePath = 'test/test-data/otherconfig' + const filePath = 'test/fixtures/test-data/otherconfig' form.append('file', fs.createReadStream(filePath)) const headers = form.getHeaders() const expectedConfig = JSON.parse(fs.readFileSync(filePath, 'utf8')) diff --git a/test/http-api/spec/files.js b/test/http-api/spec/files.js index 1ff7b27c88..9a22f6370c 100644 --- a/test/http-api/spec/files.js +++ b/test/http-api/spec/files.js @@ -42,7 +42,7 @@ module.exports = (http) => { url: '/api/v0/cat?arg=QmT78zSuBmuS4z925WZfrqQ1qHaJ56DQaTfyMUF7F8ff5o' }, (res) => { expect(res.statusCode).to.equal(200) - expect(res.rawPayload).to.deep.equal(new Buffer('hello world' + '\n')) + expect(res.rawPayload).to.deep.equal(Buffer.from('hello world' + '\n')) expect(res.payload).to.equal('hello world' + '\n') done() }) diff --git a/test/http-api/spec/object.js b/test/http-api/spec/object.js index d39560ca76..b3bf547c8a 100644 --- a/test/http-api/spec/object.js +++ b/test/http-api/spec/object.js @@ -64,7 +64,7 @@ module.exports = (http) => { url: '/api/v0/object/get?arg=QmdfTbBqBPQ7VNxZEYEj14VmRuZBkqFbiwReogJgS1zR1n' }, (res) => { expect(res.statusCode).to.equal(200) - expect(res.result.Links).to.be.eql([]) + expect(res.result.Links).to.eql([]) expect(res.result.Data).to.be.empty() done() }) @@ -91,7 +91,7 @@ module.exports = (http) => { it('returns 500 if the node is invalid', (done) => { const form = new FormData() - const filePath = 'test/test-data/badnode.json' + const filePath = 'test/fixtures/test-data/badnode.json' form.append('file', fs.createReadStream(filePath)) const headers = form.getHeaders() @@ -110,12 +110,12 @@ module.exports = (http) => { it('updates value', (done) => { const form = new FormData() - const filePath = 'test/test-data/node.json' + const filePath = 'test/fixtures/test-data/node.json' form.append('data', fs.createReadStream(filePath)) const headers = form.getHeaders() const expectedResult = { - Data: new Buffer('another'), + Data: Buffer.from('another'), Hash: 'QmZZmY4KCu9r3e7M2Pcn46Fc5qbn6NpzaAGaYb22kbfTqm', Links: [{ Name: 'some link', @@ -291,7 +291,7 @@ module.exports = (http) => { it('returns 500 for request with invalid key', (done) => { const form = new FormData() - const filePath = 'test/test-data/badconfig' + const filePath = 'test/fixtures/test-data/badconfig' form.append('file', fs.createReadStream(filePath)) const headers = form.getHeaders() @@ -310,7 +310,7 @@ module.exports = (http) => { it('updates value', (done) => { const form = new FormData() - const filePath = 'test/test-data/badconfig' + const filePath = 'test/fixtures/test-data/badconfig' form.append('data', fs.createReadStream(filePath)) const headers = form.getHeaders() const expectedResult = { @@ -366,7 +366,7 @@ module.exports = (http) => { it('returns 500 for request with invalid key', (done) => { const form = new FormData() - const filePath = 'test/test-data/badconfig' + const filePath = 'test/fixtures/test-data/badconfig' form.append('file', fs.createReadStream(filePath)) const headers = form.getHeaders() @@ -385,7 +385,7 @@ module.exports = (http) => { it('updates value', (done) => { const form = new FormData() - const filePath = 'test/test-data/badconfig' + const filePath = 'test/fixtures/test-data/badconfig' form.append('data', fs.createReadStream(filePath)) const headers = form.getHeaders() const expectedResult = { diff --git a/test/http-api/spec/pubsub.js b/test/http-api/spec/pubsub.js index cb5447f999..245b6d153c 100644 --- a/test/http-api/spec/pubsub.js +++ b/test/http-api/spec/pubsub.js @@ -14,7 +14,7 @@ module.exports = (http) => { let api let tmpNode - const buf = new Buffer('some message') + const buf = Buffer.from('some message') const topic = 'nonScents' const topicNotSubscribed = 'somethingRandom' diff --git a/test/interop/browser.js b/test/interop/browser.js index e69de29bb2..40a2a297b4 100644 --- a/test/interop/browser.js +++ b/test/interop/browser.js @@ -0,0 +1,10 @@ +/* eslint-env mocha */ +'use strict' + +describe('browser interop tests', () => { + it('need to get written', function (done) { + this.timeout(10 * 1000) + // for teardown time + setTimeout(done, 5 * 1000) + }) +}) diff --git a/test/interop/circuit-relay.js b/test/interop/circuit-relay.js new file mode 100644 index 0000000000..2bf1c707dc --- /dev/null +++ b/test/interop/circuit-relay.js @@ -0,0 +1,167 @@ +/* eslint max-nested-callbacks: ["error", 8] */ +/* eslint-env mocha */ +'use strict' + +const chai = require('chai') +const dirtyChai = require('dirty-chai') +const expect = chai.expect +chai.use(dirtyChai) +const parallel = require('async/parallel') +const series = require('async/series') +const bl = require('bl') +const waterfall = require('async/waterfall') +const multiaddr = require('multiaddr') +const crypto = require('crypto') + +const ads = require('../utils/another-daemon-spawner') +const js = ads.spawnJsNode +const go = ads.spawnGoNode +const stop = ads.stopNodes + +describe.skip('circuit interop', () => { + let jsTCP + let jsTCPAddrs + let jsWS + let jsWSAddrs + let jsRelayAddrs + + let goRelayAddrs + + let goTCPAddrs + let goTCP + + let goWSAddrs + let goWS + + beforeEach((done) => { + const base = '/ip4/127.0.0.1/tcp' + + parallel([ + (cb) => js([`${base}/61454/ws`, `${base}/61453`], true, cb), + (cb) => js([`${base}/9002`], cb), + (cb) => js([`${base}/9003/ws`], cb), + (cb) => go([`${base}/0/ws`, `${base}/0`], true, cb), + (cb) => go([`${base}/0`], cb), + (cb) => go([`${base}/0/ws`], cb) + ], (err, nodes) => { + expect(err).to.not.exist() + + jsRelayAddrs = nodes[0][1].map((a) => a.toString()).filter((a) => !a.includes('/p2p-circuit')) + jsTCP = nodes[1][0] + jsTCPAddrs = nodes[1][1].map((a) => a.toString()).filter((a) => a.includes('/p2p-circuit')) + jsWS = nodes[2][0] + jsWSAddrs = nodes[2][1].map((a) => a.toString()).filter((a) => a.includes('/p2p-circuit')) + + goRelayAddrs = nodes[3][1] + goTCP = nodes[4][0].api + goTCPAddrs = nodes[4][1] + goWS = nodes[5][0].api + goWSAddrs = nodes[5][1] + done() + }) + }) + + afterEach(() => stop()) + + it('jsWS <-> jsRelay <-> jsTCP', (done) => { + const data = crypto.randomBytes(128) + series([ + (cb) => jsWS.swarm.connect(jsRelayAddrs[0], cb), + (cb) => jsTCP.swarm.connect(jsRelayAddrs[1], cb), + (cb) => setTimeout(cb, 1000), + (cb) => jsTCP.swarm.connect(jsWSAddrs[0], cb) + ], (err) => { + expect(err).to.not.exist() + waterfall([ + (cb) => jsTCP.files.add(data, cb), + (res, cb) => jsWS.files.cat(res[0].hash, cb), + (stream, cb) => stream.pipe(bl(cb)) + ], done) + }) + }) + + it('goWS <-> jsRelay <-> goTCP', (done) => { + const data = crypto.randomBytes(128) + series([ + (cb) => goWS.swarm.connect(jsRelayAddrs[0], cb), + (cb) => goTCP.swarm.connect(jsRelayAddrs[1], cb), + (cb) => setTimeout(cb, 1000), + (cb) => goTCP.swarm.connect(`/p2p-circuit/ipfs/${multiaddr(goWSAddrs[0]).getPeerId()}`, cb) + ], (err) => { + expect(err).to.not.exist() + waterfall([ + (cb) => goTCP.files.add(data, cb), + (res, cb) => goWS.files.cat(res[0].hash, cb), + (stream, cb) => stream.pipe(bl(cb)) + ], done) + }) + }) + + it('jsWS <-> jsRelay <-> goTCP', (done) => { + const data = crypto.randomBytes(128) + series([ + (cb) => jsWS.swarm.connect(jsRelayAddrs[0], cb), + (cb) => goTCP.swarm.connect(jsRelayAddrs[1], cb), + (cb) => setTimeout(cb, 1000), + (cb) => goTCP.swarm.connect(jsWSAddrs[0], cb) + ], (err) => { + expect(err).to.not.exist() + waterfall([ + (cb) => goTCP.files.add(data, cb), + (res, cb) => jsWS.files.cat(res[0].hash, cb), + (stream, cb) => stream.pipe(bl(cb)) + ], done) + }) + }) + + it('jsTCP <-> goRelay <-> jsWS', (done) => { + const data = crypto.randomBytes(128) + series([ + (cb) => jsTCP.swarm.connect(goRelayAddrs[2], cb), + (cb) => jsWS.swarm.connect(goRelayAddrs[0], cb), + (cb) => setTimeout(cb, 1000), + (cb) => jsWS.swarm.connect(jsTCPAddrs[0], cb) + ], (err) => { + expect(err).to.not.exist() + waterfall([ + (cb) => jsTCP.files.add(data, cb), + (res, cb) => jsWS.files.cat(res[0].hash, cb), + (stream, cb) => stream.pipe(bl(cb)) + ], done) + }) + }) + + it('goTCP <-> goRelay <-> goWS', (done) => { + const data = crypto.randomBytes(128) + series([ + (cb) => goWS.swarm.connect(goRelayAddrs[0], cb), + (cb) => goTCP.swarm.connect(goRelayAddrs[2], cb), + (cb) => setTimeout(cb, 1000), + (cb) => goWS.swarm.connect(`/p2p-circuit/ipfs/${multiaddr(goTCPAddrs[0]).getPeerId()}`, cb) + ], (err) => { + expect(err).to.not.exist() + waterfall([ + (cb) => goTCP.files.add(data, cb), + (res, cb) => goWS.files.cat(res[0].hash, cb), + (stream, cb) => stream.pipe(bl(cb)) + ], done) + }) + }) + + it('jsWS <-> goRelay <-> goTCP', (done) => { + const data = crypto.randomBytes(128) + series([ + (cb) => jsWS.swarm.connect(goRelayAddrs[0], cb), + (cb) => goTCP.swarm.connect(goRelayAddrs[2], cb), + (cb) => setTimeout(cb, 1000), + (cb) => goTCP.swarm.connect(`/p2p-circuit/ipfs/${multiaddr(jsWSAddrs[0]).getPeerId()}`, cb) + ], (err) => { + expect(err).to.not.exist() + waterfall([ + (cb) => goTCP.files.add(data, cb), + (res, cb) => jsWS.files.cat(res[0].hash, cb), + (stream, cb) => stream.pipe(bl(cb)) + ], done) + }) + }) +}) diff --git a/test/interop/exchange-files.js b/test/interop/exchange-files.js index 010bb4a471..f6b7b68d53 100644 --- a/test/interop/exchange-files.js +++ b/test/interop/exchange-files.js @@ -17,10 +17,9 @@ const rimraf = require('rimraf') const rmDir = promisify(rimraf) -const tmpDir = require('./util').tmpDir - -const GoDaemon = require('./daemons/go') -const JsDaemon = require('./daemons/js') +const tmpDir = require('../utils/interop-daemon-spawner/util').tmpDir +const GoDaemon = require('../utils/interop-daemon-spawner/go') +const JsDaemon = require('../utils/interop-daemon-spawner/js') const sizes = [ 1024, @@ -42,12 +41,13 @@ const dirs = [ 100 ] -describe('basic', () => { +describe('exchange files', () => { let goDaemon let jsDaemon let js2Daemon - before((done) => { + before(function (done) { + this.timeout(15 * 1000) goDaemon = new GoDaemon() jsDaemon = new JsDaemon({port: 1}) js2Daemon = new JsDaemon({port: 2}) @@ -172,7 +172,7 @@ describe('basic', () => { depth: 5, number: num }).then(() => { - return goDaemon.api.util.addFromFs(dir, {recursive: true}) + return goDaemon.api.util.addFromFs(dir, { recursive: true }) }).then((res) => { const hash = res[res.length - 1].hash return jsDaemon.api.object.get(hash) @@ -189,7 +189,7 @@ describe('basic', () => { depth: 5, number: num }).then(() => { - return jsDaemon.api.util.addFromFs(dir, {recursive: true}) + return jsDaemon.api.util.addFromFs(dir, { recursive: true }) }).then((res) => { const hash = res[res.length - 1].hash return goDaemon.api.object.get(hash) @@ -206,7 +206,7 @@ describe('basic', () => { depth: 5, number: num }).then(() => { - return js2Daemon.api.util.addFromFs(dir, {recursive: true}) + return js2Daemon.api.util.addFromFs(dir, { recursive: true }) }).then((res) => { const hash = res[res.length - 1].hash return jsDaemon.api.object.get(hash) diff --git a/test/interop/kad-dht.js b/test/interop/kad-dht.js index a9564fb269..3c546986d5 100644 --- a/test/interop/kad-dht.js +++ b/test/interop/kad-dht.js @@ -11,8 +11,8 @@ const parallel = require('async/parallel') const waterfall = require('async/waterfall') const bl = require('bl') -const GODaemon = require('./daemons/go') -const JSDaemon = require('./daemons/js') +const GODaemon = require('../utils/interop-daemon-spawner/go') +const JSDaemon = require('../utils/interop-daemon-spawner/js') describe.skip('kad-dht', () => { describe('a JS node in the land of Go', () => { diff --git a/test/interop/node.js b/test/interop/node.js index 4ebf41db24..b3108e28bf 100644 --- a/test/interop/node.js +++ b/test/interop/node.js @@ -1,8 +1,7 @@ /* eslint-env mocha */ 'use strict' -describe('interop', () => { - require('./exchange-files') - require('./kad-dht') - require('./repo') -}) +require('./repo') +require('./exchange-files') +require('./circuit-relay') +require('./kad-dht') diff --git a/test/interop/repo.js b/test/interop/repo.js index f7200ddd37..bd981d0ff9 100644 --- a/test/interop/repo.js +++ b/test/interop/repo.js @@ -10,17 +10,16 @@ const bl = require('bl') const crypto = require('crypto') const os = require('os') -const GoDaemon = require('./daemons/go') -const JsDaemon = require('./daemons/js') +const GoDaemon = require('../utils/interop-daemon-spawner/go') +const JsDaemon = require('../utils/interop-daemon-spawner/js') function catAndCheck (daemon, hash, data, callback) { waterfall([ (cb) => daemon.api.cat(hash, cb), (stream, cb) => stream.pipe(bl(cb)) ], (err, file) => { - console.log('got file') expect(err).to.not.exist() - expect(file).to.be.eql(data) + expect(file).to.eql(data) callback() }) } @@ -59,7 +58,9 @@ describe('repo', () => { ], done) }) - it('read repo: js -> go', (done) => { + // This was last due to an update on go-ipfs that changed how datastore is + // configured + it.skip('read repo: js -> go', (done) => { const dir = os.tmpdir() + '/' + Math.ceil(Math.random() * 10000) const data = crypto.randomBytes(1024 * 5) diff --git a/test/node.js b/test/node.js deleted file mode 100644 index fd97536cf0..0000000000 --- a/test/node.js +++ /dev/null @@ -1,46 +0,0 @@ -'use strict' - -let testCore = true -let testHTTP = true -let testCLI = true -let testGatway = true - -if (process.env.TEST) { - switch (process.env.TEST) { - case 'core': - testHTTP = false - testCLI = false - break - case 'http': - testCore = false - testCLI = false - break - case 'gateway': - testCore = false - testCLI = false - testHTTP = false - break - case 'cli': - testCore = false - testHTTP = false - break - default: - break - } -} - -if (testCore) { - // require('./core/node') -} - -if (testHTTP) { - require('./http-api') -} - -if (testCLI) { - require('./cli') -} - -if (testGatway) { - require('./gateway') -} diff --git a/test/utils/another-daemon-spawner.js b/test/utils/another-daemon-spawner.js new file mode 100644 index 0000000000..c8d2295c5a --- /dev/null +++ b/test/utils/another-daemon-spawner.js @@ -0,0 +1,124 @@ +/* eslint-env mocha */ + +'use strict' + +const waterfall = require('async/waterfall') +const series = require('async/series') + +const relayConfig = require('./ipfs-factory-daemon/default-config.json') +const Factory = require('./ipfs-factory-daemon') +const GoDaemon = require('./interop-daemon-spawner/go') + +const nodes = [] +const factory = new Factory() +exports = module.exports + +exports.spawnGoNode = (addrs, hop, api, gateway, callback) => { + if (typeof hop === 'function') { + callback = hop + hop = false + } + if (typeof api === 'function') { + callback = api + api = 0 + } + if (typeof gateway === 'function') { + callback = gateway + gateway = 0 + } + + api = api || 0 + gateway = gateway || 0 + + const daemon = new GoDaemon({ + disposable: true, + init: true, + config: { + Addresses: { + Swarm: addrs, + API: `/ip4/0.0.0.0/tcp/${api}`, + Gateway: `/ip4/0.0.0.0/tcp/${gateway}` + }, + Swarm: { + AddrFilters: null, + DisableBandwidthMetrics: false, + DisableNatPortMap: false, + DisableRelay: false, + EnableRelayHop: hop + } + } + }) + + daemon.start((err) => { + if (err) { + return callback(err) + } + daemon.api.id((err, id) => { + if (err) { + return callback(err) + } + nodes.push(daemon) + callback(null, daemon, id.addresses) + }) + }) +} + +exports.spawnJsNode = (addrs, hop, api, gateway, callback) => { + let relayPeer + let relayAddrs + + if (typeof hop === 'function') { + callback = hop + hop = false + } + if (typeof api === 'function') { + callback = api + api = 0 + } + if (typeof gateway === 'function') { + callback = gateway + gateway = 0 + } + + api = api || 0 + gateway = gateway || 0 + + callback = callback || function noop () {} + + waterfall([ + (cb) => factory.spawnNode(null, Object.assign(relayConfig, { + Addresses: { + Swarm: addrs, + API: `/ip4/0.0.0.0/tcp/${api}`, + Gateway: `/ip4/0.0.0.0/tcp/${gateway}` + }, + EXPERIMENTAL: { + Swarm: { + DisableRelay: false, + EnableRelayHop: hop + } + } + }), cb), + (node, cb) => { + relayPeer = node + relayPeer.swarm.localAddrs(cb) + }, + (addrs, cb) => { + relayAddrs = addrs + cb() + } + ], (err) => { + if (err) { + return callback(err) + } + callback(null, relayPeer, relayAddrs) + }) +} + +exports.stopNodes = (callback) => { + series([ + (cb) => factory.dismantle(cb) + ].concat(nodes.map((node) => (cb) => { + setTimeout(() => node.stop(cb), 100) + })), callback) +} diff --git a/test/interop/daemons/go.js b/test/utils/interop-daemon-spawner/go.js similarity index 91% rename from test/interop/daemons/go.js rename to test/utils/interop-daemon-spawner/go.js index e8a8b214af..286f559afc 100644 --- a/test/interop/daemons/go.js +++ b/test/utils/interop-daemon-spawner/go.js @@ -15,13 +15,15 @@ class GoDaemon { this.disposable = opts.disposable this.node = null this.api = null + this.config = opts.config || {} } start (callback) { waterfall([ (cb) => { if (this.disposable) { - ctl.disposable({init: this.init}, cb) + const config = Object.assign({ init: this.init }, this.config) + ctl.disposable(config, cb) } else if (this.init) { ctl.local(this.path, (err, node) => { if (err) { diff --git a/test/interop/daemons/js.js b/test/utils/interop-daemon-spawner/js.js similarity index 97% rename from test/interop/daemons/js.js rename to test/utils/interop-daemon-spawner/js.js index 4b4089d494..e96850c82b 100644 --- a/test/interop/daemons/js.js +++ b/test/utils/interop-daemon-spawner/js.js @@ -4,7 +4,7 @@ const EventEmitter = require('events').EventEmitter const IPFSAPI = require('ipfs-api') const series = require('async/series') const rimraf = require('rimraf') -const tmpDir = require('../util').tmpDir +const tmpDir = require('./util').tmpDir const HttpApi = require('../../../src/http') diff --git a/test/interop/util.js b/test/utils/interop-daemon-spawner/util.js similarity index 100% rename from test/interop/util.js rename to test/utils/interop-daemon-spawner/util.js diff --git a/test/utils/ipfs-factory-instance/index.js b/test/utils/ipfs-factory-instance/index.js index 9d36a361f0..3b77e290a9 100644 --- a/test/utils/ipfs-factory-instance/index.js +++ b/test/utils/ipfs-factory-instance/index.js @@ -29,8 +29,8 @@ function Factory () { if (!repoPath) { repoPath = '/tmp/.ipfs-' + Math.random() - .toString() - .substring(2, 8) + .toString() + .substring(2, 8) } config = config || defaultConfig diff --git a/test/utils/on-and-off.js b/test/utils/on-and-off.js index 6bc44b7a71..d9886275ff 100644 --- a/test/utils/on-and-off.js +++ b/test/utils/on-and-off.js @@ -16,14 +16,16 @@ function off (tests) { let thing = {} let repoPath - before(() => { + before(function () { + this.timeout(30 * 1000) repoPath = os.tmpdir() + '/ipfs-' + Math.random().toString().substring(2, 16) thing.ipfs = ipfsExec(repoPath) thing.ipfs.repoPath = repoPath return thing.ipfs('init') }) - after((done) => { + after(function (done) { + this.timeout(20 * 1000) clean(repoPath) setImmediate(done) }) @@ -41,7 +43,7 @@ function on (tests) { // CI takes longer to instantiate the daemon, // so we need to increase the timeout for the // before step - this.timeout(20 * 1000) + this.timeout(30 * 1000) factory = new Factory() @@ -53,7 +55,10 @@ function on (tests) { }) }) - after((done) => factory.dismantle(done)) + after(function (done) { + this.timeout(20 * 1000) + factory.dismantle(done) + }) tests(thing) })