mirror of
https://github.com/kremalicious/umami.git
synced 2024-11-15 17:55:08 +01:00
Merge pull request #445 from err931/fix-broken-loadtest
Fix broken loadtest
This commit is contained in:
commit
13b81bc650
@ -51,7 +51,6 @@ const options = {
|
|||||||
const message = JSON.stringify(mockPageView());
|
const message = JSON.stringify(mockPageView());
|
||||||
options.headers['Content-Length'] = message.length;
|
options.headers['Content-Length'] = message.length;
|
||||||
options.headers['Content-Type'] = 'application/json';
|
options.headers['Content-Type'] = 'application/json';
|
||||||
options.headers['user-agent'] = 'User-Agent: Mozilla/5.0 LoadTest';
|
|
||||||
options.body = message;
|
options.body = message;
|
||||||
options.path = '/api/collect';
|
options.path = '/api/collect';
|
||||||
const request = client(options, callback);
|
const request = client(options, callback);
|
||||||
@ -95,7 +94,6 @@ loadtest.loadTest(options, (error, results) => {
|
|||||||
if (results.errorCodes && Object.keys(results.errorCodes).length) {
|
if (results.errorCodes && Object.keys(results.errorCodes).length) {
|
||||||
console.log(chalk.redBright('*'), chalk.red('Error Codes:'), results.errorCodes);
|
console.log(chalk.redBright('*'), chalk.red('Error Codes:'), results.errorCodes);
|
||||||
}
|
}
|
||||||
// console.log(results);
|
|
||||||
});
|
});
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -121,6 +119,9 @@ function mockPageView(
|
|||||||
|
|
||||||
// If you pass in --verbose, this function is called
|
// If you pass in --verbose, this function is called
|
||||||
function statusCallback(error, result, latency) {
|
function statusCallback(error, result, latency) {
|
||||||
|
if (error) {
|
||||||
|
return console.error(chalk.redBright(error));
|
||||||
|
}
|
||||||
console.log(
|
console.log(
|
||||||
chalk.yellowBright(`\n## req #${result.requestIndex + 1} of ${latency.totalRequests}`),
|
chalk.yellowBright(`\n## req #${result.requestIndex + 1} of ${latency.totalRequests}`),
|
||||||
);
|
);
|
||||||
|
Loading…
Reference in New Issue
Block a user