Skip to content

Commit

Permalink
refactor: use new ipfsd-ctl setup (ipfs#1127)
Browse files Browse the repository at this point in the history
* fix: use new ipfsd-ctl setup

* chore: add correct branches

* fix: support new ctl

* fix: update to the latest ctl api

* fix: use proper module

* fix: override properly

* chore: bump ipfsd-ctl, interface-core
  • Loading branch information
hugomrdias authored and Alan Shaw committed Dec 11, 2019
1 parent 70c78d1 commit 23421f3
Show file tree
Hide file tree
Showing 15 changed files with 106 additions and 338 deletions.
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -84,8 +84,8 @@
"cross-env": "^6.0.0",
"detect-node": "^2.0.4",
"go-ipfs-dep": "^0.4.22",
"interface-ipfs-core": "^0.124.0",
"ipfsd-ctl": "^0.47.1",
"interface-ipfs-core": "~0.125.0",
"ipfsd-ctl": "^1.0.0",
"ndjson": "^1.5.0",
"nock": "^11.4.0",
"pull-stream": "^3.6.14",
Expand Down
16 changes: 2 additions & 14 deletions test/commands.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,30 +2,18 @@
'use strict'

const { expect } = require('interface-ipfs-core/src/utils/mocha')
const ipfsClient = require('../src')
const f = require('./utils/factory')

describe('.commands', function () {
this.timeout(60 * 1000)

let ipfsd
let ipfs

before(async () => {
ipfsd = await f.spawn({
initOptions: {
bits: 1024,
profile: 'test'
}
})
ipfs = ipfsClient(ipfsd.apiAddr)
ipfs = (await f.spawn()).api
})

after(async () => {
if (ipfsd) {
await ipfsd.stop()
}
})
after(() => f.clean())

it('lists commands', async () => {
const res = await ipfs.commands()
Expand Down
12 changes: 3 additions & 9 deletions test/constructor.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -93,24 +93,18 @@ describe('ipfs-http-client constructor tests', () => {
})

describe('integration', () => {
let apiAddr
let ipfsd

before(async function () {
this.timeout(60 * 1000) // slow CI

ipfsd = await f.spawn({ initOptions: { bits: 1024, profile: 'test' } })
apiAddr = ipfsd.apiAddr.toString()
ipfsd = await f.spawn()
})

after(async () => {
if (ipfsd) {
await ipfsd.stop()
}
})
after(() => f.clean())

it('can connect to an ipfs http api', async () => {
await clientWorks(ipfsClient(apiAddr))
await clientWorks(ipfsClient(ipfsd.apiAddr))
})
})
})
Expand Down
16 changes: 2 additions & 14 deletions test/dag.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,29 +6,17 @@
const { expect } = require('interface-ipfs-core/src/utils/mocha')
const { DAGNode } = require('ipld-dag-pb')
const CID = require('cids')
const ipfsClient = require('../src')
const f = require('./utils/factory')

let ipfsd
let ipfs

describe('.dag', function () {
this.timeout(20 * 1000)
before(async function () {
ipfsd = await f.spawn({
initOptions: {
bits: 1024,
profile: 'test'
}
})
ipfs = ipfsClient(ipfsd.apiAddr)
ipfs = (await f.spawn()).api
})

after(async () => {
if (ipfsd) {
await ipfsd.stop()
}
})
after(() => f.clean())

it('should be able to put and get a DAG node with format dag-pb', async () => {
const data = Buffer.from('some data')
Expand Down
16 changes: 2 additions & 14 deletions test/diag.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@

const { expect } = require('interface-ipfs-core/src/utils/mocha')
const platform = require('browser-process-platform')
const ipfsClient = require('../src')
const f = require('./utils/factory')

describe('.diag', function () {
Expand All @@ -12,24 +11,13 @@ describe('.diag', function () {
// go-ipfs does not support these on Windows
if (platform === 'win32') { return }

let ipfsd
let ipfs

before(async () => {
ipfsd = await f.spawn({
initOptions: {
bits: 1024,
profile: 'test'
}
})
ipfs = ipfsClient(ipfsd.apiAddr)
ipfs = (await f.spawn()).api
})

after(async () => {
if (ipfsd) {
await ipfsd.stop()
}
})
after(() => f.clean())

describe('api API', () => {
// Disabled in go-ipfs 0.4.10
Expand Down
16 changes: 2 additions & 14 deletions test/files-mfs.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ const values = require('pull-stream/sources/values')
const pull = require('pull-stream/pull')
const collect = require('pull-stream/sinks/collect')

const ipfsClient = require('../src')
const f = require('./utils/factory')
const expectTimeout = require('./utils/expect-timeout')

Expand All @@ -31,26 +30,15 @@ const HASH_ALGS = [
describe('.files (the MFS API part)', function () {
this.timeout(20 * 1000)

let ipfsd
let ipfs

const expectedMultihash = 'Qma4hjFTnCasJ8PVp3mZbZK5g2vGDT4LByLJ7m8ciyRFZP'

before(async () => {
ipfsd = await f.spawn({
initOptions: {
bits: 1024,
profile: 'test'
}
})
ipfs = ipfsClient(ipfsd.apiAddr)
ipfs = (await f.spawn()).api
})

after(async () => {
if (ipfsd) {
await ipfsd.stop()
}
})
after(() => f.clean())

it('.add file for testing', async () => {
const res = await ipfs.add(testfile)
Expand Down
17 changes: 2 additions & 15 deletions test/get.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
const { expect } = require('interface-ipfs-core/src/utils/mocha')
const loadFixture = require('aegir/fixtures')

const ipfsClient = require('../src')
const f = require('./utils/factory')

describe('.get (specific go-ipfs features)', function () {
Expand All @@ -21,26 +20,14 @@ describe('.get (specific go-ipfs features)', function () {
data: fixture('test/fixtures/testfile.txt')
}

let ipfsd
let ipfs

before(async () => {
ipfsd = await f.spawn({
initOptions: {
bits: 1024,
profile: 'test'
}
})
ipfs = ipfsClient(ipfsd.apiAddr)

ipfs = (await f.spawn()).api
await ipfs.add(smallFile.data)
})

after(async () => {
if (ipfsd) {
await ipfsd.stop()
}
})
after(() => f.clean())

it('no compression args', async () => {
const files = await ipfs.get(smallFile.cid)
Expand Down
Loading

0 comments on commit 23421f3

Please sign in to comment.