Comparing version 0.2.4 to 0.2.5
@@ -52,1 +52,6 @@ | ||
### 2013-09-28: version 0.2.5 | ||
* JSHint clean up. | ||
* Option --index should be working again. | ||
@@ -10,12 +10,5 @@ 'use strict'; | ||
// requires | ||
var Log = require('log'); | ||
var loadtest = require('./lib/loadtest.js'); | ||
var testserver = require('./lib/testserver.js'); | ||
// globals | ||
var log = new Log('info'); | ||
var concurrency = 100; | ||
var requestsPerSecond = 1; | ||
var agent = true; | ||
// exports | ||
@@ -22,0 +15,0 @@ exports.loadTest = loadtest.loadTest; |
@@ -10,2 +10,3 @@ 'use strict'; | ||
// requires | ||
require('./prototypes.js'); | ||
var testing = require('testing'); | ||
@@ -15,4 +16,2 @@ var urlLib = require('url'); | ||
var Log = require('log'); | ||
var fs = require('fs'); | ||
var prototypes = require('./prototypes.js'); | ||
var timing = require('./timing.js'); | ||
@@ -55,8 +54,2 @@ var websocket = require('./websocket.js'); | ||
{ | ||
var keepalive = require('agentkeepalive'); | ||
var keepAliveAgent = new keepalive({ | ||
maxSockets: params.concurrency, | ||
maxKeepAliveRequests: 0, // max requests per keepalive socket, default is 0, no limit | ||
maxKeepAliveTime: 3000 // keepalive for 30 seconds | ||
}); | ||
} | ||
@@ -71,3 +64,8 @@ options = urlLib.parse(params.url); | ||
{ | ||
options.agent = keepAliveAgent; | ||
var KeepAlive = require('agentkeepalive'); | ||
options.agent = new KeepAlive({ | ||
maxSockets: params.concurrency, | ||
maxKeepAliveRequests: 0, // max requests per keepalive socket, default is 0, no limit | ||
maxKeepAliveTime: 3000 // keepalive for 30 seconds | ||
}); | ||
} | ||
@@ -201,3 +199,3 @@ if (params.method) | ||
}); | ||
connection.on('end', function(result) | ||
connection.on('end', function() | ||
{ | ||
@@ -249,6 +247,2 @@ if (connection.statusCode >= 300) | ||
} | ||
else | ||
{ | ||
return help(); | ||
} | ||
options.concurrency = options.concurrency || 1; | ||
@@ -270,3 +264,3 @@ if (options.debug) | ||
*/ | ||
var Operation = function(options, constructor, callback) | ||
var Operation = function(options, Constructor, callback) | ||
{ | ||
@@ -331,5 +325,5 @@ // self-reference | ||
{ | ||
options.url = url.replaceAll(indexParam, index); | ||
options.url = url.replaceAll(options.indexParam, index); | ||
} | ||
var client = new constructor(self, options); | ||
var client = new Constructor(self, options); | ||
clients[index] = client; | ||
@@ -396,3 +390,3 @@ if (!options.requestsPerSecond) | ||
}, callback); | ||
} | ||
}; | ||
@@ -399,0 +393,0 @@ // run tests if invoked directly |
@@ -42,3 +42,3 @@ 'use strict'; | ||
return this.slice(0, this.indexOf(str)); | ||
} | ||
}; | ||
@@ -56,3 +56,3 @@ /** | ||
return this.slice(0, this.lastIndexOf(str)); | ||
} | ||
}; | ||
@@ -70,3 +70,3 @@ /** | ||
return this.slice(this.indexOf(str) + str.length); | ||
} | ||
}; | ||
@@ -82,3 +82,3 @@ /** | ||
/** | ||
* Replace all occurrences of a string the replacement. | ||
* Replace all occurrences of a string with the replacement. | ||
*/ | ||
@@ -88,3 +88,3 @@ String.prototype.replaceAll = function(find, replace) | ||
return this.split(find).join(replace); | ||
} | ||
}; | ||
@@ -108,3 +108,4 @@ /** | ||
} | ||
count >>= 1, pattern += pattern; | ||
count >>= 1; | ||
pattern += pattern; | ||
} | ||
@@ -137,6 +138,9 @@ return result; | ||
{ | ||
count++; | ||
if (object.hasOwnProperty(key)) | ||
{ | ||
count++; | ||
} | ||
} | ||
return count; | ||
} | ||
}; | ||
@@ -166,3 +170,3 @@ /** | ||
return original; | ||
} | ||
}; | ||
@@ -198,3 +202,3 @@ /** | ||
testing.run(tests, callback); | ||
} | ||
}; | ||
@@ -201,0 +205,0 @@ // run tests if invoked directly |
@@ -10,5 +10,5 @@ 'use strict'; | ||
// requires | ||
require('./prototypes.js'); | ||
var loadtest = require('./loadtest.js'); | ||
var testserver = require('./testserver.js'); | ||
var prototypes = require('./prototypes.js'); | ||
var testing = require('testing'); | ||
@@ -107,2 +107,3 @@ var Log = require('log'); | ||
{ | ||
log.debug('Running all tests'); | ||
testing.run({ | ||
@@ -112,3 +113,3 @@ integration: testIntegration, | ||
}, 4000, callback); | ||
} | ||
}; | ||
@@ -115,0 +116,0 @@ // start load test if invoked directly |
@@ -10,2 +10,3 @@ 'use strict'; | ||
// requires | ||
require('./prototypes.js'); | ||
var http = require('http'); | ||
@@ -15,3 +16,2 @@ var util = require('util'); | ||
var timing = require('./timing.js'); | ||
var prototypes = require('./prototypes.js'); | ||
@@ -69,4 +69,4 @@ // globals | ||
}); | ||
return server | ||
} | ||
return server; | ||
}; | ||
@@ -73,0 +73,0 @@ /** |
@@ -10,2 +10,3 @@ 'use strict'; | ||
// requires | ||
require('./prototypes.js'); | ||
var testing = require('testing'); | ||
@@ -15,3 +16,2 @@ var util = require('util'); | ||
var Log = require('log'); | ||
var prototypes = require('./prototypes.js'); | ||
@@ -223,3 +223,3 @@ // globals | ||
errorCodes: errorCodes | ||
} | ||
}; | ||
}; | ||
@@ -382,4 +382,5 @@ | ||
}; | ||
var latency = new exports.Latency(options, function(error, result) | ||
var latency = new exports.Latency(options, function(error) | ||
{ | ||
testing.check(error, 'Error while testing latency percentiles', callback); | ||
var percentiles = latency.getResults().percentiles; | ||
@@ -386,0 +387,0 @@ |
@@ -10,6 +10,6 @@ 'use strict'; | ||
// requires | ||
require('./prototypes.js'); | ||
var WebSocketClient = require('websocket').client; | ||
var testing = require('testing'); | ||
var Log = require('log'); | ||
var prototypes = require('./prototypes.js'); | ||
@@ -45,3 +45,3 @@ // globals | ||
log.debug('WebSocket client connected to ' + url); | ||
} | ||
}; | ||
@@ -63,3 +63,3 @@ /** | ||
{ | ||
error('Invalid message type ' + message.type); | ||
log.error('Invalid message type ' + message.type); | ||
return; | ||
@@ -71,3 +71,3 @@ } | ||
latency.add(newCall - lastCall); | ||
entry += ', latency: ' + (newCall - lastCall); | ||
log.deubg('latency: ' + (newCall - lastCall)); | ||
lastCall = null; | ||
@@ -82,3 +82,3 @@ } | ||
{ | ||
error('Invalid JSON: ' + message.utf8Data); | ||
log.error('Invalid JSON: ' + message.utf8Data); | ||
return; | ||
@@ -98,3 +98,3 @@ } | ||
{ | ||
error('Wrong message ' + JSON.stringify(message)); | ||
log.error('Wrong message ' + JSON.stringify(message)); | ||
return; | ||
@@ -129,3 +129,3 @@ } | ||
} | ||
} | ||
}; | ||
@@ -138,3 +138,3 @@ /** | ||
testing.success(callback); | ||
} | ||
}; | ||
@@ -141,0 +141,0 @@ // start load test if invoked directly |
{ | ||
"name": "loadtest", | ||
"version": "0.2.4", | ||
"version": "0.2.5", | ||
"description": "Run load tests for your web application. Mostly ab-compatible interface, with an option to force requests per second. Includes an API for automated load testing.", | ||
@@ -5,0 +5,0 @@ "homepage": "https://github.com/alexfernandez/loadtest", |
@@ -1,2 +0,1 @@ | ||
[![Build Status](https://secure.travis-ci.org/alexfernandez/loadtest.png)](http://travis-ci.org/alexfernandez/loadtest) | ||
@@ -26,3 +25,3 @@ | ||
$ sudo install -g loadtest | ||
$ sudo npm install -g loadtest | ||
@@ -29,0 +28,0 @@ For programmatic access, install locally or add package loadtest to your package.json dependencies. |
@@ -9,3 +9,2 @@ 'use strict'; | ||
// requires | ||
var util = require('util'); | ||
var testing = require('testing'); | ||
@@ -23,2 +22,3 @@ var Log = require('log'); | ||
{ | ||
log.debug('Running tests'); | ||
var tests = {}; | ||
@@ -31,3 +31,3 @@ var libs = [ 'prototypes', 'timing', 'sample', 'websocket', 'loadtest' ]; | ||
testing.run(tests, 4200, callback); | ||
} | ||
}; | ||
@@ -34,0 +34,0 @@ // run tests if invoked directly |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
48532
17
2
1538
257