Skip to content
This repository was archived by the owner on Aug 1, 2023. It is now read-only.

chore: update ipfsd-ctl version and use daemon.js util file #86

Merged
merged 16 commits into from
Oct 21, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 8 additions & 22 deletions .aegir.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
'use strict'

const createServer = require('ipfsd-ctl').createServer
const parallel = require('async/parallel')
const rendezvous = require('libp2p-websocket-star-rendezvous')

let rzserver

const server = createServer()
module.exports = {
karma: {
Expand All @@ -20,27 +18,15 @@ module.exports = {
},
hooks: {
browser: {
pre: (done) => {
parallel([
(cb) => server.start(cb),
(cb) => {
rendezvous.start({
port: 24642
}, (err, _rzserver) => {
if (err) {
return done(err)
}
rzserver = _rzserver
cb()
})
}
], done)
pre: async () => {
await server.start()
rzserver = await rendezvous.start({
port: 24642
})
},
post: (done) => {
parallel([
(cb) => server.stop(cb),
(cb) => rzserver.stop(cb)
], done)
post: async () => {
await server.stop()
await rzserver.stop()
}
}
}
Expand Down
16 changes: 10 additions & 6 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,32 +38,33 @@
},
"homepage": "https://github.com/ipfs/interop#readme",
"dependencies": {
"aegir": "^20.0.0",
"aegir": "^20.3.1",
"async": "^2.6.2",
"base64url": "^3.0.0",
"bl": "^3.0.0",
"bs58": "^4.0.1",
"chai": "^4.2.0",
"cids": "~0.7.1",
"cross-env": "^5.2.0",
"delay": "^4.3.0",
"detect-node": "^2.0.4",
"dir-compare": "^1.7.1",
"dirty-chai": "^2.0.1",
"eslint-plugin-react": "^7.12.4",
"expose-loader": "~0.7.5",
"form-data": "^2.3.3",
"go-ipfs-dep": "~0.4.20",
"go-ipfs-dep": "~0.4.22",
"hat": "~0.0.3",
"ipfs": "^0.38.0",
"ipfs-http-client": "^33.1.0",
"ipfs-http-client": "^38.2.1",
"ipfs-repo": "~0.26.6",
"ipfs-unixfs": "~0.1.16",
"ipfsd-ctl": "~0.42.4",
"ipfsd-ctl": "~0.47.4",
"ipns": "~0.5.1",
"is-ci": "^2.0.0",
"is-os": "^1.0.1",
"left-pad": "^1.3.0",
"libp2p-websocket-star-rendezvous": "~0.3.0",
"libp2p-websocket-star-rendezvous": "~0.4.1",
"lodash": "^4.17.11",
"merge-options": "^1.0.1",
"mocha": "^5.2.0",
Expand All @@ -77,5 +78,8 @@
"stream-to-promise": "^2.2.0",
"transform-loader": "~0.2.4"
},
"contributors": []
"contributors": [],
"devDependencies": {
"karma-mocha-webworker": "^1.3.0"
}
}
28 changes: 14 additions & 14 deletions test/cid-version-agnostic.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,23 +7,24 @@ const expect = chai.expect
chai.use(dirtyChai)
const hat = require('hat')
const CID = require('cids')
const {
spawnInitAndStartGoDaemon,
spawnInitAndStartJsDaemon,
stopDaemon
} = require('./utils/daemon')
const { spawnGoDaemon, spawnJsDaemon } = require('./utils/daemon')

describe('CID version agnostic', () => {
const jsDaemonOptions = {
config: {
Bootstrap: []
}
}

describe('CID version agnostic', function () {
this.timeout(50 * 1000)
const daemons = {}

before(async function () {
this.timeout(50 * 1000)

const [js0, js1, go0, go1] = await Promise.all([
spawnInitAndStartJsDaemon(),
spawnInitAndStartJsDaemon(),
spawnInitAndStartGoDaemon(),
spawnInitAndStartGoDaemon()
spawnJsDaemon(jsDaemonOptions),
spawnJsDaemon(jsDaemonOptions),
spawnGoDaemon(),
spawnGoDaemon()
])
Object.assign(daemons, { js0, js1, go0, go1 })

Expand All @@ -43,8 +44,7 @@ describe('CID version agnostic', () => {
})

after(function () {
this.timeout(30 * 1000)
return Promise.all(Object.values(daemons).map(stopDaemon))
return Promise.all(Object.values(daemons).map((daemon) => daemon.stop()))
})

it('should add v0 and cat v1 (go0 -> go0)', async () => {
Expand Down
24 changes: 9 additions & 15 deletions test/circuit.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,8 @@

const chai = require('chai')
const dirtyChai = require('dirty-chai')
const expect = chai.expect
chai.use(dirtyChai)

const parallel = require('async/parallel')

const all = require('./circuit/all')
const browser = require('./circuit/browser')

Expand Down Expand Up @@ -45,21 +42,18 @@ describe('circuit', () => {
dsc(test, function () {
this.timeout(tests[test].timeout)

before((done) => {
tests[test].create((err, _nodes) => {
expect(err).to.not.exist()
nodes = _nodes.map((n) => n.ipfsd)
nodeA = _nodes[0]
relay = _nodes[1]
nodeB = _nodes[2]
done()
})
before(async () => {
const _nodes = await tests[test].create()
nodes = _nodes.map((n) => n.ipfsd)
nodeA = _nodes[0]
relay = _nodes[1]
nodeB = _nodes[2]
})

after((done) => parallel(nodes.map((ipfsd) => (cb) => ipfsd.stop(cb)), done))
after(() => Promise.all(nodes.map((node) => node.stop())))

it('connect', (done) => {
tests[test].connect(nodeA, nodeB, relay, done)
it('connect', () => {
return tests[test].connect(nodeA, nodeB, relay)
})

it('send', (done) => {
Expand Down
82 changes: 40 additions & 42 deletions test/circuit/all.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@
/* eslint-env mocha */
'use strict'

const series = require('async/series')

const utils = require('../utils/circuit')

const createJs = utils.createJsNode
Expand All @@ -13,59 +11,59 @@ const base = '/ip4/127.0.0.1/tcp/0'

module.exports = {
'go-go-go': {
create: (callback) => series([
(cb) => createGo([`${base}/ws`], cb),
(cb) => createGo([`${base}/ws`], cb),
(cb) => createGo([`${base}/ws`], cb)
], callback)
create: () => Promise.all([
createGo([`${base}/ws`]),
createGo([`${base}/ws`]),
createGo([`${base}/ws`])
])
},
'js-go-go': {
create: (callback) => series([
(cb) => createJs([`${base}/ws`], cb),
(cb) => createGo([`${base}/ws`], cb),
(cb) => createGo([`${base}/ws`], cb)
], callback)
create: () => Promise.all([
createJs([`${base}/ws`]),
createGo([`${base}/ws`]),
createGo([`${base}/ws`])
])
},
'go-go-js': {
create: (callback) => series([
(cb) => createGo([`${base}/ws`], cb),
(cb) => createGo([`${base}/ws`], cb),
(cb) => createJs([`${base}/ws`], cb)
], callback)
create: () => Promise.all([
createGo([`${base}/ws`]),
createGo([`${base}/ws`]),
createJs([`${base}/ws`])
])
},
'js-go-js': {
create: (callback) => series([
(cb) => createJs([`${base}/ws`], cb),
(cb) => createGo([`${base}/ws`], cb),
(cb) => createJs([`${base}/ws`], cb)
], callback)
create: () => Promise.all([
createJs([`${base}/ws`]),
createGo([`${base}/ws`]),
createJs([`${base}/ws`])
])
},
'go-js-go': {
create: (callback) => series([
(cb) => createGo([`${base}/ws`], cb),
(cb) => createJs([`${base}/ws`], cb),
(cb) => createGo([`${base}/ws`], cb)
], callback)
create: () => Promise.all([
createGo([`${base}/ws`]),
createJs([`${base}/ws`]),
createGo([`${base}/ws`])
])
},
'js-js-go': {
create: (callback) => series([
(cb) => createJs([`${base}/ws`], cb),
(cb) => createJs([`${base}/ws`], cb),
(cb) => createGo([`${base}/ws`], cb)
], callback)
create: () => Promise.all([
createJs([`${base}/ws`]),
createJs([`${base}/ws`]),
createGo([`${base}/ws`])
])
},
'go-js-js': {
create: (callback) => series([
(cb) => createGo([`${base}/ws`], cb),
(cb) => createJs([`${base}/ws`], cb),
(cb) => createJs([`${base}/ws`], cb)
], callback)
create: () => Promise.all([
createGo([`${base}/ws`]),
createJs([`${base}/ws`]),
createJs([`${base}/ws`])
])
},
'js-js-js': {
create: (callback) => series([
(cb) => createJs([`${base}/ws`], cb),
(cb) => createJs([`${base}/ws`], cb),
(cb) => createJs([`${base}/ws`], cb)
], callback)
create: () => Promise.all([
createJs([`${base}/ws`]),
createJs([`${base}/ws`]),
createJs([`${base}/ws`])
])
}
}
Loading