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

Commit

Permalink
tests are starting
Browse files Browse the repository at this point in the history
  • Loading branch information
dignifiedquire committed Sep 26, 2016
1 parent 213e1db commit 2d0c802
Show file tree
Hide file tree
Showing 10 changed files with 22 additions and 26 deletions.
8 changes: 1 addition & 7 deletions .aegir.js
Original file line number Diff line number Diff line change
@@ -1,16 +1,10 @@
'use strict'

const path = require('path')

module.exports = {
webpack: {
resolve: {
alias: {
'libp2p-ipfs': 'libp2p-ipfs-browser',
'node-forge': path.resolve(
path.dirname(require.resolve('libp2p-crypto')),
'../vendor/forge.bundle.js'
)
'libp2p-ipfs': 'libp2p-ipfs-browser'
}
},
externals: {
Expand Down
2 changes: 1 addition & 1 deletion gulpfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ let nodes = []
function startNode (num, done) {
createTempNode(num, (err, node) => {
if (err) {
throw err
return done(err)
}

const api = new API(node.repo.path())
Expand Down
7 changes: 5 additions & 2 deletions src/core/components/load.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,11 @@ module.exports = function load (self) {
(cb) => utils.ifRepoExists(self._repo, cb),
(cb) => self._repo.config.get(cb),
(config, cb) => {
const id = peerId.createFromPrivKey(config.Identity.PrivKey)

peerId.createFromPrivKey(config.Identity.PrivKey, (err, id) => {
cb(err, config, id)
})
},
(config, id, cb) => {
self._peerInfo = new PeerInfo(id)
config.Addresses.Swarm.forEach((addr) => {
self._peerInfo.multiaddr.add(multiaddr(addr))
Expand Down
4 changes: 2 additions & 2 deletions test/cli/test-init.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,15 +35,15 @@ describe('init', function () {
})

it('bits', (done) => {
nexpect.spawn('node', [process.cwd() + '/src/cli/bin.js', 'init', '--bits', '512'], {env})
nexpect.spawn('node', [process.cwd() + '/src/cli/bin.js', 'init', '--bits', '1024'], {env})
.run((err, stdout, exitcode) => {
expect(err).to.not.exist
done()
})
})

it('empty', (done) => {
nexpect.spawn('node', [process.cwd() + '/src/cli/bin.js', 'init', '--bits', '512', '--empty-repo', 'true'], {env})
nexpect.spawn('node', [process.cwd() + '/src/cli/bin.js', 'init', '--bits', '1024', '--empty-repo', 'true'], {env})
.run((err, stdout, exitcode) => {
expect(err).to.not.exist
expect(repoExistsSync('blocks')).to.equal(false)
Expand Down
4 changes: 2 additions & 2 deletions test/core/both/test-init.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ describe('init', function () {
const repo = createTempRepo()
const ipfs = new IPFS(repo)

ipfs.init({ emptyRepo: true, bits: 512 }, (err) => {
ipfs.init({ emptyRepo: true, bits: 1024 }, (err) => {
expect(err).to.not.exist

repo.exists((err, res) => {
Expand All @@ -35,7 +35,7 @@ describe('init', function () {
const repo2 = createTempRepo()
const ipfsShort = new IPFS(repo1)
const ipfsLong = new IPFS(repo2)
ipfsShort.init({ bits: 512, emptyRepo: true }, (err) => {
ipfsShort.init({ bits: 1024, emptyRepo: true }, (err) => {
expect(err).to.not.exist

ipfsLong.init({ bits: 1024, emptyRepo: true }, (err) => {
Expand Down
4 changes: 2 additions & 2 deletions test/core/node-only/test-init.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ describe('init (Node.js specific)', function () {
})

it('init docs are written', (done) => {
ipfs.init({ bits: 512 }, (err) => {
ipfs.init({ bits: 1024 }, (err) => {
expect(err).to.not.exist
var multihash = new Buffer('12205e7c3ce237f936c76faf625e90f7751a9f5eeb048f59873303c215e9cce87599', 'hex')
setTimeout(() => {
Expand All @@ -37,7 +37,7 @@ describe('init (Node.js specific)', function () {
})

it('empty repo', (done) => {
ipfs.init({ bits: 512, emptyRepo: true }, (err) => {
ipfs.init({ bits: 1024, emptyRepo: true }, (err) => {
expect(err).to.not.exist

// Check for default assets
Expand Down
4 changes: 2 additions & 2 deletions test/utils/factory-core/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ function Factory () {

// create the IPFS node
const ipfs = new IPFS(repo)
ipfs.init({ emptyRepo: true, bits: 512 }, (err) => {
ipfs.init({ emptyRepo: true, bits: 1024 }, (err) => {
if (err) {
return callback(err)
}
Expand Down Expand Up @@ -104,7 +104,7 @@ function Factory () {
}
const conf = JSON.parse(JSON.stringify(defaultConfig))

PeerId.create({ bits: 512 }, (err, id) => {
PeerId.create({ bits: 1024 }, (err, id) => {
if (err) {
return cb(err)
}
Expand Down
4 changes: 2 additions & 2 deletions test/utils/factory-http/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ function Factory () {

// create the IPFS node
const ipfs = new IPFS(repo)
ipfs.init({ emptyRepo: true, bits: 512 }, (err) => {
ipfs.init({ emptyRepo: true, bits: 1024 }, (err) => {
if (err) {
return callback(err)
}
Expand Down Expand Up @@ -84,7 +84,7 @@ function Factory () {
}
const conf = JSON.parse(JSON.stringify(defaultConfig))

PeerId.create({ bits: 512 }, (err, id) => {
PeerId.create({ bits: 1024 }, (err, id) => {
if (err) {
return cb(err)
}
Expand Down
8 changes: 4 additions & 4 deletions test/utils/temp-node.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
/* eslint-env mocha */
'use strict'

const expect = require('chai').expect
const leftPad = require('left-pad')
const series = require('run-series')

Expand All @@ -10,7 +9,9 @@ const createTempRepo = require('./temp-repo')

function setAddresses (repo, num, callback) {
repo.config.get((err, config) => {
expect(err).to.not.exist
if (err) {
return callback(err)
}
config.Addresses = {
Swarm: [
`/ip4/127.0.0.1/tcp/10${num}`,
Expand All @@ -19,7 +20,6 @@ function setAddresses (repo, num, callback) {
API: `/ip4/127.0.0.1/tcp/31${num}`,
Gateway: `/ip4/127.0.0.1/tcp/32${num}`
}

repo.config.set(config, callback)
})
}
Expand All @@ -31,7 +31,7 @@ function createTempNode (num, callback) {
num = leftPad(num, 3, 0)

series([
(cb) => ipfs.init({ emptyRepo: true, bits: 512 }, cb),
(cb) => ipfs.init({ emptyRepo: true, bits: 1024 }, cb),
(cb) => setAddresses(repo, num, cb),
(cb) => ipfs.load(cb)
], (err) => {
Expand Down
3 changes: 1 addition & 2 deletions test/utils/temp-repo.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ const clean = require('./clean')

function createTempRepo () {
const repoPath = '/tmp/ipfs-test-' + Math.random().toString().substring(2, 8)

let store
let teardown

Expand All @@ -31,7 +30,7 @@ function createTempRepo () {
}

var repo = new IPFSRepo(repoPath, {
bits: 512,
bits: 1024,
stores: store
})

Expand Down

0 comments on commit 2d0c802

Please sign in to comment.