-
-
Notifications
You must be signed in to change notification settings - Fork 323
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Adding individual status code statistics table (#347)
* Adding individual status code statistics table * Adding unit test for status code statistics table * Adding unit test for status code statistics table * Adding unit test for status code statistics table
- Loading branch information
Showing
8 changed files
with
121 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
'use strict' | ||
|
||
const test = require('tap').test | ||
const split = require('split2') | ||
const path = require('path') | ||
const childProcess = require('child_process') | ||
|
||
test('should stdout (print) the result', (t) => { | ||
const lines = [ | ||
/.*/, | ||
/Stat.*2\.5%.*50%.*97\.5%.*99%.*Avg.*Stdev.*Max.*$/, | ||
/.*/, | ||
/Latency.*$/, | ||
/$/, | ||
/.*/, | ||
/Stat.*1%.*2\.5%.*50%.*97\.5%.*Avg.*Stdev.*Min.*$/, | ||
/.*/, | ||
/Req\/Sec.*$/, | ||
/.*/, | ||
/Bytes\/Sec.*$/, | ||
/.*/, | ||
/.*/, | ||
/Code.*Count.*$/, | ||
/.*/, | ||
/200.*500.*$/, | ||
/.*/, | ||
/302.*0.*$/, | ||
/.*/, | ||
/401.*0.*$/, | ||
/.*/, | ||
/403.*0.*$/, | ||
/.*/, | ||
/$/, | ||
/Req\/Bytes counts sampled once per second.*$/, | ||
/$/, | ||
/.* requests in ([0-9]|\.)+s, .* read/ | ||
] | ||
|
||
t.plan(lines.length * 2) | ||
|
||
const child = childProcess.spawn(process.execPath, [path.join(__dirname, 'printResult-process.js'), '--renderStatusCodes', 'http://127.0.0.1'], { | ||
cwd: __dirname, | ||
env: process.env, | ||
stdio: ['ignore', 'pipe', 'pipe'], | ||
detached: false | ||
}) | ||
|
||
t.tearDown(() => { | ||
child.kill() | ||
}) | ||
|
||
child | ||
.stderr | ||
.pipe(split()) | ||
.on('data', (line) => { | ||
const regexp = lines.shift() | ||
t.ok(regexp, 'we are expecting this line') | ||
t.ok(regexp.test(line), 'line matches ' + regexp) | ||
}) | ||
.on('end', t.end) | ||
}) |