Skip to content

Commit f91f2b6

Browse files
victorbdaviddias
authored andcommitted
chore: Updating CI files (#70)
* Updating CI files This commit updates all CI scripts to the latest version * Faster tests
1 parent 8f69354 commit f91f2b6

File tree

5 files changed

+69
-21
lines changed

5 files changed

+69
-21
lines changed

.travis.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
# Warning: This file is automatically synced from https://github.com/ipfs/ci-sync so if you want to change it, please change it there and ask someone to sync all repositories.
12
sudo: false
23
language: node_js
34

@@ -13,7 +14,7 @@ matrix:
1314
script:
1415
- npm run lint
1516
- npm run test
16-
- npm run coverage -- --upload
17+
- npm run coverage
1718

1819
before_script:
1920
- export DISPLAY=:99.0

appveyor.yml

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
# Warning: This file is automatically synced from https://github.com/ipfs/ci-sync so if you want to change it, please change it there and ask someone to sync all repositories.
2+
version: "{build}"
3+
4+
environment:
5+
matrix:
6+
- nodejs_version: "6"
7+
- nodejs_version: "8"
8+
9+
matrix:
10+
fast_finish: true
11+
12+
install:
13+
# Install Node.js
14+
- ps: Install-Product node $env:nodejs_version
15+
16+
# Upgrade npm
17+
- npm install -g npm
18+
19+
# Output our current versions for debugging
20+
- node --version
21+
- npm --version
22+
23+
# Install our package dependencies
24+
- npm install
25+
26+
test_script:
27+
- npm run test:node
28+
29+
build: off

ci/Jenkinsfile

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
// Warning: This file is automatically synced from https://github.com/ipfs/ci-sync so if you want to change it, please change it there and ask someone to sync all repositories.
2+
javascript()

circle.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
# Warning: This file is automatically synced from https://github.com/ipfs/ci-sync so if you want to change it, please change it there and ask someone to sync all repositories.
12
machine:
23
node:
34
version: stable

test/peer-id.spec.js

Lines changed: 35 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -19,21 +19,27 @@ const testIdB58String = mh.toB58String(testIdBytes)
1919

2020
const goId = require('./fixtures/go-private-key')
2121

22+
// Test options for making PeerId.create faster
23+
// INSECURE, only use when testing
24+
const testOpts = {
25+
bits: 512
26+
}
27+
2228
describe('PeerId', () => {
2329
it('create an id without \'new\'', () => {
2430
expect(PeerId).to.throw(Error)
2531
})
2632

2733
it('create a new id', (done) => {
28-
PeerId.create((err, id) => {
34+
PeerId.create(testOpts, (err, id) => {
2935
expect(err).to.not.exist()
3036
expect(id.toB58String().length).to.equal(46)
3137
done()
3238
})
3339
})
3440

3541
it('isPeerId', (done) => {
36-
PeerId.create((err, id) => {
42+
PeerId.create(testOpts, (err, id) => {
3743
expect(err).to.not.exist()
3844
expect(PeerId.isPeerId(id)).to.equal(true)
3945
expect(PeerId.isPeerId('aaa')).to.equal(false)
@@ -42,8 +48,9 @@ describe('PeerId', () => {
4248
})
4349
})
4450

45-
it('throws on changing the id', (done) => {
46-
PeerId.create((err, id) => {
51+
it('throws on changing the id', function (done) {
52+
this.timeout(10000)
53+
PeerId.create(testOpts, (err, id) => {
4754
expect(err).to.not.exist()
4855
expect(id.toB58String().length).to.equal(46)
4956
expect(() => {
@@ -92,7 +99,7 @@ describe('PeerId', () => {
9299
})
93100

94101
it('Compare generated ID with one created from PubKey', (done) => {
95-
PeerId.create((err, id1) => {
102+
PeerId.create(testOpts, (err, id1) => {
96103
expect(err).to.not.exist()
97104

98105
PeerId.createFromPubKey(id1.marshalPubKey(), (err, id2) => {
@@ -103,12 +110,20 @@ describe('PeerId', () => {
103110
})
104111
})
105112

113+
it('Works with default options', function (done) {
114+
this.timeout(10000)
115+
PeerId.create((err, id) => {
116+
expect(err).to.not.exist()
117+
expect(id.toB58String().length).to.equal(46)
118+
done()
119+
})
120+
})
121+
106122
it('Non-default # of bits', function (done) {
107-
// rsa is slow atm
108-
this.timeout(100000)
109-
PeerId.create({ bits: 1024 }, (err, shortId) => {
123+
this.timeout(1000 * 60)
124+
PeerId.create(testOpts, (err, shortId) => {
110125
expect(err).to.not.exist()
111-
PeerId.create({ bits: 4096 }, (err, longId) => {
126+
PeerId.create({ bits: 1024 }, (err, longId) => {
112127
expect(err).to.not.exist()
113128
expect(shortId.privKey.bytes.length).is.below(longId.privKey.bytes.length)
114129
done()
@@ -117,7 +132,7 @@ describe('PeerId', () => {
117132
})
118133

119134
it('Pretty printing', (done) => {
120-
PeerId.create((err, id1) => {
135+
PeerId.create(testOpts, (err, id1) => {
121136
expect(err).to.not.exist()
122137
PeerId.createFromPrivKey(id1.toPrint().privKey, (err, id2) => {
123138
expect(err).to.not.exist()
@@ -134,8 +149,8 @@ describe('PeerId', () => {
134149

135150
it('isEqual', (done) => {
136151
parallel([
137-
(cb) => PeerId.create(cb),
138-
(cb) => PeerId.create(cb)
152+
(cb) => PeerId.create(testOpts, cb),
153+
(cb) => PeerId.create(testOpts, cb)
139154
], (err, ids) => {
140155
expect(err).to.not.exist()
141156
expect(ids[0].isEqual(ids[0])).to.equal(true)
@@ -148,7 +163,7 @@ describe('PeerId', () => {
148163

149164
describe('fromJSON', () => {
150165
it('full node', (done) => {
151-
PeerId.create({ bits: 1024 }, (err, id) => {
166+
PeerId.create(testOpts, (err, id) => {
152167
expect(err).to.not.exist()
153168

154169
PeerId.createFromJSON(id.toJSON(), (err, other) => {
@@ -193,23 +208,23 @@ describe('PeerId', () => {
193208
})
194209

195210
it('set privKey (valid)', (done) => {
196-
PeerId.create((err, peerId) => {
211+
PeerId.create(testOpts, (err, peerId) => {
197212
expect(err).to.not.exist()
198213
peerId.privKey = peerId._privKey
199214
peerId.isValid(done)
200215
})
201216
})
202217

203218
it('set pubKey (valid)', (done) => {
204-
PeerId.create((err, peerId) => {
219+
PeerId.create(testOpts, (err, peerId) => {
205220
expect(err).to.not.exist()
206221
peerId.pubKey = peerId._pubKey
207222
peerId.isValid(done)
208223
})
209224
})
210225

211226
it('set privKey (invalid)', (done) => {
212-
PeerId.create((err, peerId) => {
227+
PeerId.create(testOpts, (err, peerId) => {
213228
expect(err).to.not.exist()
214229
peerId.privKey = Buffer.from('bufff')
215230
peerId.isValid((err) => {
@@ -220,7 +235,7 @@ describe('PeerId', () => {
220235
})
221236

222237
it('set pubKey (invalid)', (done) => {
223-
PeerId.create((err, peerId) => {
238+
PeerId.create(testOpts, (err, peerId) => {
224239
expect(err).to.not.exist()
225240
peerId.pubKey = Buffer.from('buffff')
226241
peerId.isValid((err) => {
@@ -237,9 +252,9 @@ describe('PeerId', () => {
237252

238253
before((done) => {
239254
parallel([
240-
(cb) => crypto.keys.generateKeyPair('RSA', 1024, cb),
241-
(cb) => crypto.keys.generateKeyPair('RSA', 1024, cb),
242-
(cb) => crypto.keys.generateKeyPair('RSA', 1024, cb)
255+
(cb) => crypto.keys.generateKeyPair('RSA', 512, cb),
256+
(cb) => crypto.keys.generateKeyPair('RSA', 512, cb),
257+
(cb) => crypto.keys.generateKeyPair('RSA', 512, cb)
243258
], (err, keys) => {
244259
expect(err).to.not.exist()
245260

0 commit comments

Comments
 (0)