Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FTR: add 'throttle' option to cli #33241

Merged
merged 3 commits into from
Dec 11, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 11 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,14 @@ export function runFtrCli() {
}
);

if (flags.throttle) {
process.env.TEST_THROTTLE_NETWORK = '1';
}

if (flags.headless) {
process.env.TEST_BROWSER_HEADLESS = '1';
}

let teardownRun = false;
const teardown = async (err?: Error) => {
if (teardownRun) return;
Expand Down Expand Up @@ -97,7 +105,7 @@ export function runFtrCli() {
{
flags: {
string: ['config', 'grep', 'exclude', 'include-tag', 'exclude-tag', 'kibana-install-dir'],
boolean: ['bail', 'invert', 'test-stats', 'updateBaselines'],
boolean: ['bail', 'invert', 'test-stats', 'updateBaselines', 'throttle', 'headless'],
default: {
config: 'test/functional/config.js',
debug: true,
Expand All @@ -113,6 +121,8 @@ 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
--headless run browser in headless mode
`,
},
}
Expand Down
16 changes: 16 additions & 0 deletions packages/kbn-test/src/functional_tests/cli/run_tests/cli.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -182,6 +182,22 @@ describe('run tests CLI', () => {
expect(exitMock).not.toHaveBeenCalled();
});

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

await runTestsCli(['foo']);

expect(exitMock).toHaveBeenCalledWith(1);
});

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

await runTestsCli(['foo']);

expect(exitMock).toHaveBeenCalledWith(1);
});

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

Expand Down