Hi guys,
I'm working on creating some stress tests using the Custom Tests, but I've ran into some problems. I'm running a test that is supposed to replay a log file which consists of a url and a timeout. In this test I want each user (runTest) to do 1 page request.
Here's a piece of the code that I'm running:
function MyCustomTest(redlineApi, testNum, rand, config)
{
this.testNum = testNum;
this.redlineApi = redlineApi;
this.url = 'someurl';
this.cityList = [
{id: 01, timeout: 1000},
{id: 02, timeout: 2000},
etc. etc. list goes on to about 100 items];
}
/** Run test */
MyCustomTest.prototype.runTest = function( redlineCallback )
{
var that = this;
var testNum = that.testNum;
var testItem = that.cityList[testNum];
var url = that.url + testItem.id;
var timeout = testItem.timeout;
setTimeout(function () {
that.loadPage(url, function(err) {
if(err) {
redlineCallback(true);
}
redlineCallback(false);
});
}, timeout);
};
So this.cityList is as long as the number of users that I simulate in a test. For now the timeout will be equal to (n + 1 ) * 1000. So item 37 has a timeout of 38000 ms.
This way I hope to achieve the following: Fully replay a Varnish/Apache/Nginx log in order to run a test that is exactly the same as a real life situation from the past.
However, when running the code I run into a problem. Not all tests are executed when I simulate 49 users. The results are shown below:
If I run the same test, but with a maximum timeout of 30 seconds (if (timeout > 30000) { timeout = 30000; }), these are the results:
So I figured maybe the amount of users has influence on which item will pass and which won't, but the results with 70 users show the same behavior:
So I guess my question is: is there a limit to how long the test framework will wait for runTest to answer and if so, how can I work around this?