Skip to content
This repository was archived by the owner on Mar 10, 2020. It is now read-only.

Faster tests #263

Merged
merged 1 commit into from
May 6, 2018
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 10 additions & 10 deletions js/src/pubsub.js
Original file line number Diff line number Diff line change
Expand Up @@ -551,19 +551,19 @@ module.exports = (common) => {
})
})

describe('load tests', function () {
describe('light-load tests', function () {
before(() => {
ipfs1.pubsub.setMaxListeners(10 * 1000)
ipfs2.pubsub.setMaxListeners(10 * 1000)
ipfs1.pubsub.setMaxListeners(10 * 10)
ipfs2.pubsub.setMaxListeners(10 * 10)
})

after(() => {
ipfs1.pubsub.setMaxListeners(10)
ipfs2.pubsub.setMaxListeners(10)
})

it('call publish 1k times', (done) => {
const count = 1000
it('call publish 10 times', (done) => {
const count = 10
let sendCount = 0
const topic = getTopic()

Expand Down Expand Up @@ -597,11 +597,11 @@ module.exports = (common) => {
ipfs2.pubsub.unsubscribe(topic, sub2)
})

it('send/receive 10k messages', function (done) {
it('send/receive 100 messages', function (done) {
this.timeout(2 * 60 * 1000)

const msgBase = 'msg - '
const count = 10000
const count = 100
let sendCount = 0
let receivedCount = 0
let startTime
Expand All @@ -621,7 +621,7 @@ module.exports = (common) => {
const duration = new Date().getTime() - startTime
const opsPerSec = Math.floor(count / (duration / 1000))

console.log(`Send/Receive 10k messages took: ${duration} ms, ${opsPerSec} ops / s\n`)
console.log(`Send/Receive 100 messages took: ${duration} ms, ${opsPerSec} ops / s\n`)

check()
}
Expand Down Expand Up @@ -656,8 +656,8 @@ module.exports = (common) => {
})
})

it('call subscribe/unsubscribe 1k times', (done) => {
const count = 1000
it('call subscribe/unsubscribe 10 times', (done) => {
const count = 10
let sendCount = 0
const handlers = []

Expand Down