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

Commit

Permalink
fix: make ci happy again
Browse files Browse the repository at this point in the history
  • Loading branch information
vasco-santos committed Feb 7, 2019
1 parent 2651787 commit 0c73e99
Show file tree
Hide file tree
Showing 6 changed files with 50 additions and 39 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@
"joi": "^14.3.0",
"joi-browser": "^13.4.0",
"joi-multiaddr": "^4.0.0",
"libp2p": "libp2p/js-libp2p#master",
"libp2p": "~0.25.0-rc.0",
"libp2p-bootstrap": "~0.9.3",
"libp2p-crypto": "~0.16.0",
"libp2p-kad-dht": "~0.14.4",
Expand Down
4 changes: 0 additions & 4 deletions test/core/interface.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -184,10 +184,6 @@ describe('interface-ipfs-core tests', function () {
config = null
}

config = config || {
Bootstrap: []
}

const spawnOptions = { repoPath, config, initOptions: { bits: 512 } }

ipfsFactory.spawn(spawnOptions, (err, _ipfsd) => {
Expand Down
49 changes: 25 additions & 24 deletions test/core/preload.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,15 +19,16 @@ describe('preload', () => {
let repo

before(function (done) {
this.timeout(20 * 1000)
this.timeout(50 * 1000)

repo = createTempRepo()
ipfs = new IPFS({
repo,
config: {
Addresses: {
Swarm: []
}
},
Bootstrap: []
},
preload: {
enabled: true,
Expand All @@ -44,25 +45,25 @@ describe('preload', () => {
})

after(function (done) {
this.timeout(20 * 1000)
this.timeout(50 * 1000)
ipfs.stop(done)
})

after(function (done) {
this.timeout(20 * 1000)
this.timeout(50 * 1000)
repo.teardown(done)
})

it('should preload content added with add', function (done) {
this.timeout(20 * 1000)
this.timeout(50 * 1000)
ipfs.add(Buffer.from(hat()), (err, res) => {
expect(err).to.not.exist()
MockPreloadNode.waitForCids(res[0].hash, done)
})
})

it('should preload multiple content added with add', function (done) {
this.timeout(20 * 1000)
this.timeout(50 * 1000)
ipfs.add([{
content: Buffer.from(hat())
}, {
Expand All @@ -76,7 +77,7 @@ describe('preload', () => {
})

it('should preload multiple content and intermediate dirs added with add', function (done) {
this.timeout(20 * 1000)
this.timeout(50 * 1000)
ipfs.add([{
path: 'dir0/dir1/file0',
content: Buffer.from(hat())
Expand All @@ -97,7 +98,7 @@ describe('preload', () => {
})

it('should preload multiple content and wrapping dir for content added with add and wrapWithDirectory option', function (done) {
this.timeout(20 * 1000)
this.timeout(50 * 1000)
ipfs.add([{
path: 'dir0/dir1/file0',
content: Buffer.from(hat())
Expand All @@ -118,7 +119,7 @@ describe('preload', () => {
})

it('should preload content retrieved with cat', function (done) {
this.timeout(20 * 1000)
this.timeout(50 * 1000)
ipfs.add(Buffer.from(hat()), { preload: false }, (err, res) => {
expect(err).to.not.exist()
ipfs.cat(res[0].hash, (err) => {
Expand All @@ -129,7 +130,7 @@ describe('preload', () => {
})

it('should preload content retrieved with get', function (done) {
this.timeout(20 * 1000)
this.timeout(50 * 1000)
ipfs.add(Buffer.from(hat()), { preload: false }, (err, res) => {
expect(err).to.not.exist()
ipfs.get(res[0].hash, (err) => {
Expand All @@ -140,7 +141,7 @@ describe('preload', () => {
})

it('should preload content retrieved with ls', function (done) {
this.timeout(20 * 1000)
this.timeout(50 * 1000)
ipfs.add([{
path: 'dir0/dir1/file0',
content: Buffer.from(hat())
Expand Down Expand Up @@ -169,23 +170,23 @@ describe('preload', () => {
})

it('should preload content added with object.new', function (done) {
this.timeout(20 * 1000)
this.timeout(50 * 1000)
ipfs.object.new((err, cid) => {
expect(err).to.not.exist()
MockPreloadNode.waitForCids(cid.toBaseEncodedString(), done)
})
})

it('should preload content added with object.put', function (done) {
this.timeout(20 * 1000)
this.timeout(50 * 1000)
ipfs.object.put({ Data: Buffer.from(hat()), Links: [] }, (err, cid) => {
expect(err).to.not.exist()
MockPreloadNode.waitForCids(cid.toBaseEncodedString(), done)
})
})

it('should preload content added with object.patch.addLink', function (done) {
this.timeout(20 * 1000)
this.timeout(50 * 1000)
parallel({
parent: (cb) => {
waterfall([
Expand Down Expand Up @@ -214,7 +215,7 @@ describe('preload', () => {
})

it('should preload content added with object.patch.rmLink', function (done) {
this.timeout(20 * 1000)
this.timeout(50 * 1000)
waterfall([
(cb) => ipfs.object.put({ Data: Buffer.from(hat()), Links: [] }, cb),
(cid, cb) => ipfs.object.get(cid, (err, node) => cb(err, { node, cid })),
Expand All @@ -239,7 +240,7 @@ describe('preload', () => {
})

it('should preload content added with object.patch.setData', function (done) {
this.timeout(20 * 1000)
this.timeout(50 * 1000)
ipfs.object.put({ Data: Buffer.from(hat()), Links: [] }, (err, cid) => {
expect(err).to.not.exist()

Expand All @@ -251,7 +252,7 @@ describe('preload', () => {
})

it('should preload content added with object.patch.appendData', function (done) {
this.timeout(20 * 1000)
this.timeout(50 * 1000)
ipfs.object.put({ Data: Buffer.from(hat()), Links: [] }, (err, cid) => {
expect(err).to.not.exist()

Expand All @@ -263,7 +264,7 @@ describe('preload', () => {
})

it('should preload content retrieved with object.get', function (done) {
this.timeout(20 * 1000)
this.timeout(50 * 1000)
ipfs.object.new(null, { preload: false }, (err, cid) => {
expect(err).to.not.exist()

Expand All @@ -275,15 +276,15 @@ describe('preload', () => {
})

it('should preload content added with block.put', function (done) {
this.timeout(20 * 1000)
this.timeout(50 * 1000)
ipfs.block.put(Buffer.from(hat()), (err, block) => {
expect(err).to.not.exist()
MockPreloadNode.waitForCids(block.cid.toBaseEncodedString(), done)
})
})

it('should preload content retrieved with block.get', function (done) {
this.timeout(20 * 1000)
this.timeout(50 * 1000)
ipfs.block.put(Buffer.from(hat()), { preload: false }, (err, block) => {
expect(err).to.not.exist()
ipfs.block.get(block.cid, (err) => {
Expand All @@ -294,7 +295,7 @@ describe('preload', () => {
})

it('should preload content retrieved with block.stat', function (done) {
this.timeout(20 * 1000)
this.timeout(50 * 1000)
ipfs.block.put(Buffer.from(hat()), { preload: false }, (err, block) => {
expect(err).to.not.exist()
ipfs.block.stat(block.cid, (err) => {
Expand All @@ -305,7 +306,7 @@ describe('preload', () => {
})

it('should preload content added with dag.put', function (done) {
this.timeout(20 * 1000)
this.timeout(50 * 1000)
const obj = { test: hat() }
ipfs.dag.put(obj, { format: 'dag-cbor', hashAlg: 'sha2-256' }, (err, cid) => {
expect(err).to.not.exist()
Expand All @@ -314,7 +315,7 @@ describe('preload', () => {
})

it('should preload content retrieved with dag.get', function (done) {
this.timeout(20 * 1000)
this.timeout(50 * 1000)
const obj = { test: hat() }
const opts = { format: 'dag-cbor', hashAlg: 'sha2-256', preload: false }
ipfs.dag.put(obj, opts, (err, cid) => {
Expand All @@ -328,7 +329,7 @@ describe('preload', () => {
})

describe('preload disabled', function () {
this.timeout(20 * 1000)
this.timeout(50 * 1000)
let ipfs
let repo

Expand Down
4 changes: 0 additions & 4 deletions test/http-api/interface.js
Original file line number Diff line number Diff line change
Expand Up @@ -113,10 +113,6 @@ describe('interface-ipfs-core over ipfs-http-client tests', () => {
config = undefined
}

config = config || {
Bootstrap: []
}

const spawnOptions = { repoPath, config, initOptions: { bits: 512 } }

ipfsFactory.spawn(spawnOptions, (err, _ipfsd) => {
Expand Down
15 changes: 10 additions & 5 deletions test/http-api/routes.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ describe('HTTP API', () => {
const repoTests = path.join(__dirname, '../repo-tests-run')

// bootstrap nodes get the set up too slow and gets timed out
const testsForCustomConfig = ['dht.js', 'name.js', 'ping.js']
const testsForCustomConfig = ['dht.js', 'files.js', 'name.js', 'pin.js', 'ping.js']

let http = {}

Expand Down Expand Up @@ -49,15 +49,18 @@ describe('HTTP API', () => {

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

await startHttpAPI(config)
})

after(async () => {
after(async function () {
this.timeout(50 * 1000)

await http.api.stop()
clean(repoTests)
})

describe('## http-api spec tests', () => {
describe('## http-api spec tests for custom config', () => {
fs.readdirSync(path.join(`${__dirname}/inject/`))
.forEach((file) => testsForCustomConfig.includes(file) && require(`./inject/${file}`)(http))
})
Expand All @@ -73,12 +76,14 @@ describe('HTTP API', () => {
await startHttpAPI(config)
})

after(async () => {
after(async function () {
this.timeout(50 * 1000)

await http.api.stop()
clean(repoTests)
})

describe('## http-api spec tests', () => {
describe('## http-api spec tests for default config', () => {
fs.readdirSync(path.join(`${__dirname}/inject/`))
.forEach((file) => !testsForCustomConfig.includes(file) && require(`./inject/${file}`)(http))
})
Expand Down
15 changes: 14 additions & 1 deletion test/utils/interface-common-factory.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,20 @@ function createFactory (options) {
options = options || {}

options.factoryOptions = options.factoryOptions || { type: 'proc', exec: IPFS }
options.spawnOptions = options.spawnOptions || { initOptions: { bits: 512 }, config: { Bootstrap: [] } }
options.spawnOptions = options.spawnOptions || {
initOptions: { bits: 512 },
config: {
Bootstrap: [],
Discovery: {
MDNS: {
Enabled: false
},
webRTCStar: {
Enabled: false
}
}
}
}

if (options.factoryOptions.type !== 'proc') {
options.factoryOptions.IpfsClient = options.factoryOptions.IpfsClient || ipfsClient
Expand Down

0 comments on commit 0c73e99

Please sign in to comment.