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

Commit

Permalink
test: increase name test timeouts (#1756)
Browse files Browse the repository at this point in the history
  • Loading branch information
vasco-santos authored and Alan Shaw committed Dec 7, 2018
1 parent 1a943f8 commit 244eab1
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 20 deletions.
20 changes: 10 additions & 10 deletions test/cli/name.js
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ describe('name', () => {
})

it('should publish correctly when the file was already added', function () {
this.timeout(60 * 1000)
this.timeout(70 * 1000)

return ipfs(`name publish ${cidAdded}`).then((res) => {
expect(res).to.exist()
Expand All @@ -83,7 +83,7 @@ describe('name', () => {
})

it('should publish and resolve an entry with the default options', function () {
this.timeout(60 * 1000)
this.timeout(70 * 1000)

return ipfs(`name publish ${cidAdded}`)
.then((res) => {
Expand All @@ -98,7 +98,7 @@ describe('name', () => {
})

it('should publish correctly when the file was not added but resolve is disabled', function () {
this.timeout(60 * 1000)
this.timeout(70 * 1000)

const notAddedCid = 'QmPFVLPmp9zv5Z5KUqLhe2EivAGccQW2r7M7jhVJGLZoZU'

Expand All @@ -109,7 +109,7 @@ describe('name', () => {
})

it('should not get the entry correctly if its validity time expired', function () {
this.timeout(60 * 1000)
this.timeout(70 * 1000)

return ipfs(`name publish ${cidAdded} --lifetime 10ns`)
.then((res) => {
Expand All @@ -128,7 +128,7 @@ describe('name', () => {
})

it('should publish correctly when a new key is used', function () {
this.timeout(60 * 1000)
this.timeout(70 * 1000)

return ipfs(`name publish ${cidAdded} --key ${name}`).then((res) => {
expect(res).to.exist()
Expand All @@ -137,7 +137,7 @@ describe('name', () => {
})

it('should return the immediate pointing record, unless using the recursive parameter', function () {
this.timeout(60 * 1000)
this.timeout(90 * 1000)

return ipfs(`name publish ${cidAdded}`)
.then((res) => {
Expand All @@ -159,7 +159,7 @@ describe('name', () => {
})

it('should go recursively until finding an ipfs hash', function () {
this.timeout(60 * 1000)
this.timeout(90 * 1000)

return ipfs(`name publish ${cidAdded}`)
.then((res) => {
Expand Down Expand Up @@ -239,7 +239,7 @@ describe('name', () => {
})

it('should publish and resolve an entry with the default options', function () {
this.timeout(60 * 1000)
this.timeout(70 * 1000)

return ipfs(`name publish ${cidAdded}`)
.then((res) => {
Expand All @@ -254,7 +254,7 @@ describe('name', () => {
})

it('should not get the entry correctly if its validity time expired', function () {
this.timeout(60 * 1000)
this.timeout(70 * 1000)

return ipfs(`name publish ${cidAdded} --lifetime 10ns`)
.then((res) => {
Expand All @@ -273,7 +273,7 @@ describe('name', () => {
})

it('should return the immediate pointing record, unless using the recursive parameter', function () {
this.timeout(60 * 1000)
this.timeout(90 * 1000)

return ipfs(`name publish ${cidAdded}`)
.then((res) => {
Expand Down
2 changes: 1 addition & 1 deletion test/core/name-pubsub.js
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ describe('name-pubsub', function () {
after((done) => parallel(nodes.map((node) => (cb) => node.stop(cb)), done))

it('should publish and then resolve correctly', function (done) {
this.timeout(50 * 1000)
this.timeout(80 * 1000)

nodeB.name.resolve(idA.id, (err) => {
expect(err).to.exist()
Expand Down
28 changes: 19 additions & 9 deletions test/core/name.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ describe('name', function () {
let ipfsd

before(function (done) {
this.timeout(40 * 1000)
this.timeout(50 * 1000)
df.spawn({
exec: IPFS,
args: [`--pass ${hat()}`],
Expand All @@ -69,10 +69,14 @@ describe('name', function () {
after((done) => ipfsd.stop(done))

it('should publish and then resolve correctly with the default options', function (done) {
this.timeout(50 * 1000)

publishAndResolve(node, node, ipfsRef, { resolve: false }, nodeId, {}, done)
})

it('should publish correctly with the lifetime option and resolve', function (done) {
this.timeout(50 * 1000)

const publishOpts = {
resolve: false,
lifetime: '2h'
Expand All @@ -82,6 +86,8 @@ describe('name', function () {
})

it('should not get the entry correctly if its validity time expired', function (done) {
this.timeout(50 * 1000)

node.name.publish(ipfsRef, { resolve: false, lifetime: '1ms' }, (err, res) => {
expect(err).to.not.exist()
expect(res).to.exist()
Expand All @@ -96,7 +102,7 @@ describe('name', function () {
})

it('should recursively resolve to an IPFS hash', function (done) {
this.timeout(80 * 1000)
this.timeout(90 * 1000)
const keyName = hat()

node.key.gen(keyName, { type: 'rsa', size: 2048 }, function (err, key) {
Expand All @@ -115,7 +121,7 @@ describe('name', function () {
})

it('should not recursively resolve to an IPFS hash if the option recursive is not provided', function (done) {
this.timeout(80 * 1000)
this.timeout(90 * 1000)
const keyName = hat()

node.key.gen(keyName, { type: 'rsa', size: 2048 }, function (err, key) {
Expand Down Expand Up @@ -164,7 +170,7 @@ describe('name', function () {
after((done) => ipfsd.stop(done))

it('should republish entries after 60 seconds', function (done) {
this.timeout(100 * 1000)
this.timeout(120 * 1000)
sinon.spy(node._ipns.republisher, '_republishEntries')

setTimeout(function () {
Expand All @@ -174,7 +180,7 @@ describe('name', function () {
})

it('should error if run republish again', function (done) {
this.timeout(100 * 1000)
this.timeout(120 * 1000)
sinon.spy(node._ipns.republisher, '_republishEntries')

try {
Expand Down Expand Up @@ -203,7 +209,7 @@ describe('name', function () {
}

before(function (done) {
this.timeout(40 * 1000)
this.timeout(70 * 1000)

parallel([
(cb) => createNode(cb),
Expand Down Expand Up @@ -232,15 +238,19 @@ describe('name', function () {
})
})

after((done) => parallel(nodes.map((node) => (cb) => node.stop(cb)), done))
after(function (done) {
this.timeout(80 * 1000)

parallel(nodes.map((node) => (cb) => node.stop(cb)), done)
})

it('should publish and then resolve correctly with the default options', function (done) {
this.timeout(50 * 1000)
this.timeout(90 * 1000)
publishAndResolve(nodeA, nodeB, ipfsRef, { resolve: false }, idA.id, {}, done)
})

it('should recursively resolve to an IPFS hash', function (done) {
this.timeout(80 * 1000)
this.timeout(180 * 1000)
const keyName = hat()

nodeA.key.gen(keyName, { type: 'rsa', size: 2048 }, function (err, key) {
Expand Down

0 comments on commit 244eab1

Please sign in to comment.