Skip to content
This repository was archived by the owner on Aug 1, 2023. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from 3 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
4,493 changes: 2,775 additions & 1,718 deletions package-lock.json

Large diffs are not rendered by default.

11 changes: 6 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,27 +38,28 @@
},
"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.37.0",
"ipfs-http-client": "^33.1.0",
"ipfs": "^0.37.1",
"ipfs-http-client": "^37.0.1",
"ipfs-repo": "~0.26.6",
"ipfs-unixfs": "~0.1.16",
"ipfsd-ctl": "~0.42.4",
"ipfsd-ctl": "~0.47.1",
"ipns": "~0.5.1",
"is-ci": "^2.0.0",
"is-os": "^1.0.1",
Expand Down
52 changes: 26 additions & 26 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,99 +44,98 @@ 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 () => {
it('should add v0 and cat v1 (go0 -> go0)', async function () {
Comment thread
PedroMiguelSS marked this conversation as resolved.
Outdated
const input = Buffer.from(hat())
const res = await daemons.go0.api.add(input, { cidVersion: 0 })
const cidv1 = new CID(res[0].hash).toV1()
const output = await daemons.go0.api.cat(cidv1)
expect(output).to.deep.equal(input)
})

it('should add v0 and cat v1 (js0 -> js0)', async () => {
it('should add v0 and cat v1 (js0 -> js0)', async function () {
const input = Buffer.from(hat())
const res = await daemons.js0.api.add(input, { cidVersion: 0 })
const cidv1 = new CID(res[0].hash).toV1()
const output = await daemons.js0.api.cat(cidv1)
expect(output).to.deep.equal(input)
})

it('should add v0 and cat v1 (go0 -> go1)', async () => {
it('should add v0 and cat v1 (go0 -> go1)', async function () {
const input = Buffer.from(hat())
const res = await daemons.go0.api.add(input, { cidVersion: 0 })
const cidv1 = new CID(res[0].hash).toV1()
const output = await daemons.go1.api.cat(cidv1)
expect(output).to.deep.equal(input)
})

it('should add v0 and cat v1 (js0 -> js1)', async () => {
it('should add v0 and cat v1 (js0 -> js1)', async function () {
const input = Buffer.from(hat())
const res = await daemons.js0.api.add(input, { cidVersion: 0 })
const cidv1 = new CID(res[0].hash).toV1()
const output = await daemons.js1.api.cat(cidv1)
expect(output).to.deep.equal(input)
})

it('should add v0 and cat v1 (js0 -> go0)', async () => {
it('should add v0 and cat v1 (js0 -> go0)', async function () {
const input = Buffer.from(hat())
const res = await daemons.js0.api.add(input, { cidVersion: 0 })
const cidv1 = new CID(res[0].hash).toV1()
const output = await daemons.go0.api.cat(cidv1)
expect(output).to.deep.equal(input)
})

it('should add v0 and cat v1 (go0 -> js0)', async () => {
it('should add v0 and cat v1 (go0 -> js0)', async function () {
const input = Buffer.from(hat())
const res = await daemons.go0.api.add(input, { cidVersion: 0 })
const cidv1 = new CID(res[0].hash).toV1()
const output = await daemons.js0.api.cat(cidv1)
expect(output).to.deep.equal(input)
})

it('should add v1 and cat v0 (go0 -> go0)', async () => {
it('should add v1 and cat v0 (go0 -> go0)', async function () {
const input = Buffer.from(hat())
const res = await daemons.go0.api.add(input, { cidVersion: 1, rawLeaves: false })
const cidv0 = new CID(res[0].hash).toV0()
const output = await daemons.go0.api.cat(cidv0)
expect(output).to.deep.equal(input)
})

it('should add v1 and cat v0 (js0 -> js0)', async () => {
it('should add v1 and cat v0 (js0 -> js0)', async function () {
const input = Buffer.from(hat())
const res = await daemons.js0.api.add(input, { cidVersion: 1, rawLeaves: false })
const cidv0 = new CID(res[0].hash).toV0()
const output = await daemons.js0.api.cat(cidv0)
expect(output).to.deep.equal(input)
})

it('should add v1 and cat v0 (go0 -> go1)', async () => {
it('should add v1 and cat v0 (go0 -> go1)', async function () {
const input = Buffer.from(hat())
const res = await daemons.go0.api.add(input, { cidVersion: 1, rawLeaves: false })
const cidv0 = new CID(res[0].hash).toV0()
const output = await daemons.go1.api.cat(cidv0)
expect(output).to.deep.equal(input)
})

it('should add v1 and cat v0 (js0 -> js1)', async () => {
it('should add v1 and cat v0 (js0 -> js1)', async function () {
const input = Buffer.from(hat())
const res = await daemons.js0.api.add(input, { cidVersion: 1, rawLeaves: false })
const cidv0 = new CID(res[0].hash).toV0()
const output = await daemons.js1.api.cat(cidv0)
expect(output).to.deep.equal(input)
})

it('should add v1 and cat v0 (js0 -> go0)', async () => {
it('should add v1 and cat v0 (js0 -> go0)', async function () {
const input = Buffer.from(hat())
const res = await daemons.js0.api.add(input, { cidVersion: 1, rawLeaves: false })
const cidv0 = new CID(res[0].hash).toV0()
const output = await daemons.go0.api.cat(cidv0)
expect(output).to.deep.equal(input)
})

it('should add v1 and cat v0 (go0 -> js0)', async () => {
it('should add v1 and cat v0 (go0 -> js0)', async function () {
const input = Buffer.from(hat())
const res = await daemons.go0.api.add(input, { cidVersion: 1, rawLeaves: false })
const cidv0 = new CID(res[0].hash).toV0()
Expand Down
20 changes: 7 additions & 13 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,18 +42,15 @@ 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)
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`])
])
}
}
16 changes: 8 additions & 8 deletions test/circuit/browser.js
Original file line number Diff line number Diff line change
Expand Up @@ -86,8 +86,8 @@ module.exports = {
'go-browser-browser': {
create: (callback) => series([
(cb) => createGo([`${base}/ws`], cb),
(cb) => createProc([`/ip4/127.0.0.1/tcp/24642/ws/p2p-websocket-star`], cb),
(cb) => createProc([`/ip4/127.0.0.1/tcp/24642/ws/p2p-websocket-star`], cb)
(cb) => createProc(['/ip4/127.0.0.1/tcp/24642/ws/p2p-websocket-star'], cb),
(cb) => createProc(['/ip4/127.0.0.1/tcp/24642/ws/p2p-websocket-star'], cb)
], callback),
connect: (nodeA, nodeB, relay, callback) => {
series([
Expand All @@ -103,8 +103,8 @@ module.exports = {
'js-browser-browser': {
create: (callback) => series([
(cb) => createJs([`${base}/ws`], cb),
(cb) => createProc([`/ip4/127.0.0.1/tcp/24642/ws/p2p-websocket-star`], cb),
(cb) => createProc([`/ip4/127.0.0.1/tcp/24642/ws/p2p-websocket-star`], cb)
(cb) => createProc(['/ip4/127.0.0.1/tcp/24642/ws/p2p-websocket-star'], cb),
(cb) => createProc(['/ip4/127.0.0.1/tcp/24642/ws/p2p-websocket-star'], cb)
], callback),
connect: (nodeA, nodeB, relay, callback) => {
series([
Expand All @@ -118,8 +118,8 @@ module.exports = {
},
'browser-browser-go': {
create: (callback) => series([
(cb) => createProc([`/ip4/127.0.0.1/tcp/24642/ws/p2p-websocket-star`], cb),
(cb) => createProc([`/ip4/127.0.0.1/tcp/24642/ws/p2p-websocket-star`], cb),
(cb) => createProc(['/ip4/127.0.0.1/tcp/24642/ws/p2p-websocket-star'], cb),
(cb) => createProc(['/ip4/127.0.0.1/tcp/24642/ws/p2p-websocket-star'], cb),
(cb) => createGo([`${base}/ws`], cb)
], callback),
connect: (nodeA, nodeB, relay, callback) => {
Expand All @@ -134,8 +134,8 @@ module.exports = {
},
'browser-browser-js': {
create: (callback) => series([
(cb) => createProc([`/ip4/127.0.0.1/tcp/24642/ws/p2p-websocket-star`], cb),
(cb) => createProc([`/ip4/127.0.0.1/tcp/24642/ws/p2p-websocket-star`], cb),
(cb) => createProc(['/ip4/127.0.0.1/tcp/24642/ws/p2p-websocket-star'], cb),
(cb) => createProc(['/ip4/127.0.0.1/tcp/24642/ws/p2p-websocket-star'], cb),
(cb) => createJs([`${base}/ws`], cb)
], callback),
connect: (nodeA, nodeB, relay, callback) => {
Expand Down
Loading