Skip to content

Commit

Permalink
[ftr/cli] add throttling option
Browse files Browse the repository at this point in the history
  • Loading branch information
dmlemeshko committed Dec 9, 2019
1 parent cffb4dc commit 475dad8
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 1 deletion.
13 changes: 12 additions & 1 deletion packages/kbn-test/src/functional_test_runner/cli.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,8 @@ export function runFtrCli() {
}
);

process.env.TEST_THROTTLE_NETWORK = flags.throttle as string;

let teardownRun = false;
const teardown = async (err?: Error) => {
if (teardownRun) return;
Expand Down Expand Up @@ -96,7 +98,15 @@ export function runFtrCli() {
},
{
flags: {
string: ['config', 'grep', 'exclude', 'include-tag', 'exclude-tag', 'kibana-install-dir'],
string: [
'config',
'grep',
'exclude',
'include-tag',
'exclude-tag',
'kibana-install-dir',
'throttle',
],
boolean: ['bail', 'invert', 'test-stats', 'updateBaselines'],
default: {
config: 'test/functional/config.js',
Expand All @@ -113,6 +123,7 @@ export function runFtrCli() {
--test-stats print the number of tests (included and excluded) to STDERR
--updateBaselines replace baseline screenshots with whatever is generated from the test
--kibana-install-dir directory where the Kibana install being tested resides
--throttle enable network throttling in Chrome browser
`,
},
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -182,6 +182,14 @@ describe('run tests CLI', () => {
expect(exitMock).not.toHaveBeenCalled();
});

it('accepts network throttle option', async () => {
global.process.argv.push('--throttle');

await runTestsCli(['foo']);

expect(exitMock).not.toHaveBeenCalled();
});

it('accepts extra server options', async () => {
global.process.argv.push('--', '--server.foo=bar');

Expand Down

0 comments on commit 475dad8

Please sign in to comment.