diff --git a/README.md b/README.md index 782cbd8..8240658 100644 --- a/README.md +++ b/README.md @@ -47,6 +47,7 @@ command help -o, --output Output file -t, --type Type of websocket server to bench(socket.io, engine.io, faye, primus, wamp). Default to socket.io -p, --transport Type of transport to websocket(engine.io, websockets, browserchannel, sockjs, socket.io). Default to websockets (Just for Primus) + -n, --pathname Pathname for primus configuration, default is '/primus' -k, --keep-alive Keep alive connection -v, --verbose Verbose Logging diff --git a/index.js b/index.js old mode 100644 new mode 100755 index 341884e..852bc6d --- a/index.js +++ b/index.js @@ -17,6 +17,7 @@ program .option('-o, --output ', 'Output file') .option('-t, --type ', 'type of websocket server to bench(socket.io, engine.io, faye, primus, wamp). Default to io') .option('-p, --transport ', 'type of transport to websocket(engine.io, websockets, browserchannel, sockjs, socket.io). Default to websockets') + .option('-n, --pathname ', 'pathname for primus configuration, default is "/primus" ') .option('-k, --keep-alive', 'Keep alive connection') .option('-v, --verbose', 'Verbose Logging') .parse(process.argv); @@ -74,7 +75,8 @@ var options = { type : program.type, transport : program.transport, keepAlive : program.keepAlive, - verbose : program.verbose + verbose : program.verbose, + pathname : program.pathname }; if (program.verbose) { diff --git a/lib/benchmark.js b/lib/benchmark.js index d114f99..f376731 100644 --- a/lib/benchmark.js +++ b/lib/benchmark.js @@ -36,7 +36,8 @@ Benchmark.prototype.launch = function (connectNumber, concurency, workerNumber, for (var i = 0; i < workerNumber; i++) { this.workers[i] = cp.fork(__dirname + '/worker.js', [ - this.server, this.options.generatorFile, this.options.type, this.options.transport, this.options.verbose + this.server, this.options.generatorFile, this.options.type, this.options.transport, this.options.verbose, + this.options.pathname ]); this.workers[i].on('message', this._onMessage.bind(this)); diff --git a/lib/workers/primusworker.js b/lib/workers/primusworker.js index 34791e8..35f884d 100644 --- a/lib/workers/primusworker.js +++ b/lib/workers/primusworker.js @@ -7,7 +7,7 @@ var BaseWorker = require('./baseworker.js'), logger = require('../logger.js'); // Create a primus instance in order to obtain the client constructor. -var PrimusClient = new Primus(http.createServer(), {'transformer' : process.argv[5]}).Socket; +var PrimusClient = new Primus(http.createServer(), {'transformer' : process.argv[5] , pathname: process.argv[7]}).Socket; var PrimusWorker = function (server, generator) { PrimusWorker.super_.apply(this, arguments); diff --git a/test/functional/faye.js b/test/functional/faye.js index 4f0a344..957ecdb 100644 --- a/test/functional/faye.js +++ b/test/functional/faye.js @@ -49,7 +49,7 @@ describe('Test Faye Benchmarking', function () { }); it('should connect call reporter with 5 connection done', function (done) { - var stubReport = sinon.stub(testReporter, 'report', function (steps, monitor) { + var stubReport = sinon.stub(testReporter, 'report').callsFake(function (steps, monitor) { assert.equal(monitor.results.connection, 5); assert.equal(monitor.results.errors, 0); testReporter.report.restore(); @@ -62,7 +62,7 @@ describe('Test Faye Benchmarking', function () { }); describe('Test without faye server', function () { it('should connect call reporter with 10 errors', function (done) { - var stubReport = sinon.stub(testReporter, 'report', function (steps, monitor) { + var stubReport = sinon.stub(testReporter, 'report').callsFake(function (steps, monitor) { assert.equal(monitor.results.connection, 0); assert.equal(monitor.results.errors, 10); testReporter.report.restore();