Skip to content
This repository has been archived by the owner on Feb 12, 2024. It is now read-only.

feat: support new ctl api #2529

Merged
merged 25 commits into from
Dec 12, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
f7e1515
feat: support the new interface core tests setup
hugomrdias Oct 11, 2019
6c648ce
fix: fix key rename output
hugomrdias Oct 14, 2019
59e9437
fix: skip troublesome test
hugomrdias Oct 14, 2019
46159e0
fix: ipfsd-ctl args handling
hugomrdias Oct 14, 2019
70af49d
fix: change http api interface-core tests to new setup
hugomrdias Oct 14, 2019
522206f
fix: add reason to skip
hugomrdias Oct 17, 2019
d0d7e6c
fix: make aegir tests setup async
hugomrdias Oct 21, 2019
1b9d906
fix: fix ctl setup
hugomrdias Oct 21, 2019
b1a8620
fix: add pass option
hugomrdias Dec 4, 2019
2e57c35
fix: interface and cli tests ported
hugomrdias Dec 10, 2019
2640c9b
fix: support new ctl in core and http tests
hugomrdias Dec 10, 2019
62c01e2
fix: fix linter
hugomrdias Dec 10, 2019
8ac4ddb
chore: fix tests timeout
hugomrdias Dec 11, 2019
6e2a5f3
chore: fix tests timeout more
hugomrdias Dec 11, 2019
a950597
chore: fix webworker
hugomrdias Dec 11, 2019
db34102
chore: debug key exhcnage
hugomrdias Dec 11, 2019
c0f409e
chore: debug key exhcnage 2
hugomrdias Dec 11, 2019
9319a4a
fix: key exchange fixed
hugomrdias Dec 11, 2019
f475252
fix: overrides correctly in pubsub tests
hugomrdias Dec 11, 2019
2a809ec
fix: refactor missing pieces and await clean in bitswap tests
hugomrdias Dec 11, 2019
3231165
fix: skip test that dont work in firefox
hugomrdias Dec 11, 2019
2348948
chore: bump chromedriver
hugomrdias Dec 11, 2019
790219a
fix: fix circuit relay example
hugomrdias Dec 12, 2019
5ac61ed
fix: linter
hugomrdias Dec 12, 2019
b6aae4d
fix: more examples
hugomrdias Dec 12, 2019
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
37 changes: 19 additions & 18 deletions .aegir.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,26 +27,27 @@ module.exports = {
},
hooks: {
node: {
pre: () => Promise.all([
preloadNode.start(),
echoServer.start()
]),
post: () => Promise.all([
preloadNode.stop(),
echoServer.stop()
])
pre: async () => {
await preloadNode.start(),
await echoServer.start()
},
post: async () => {
await preloadNode.stop(),
await echoServer.stop()

}
},
browser: {
pre: () => Promise.all([
ipfsdServer.start(),
preloadNode.start(),
echoServer.start()
]),
post: () => Promise.all([
ipfsdServer.stop(),
preloadNode.stop(),
echoServer.stop()
])
pre: async () => {
await ipfsdServer.start()
await preloadNode.start()
await echoServer.start()
},
post: async () => {
await ipfsdServer.stop()
await preloadNode.stop()
await echoServer.stop()
}
}
}
}
4 changes: 2 additions & 2 deletions examples/circuit-relaying/src/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ document.addEventListener('DOMContentLoaded', async () => {
const $room = document.querySelector('#room')
const $roomId = document.querySelector('#room-id')

let roomName = `default`
let roomName = 'default'
const fragment = window.location.hash.substr(1)
if (fragment) {
roomName = fragment
Expand Down Expand Up @@ -68,7 +68,7 @@ document.addEventListener('DOMContentLoaded', async () => {
$roomId.addEventListener('keyup', (event) => {
const kp = event.keyCode || event.which
if (kp === 13 && $roomId.value.length > 0) {
let name = $roomId.value
const name = $roomId.value
$room.innerText = name

$room.setAttribute('style', 'display: inline')
Expand Down
35 changes: 21 additions & 14 deletions examples/circuit-relaying/test.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,16 @@ const os = require('os')
const path = require('path')
const execa = require('execa')
const delay = require('delay')
const DaemonFactory = require('ipfsd-ctl')
const df = DaemonFactory.create({
type: 'js',
exec: path.resolve(`${__dirname}/../../src/cli/bin.js`),
IpfsClient: require('ipfs-http-client')
const { createFactory } = require('ipfsd-ctl')
const df = createFactory({
ipfsModule: {
path: require.resolve('../../src'),
ref: require('../../src')
},
ipfsHttpModule: {
path: require.resolve('ipfs-http-client'),
ref: require('ipfs-http-client')
}
})
const {
startServer
Expand Down Expand Up @@ -38,19 +43,21 @@ async function testUI (url, relay, localPeerIdFile, remotePeerIdFile) {

async function runTest () {
const ipfsd = await df.spawn({
initOptions: { bits: 512 },
config: {
Addresses: {
Swarm: [
'/ip4/127.0.0.1/tcp/0/ws'
]
},
Bootstrap: [],
type: 'proc',
test: true,
ipfsOptions: {
relay: {
enabled: true,
hop: {
enabled: true
}
},
config: {
Addresses: {
Swarm: [
'/ip4/127.0.0.1/tcp/0/ws'
]
}
}
}
})
Expand Down Expand Up @@ -116,7 +123,7 @@ module.exports[pkg.name] = function (browser) {

break
} catch (err) {

// ignore
}

await delay(1000)
Expand Down
38 changes: 24 additions & 14 deletions examples/exchange-files-in-browser/test.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,22 @@ const path = require('path')
const os = require('os')
const execa = require('execa')
const delay = require('delay')
const DaemonFactory = require('ipfsd-ctl')
const df = DaemonFactory.create({
type: 'js',
exec: path.resolve(`${__dirname}/../../src/cli/bin.js`),
IpfsClient: require('ipfs-http-client')
})
const { createFactory } = require('ipfsd-ctl')
const df = createFactory({
ipfsModule: {
path: require.resolve('../../src'),
ref: require('../../src')
},
ipfsHttpModule: {
path: require.resolve('ipfs-http-client'),
ref: require('ipfs-http-client')
}
}, {
js: {
ipfsBin: path.resolve(`${__dirname}/../../src/cli/bin.js`)
}
}
)
const {
startServer
} = require('../utils')
Expand All @@ -35,14 +45,14 @@ async function testUI (env) {

async function runTest () {
const ipfsd = await df.spawn({
initOptions: { bits: 512 },
config: {
Addresses: {
Swarm: [
'/ip4/127.0.0.1/tcp/0/ws'
]
},
Bootstrap: []
ipfsOptions: {
config: {
Addresses: {
Swarm: [
'/ip4/127.0.0.1/tcp/0/ws'
]
}
}
}
})

Expand Down
28 changes: 16 additions & 12 deletions examples/explore-ethereum-blockchain/test.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,22 +2,26 @@

const fs = require('fs-extra')
const path = require('path')
const DaemonFactory = require('ipfsd-ctl')
const df = DaemonFactory.create({
type: 'proc',
exec: require('../../')
const { createFactory } = require('ipfsd-ctl')
const df = createFactory({
ipfsModule: {
path: require.resolve('../../src'),
ref: require('../../src')
},
ipfsHttpModule: {
path: require.resolve('ipfs-http-client'),
ref: require('ipfs-http-client')
}
}, {
js: {
ipfsBin: path.resolve(`${__dirname}/../../src/cli/bin.js`)
}
})

async function runTest () {
const ipfsd = await df.spawn({
initOptions: { bits: 512 },
config: {
Addresses: {
Swarm: []
},
Bootstrap: []
},
disposable: true
type: 'proc',
test: true
})

const cids = []
Expand Down
2 changes: 1 addition & 1 deletion examples/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
},
"license": "MIT",
"dependencies": {
"chromedriver": "^77.0.0",
"chromedriver": "^79.0.0",
"delay": "^4.1.0",
"execa": "^3.2.0",
"fs-extra": "^8.1.0",
Expand Down
5 changes: 3 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -204,13 +204,14 @@
"execa": "^3.0.0",
"form-data": "^3.0.0",
"hat": "0.0.3",
"interface-ipfs-core": "^0.124.1",
"interface-ipfs-core": "^0.125.0",
"ipfs-interop": "^0.1.1",
"ipfsd-ctl": "^0.47.2",
"ipfsd-ctl": "^1.0.2",
"libp2p-websocket-star": "~0.10.2",
"lodash": "^4.17.15",
"ncp": "^2.0.0",
"p-event": "^4.1.0",
"p-map": "^3.0.0",
"qs": "^6.5.2",
"rimraf": "^3.0.0",
"sinon": "^7.4.2",
Expand Down
2 changes: 1 addition & 1 deletion src/http/api/resources/key.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ exports.rename = async (request, h) => {
const key = await ipfs.key.rename(oldName, newName)
return h.response({
Was: key.was,
Now: key.name,
Now: key.now,
Id: key.id,
Overwrite: key.overwrite
})
Expand Down
31 changes: 5 additions & 26 deletions test/cli/dht.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,33 +3,12 @@
'use strict'

const { expect } = require('interface-ipfs-core/src/utils/mocha')
const path = require('path')
const DaemonFactory = require('ipfsd-ctl')
const df = DaemonFactory.create({
type: 'js',
IpfsClient: require('ipfs-http-client')
})

const factory = require('../utils/factory')
const ipfsExec = require('../utils/ipfs-exec')

const daemonOpts = {
exec: path.resolve(`${__dirname}/../../src/cli/bin.js`),
config: {
Bootstrap: [],
Discovery: {
MDNS: {
Enabled: false
},
webRTCStar: {
Enabled: false
}
}
},
initOptions: { bits: 512 }
}

// TODO: unskip when DHT is enabled: https://github.com/ipfs/js-ipfs/pull/1994
describe.skip('dht', () => {
const df = factory({ type: 'js' })
const nodes = []
let ipfsA
let ipfsB
Expand All @@ -41,11 +20,11 @@ describe.skip('dht', () => {
before(async function () {
this.timeout(80 * 1000)

const ipfsdA = await df.spawn(daemonOpts)
const ipfsdA = await df.spawn()
ipfsA = ipfsExec(ipfsdA.repoPath)
nodes.push(ipfsdA)

const ipfsdB = await df.spawn(daemonOpts)
const ipfsdB = await df.spawn()
ipfsB = ipfsExec(ipfsdB.repoPath)
nodes.push(ipfsdB)
})
Expand All @@ -71,7 +50,7 @@ describe.skip('dht', () => {
return nodes[0].api.swarm.connect(multiaddrB)
})

after(() => Promise.all(nodes.map((node) => node.stop())))
after(() => df.clean())

it('should be able to put a value to the dht and get it afterwards', async function () {
this.timeout(60 * 1000)
Expand Down
Loading