[ftr] filter configs before running to clean up log output (#112490)

Co-authored-by: spalger <spalger@users.noreply.github.com>
This commit is contained in:
Spencer 2021-09-17 22:14:12 -07:00 committed by GitHub
parent 285b1f92ee
commit 2e0d2ba2da
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 35 additions and 27 deletions

View file

@ -5,7 +5,6 @@
* in compliance with, at your election, the Elastic License 2.0 or the Server
* Side Public License, v 1.
*/
import { relative } from 'path';
import { ToolingLog } from '@kbn/dev-utils';
@ -121,9 +120,6 @@ export class FunctionalTestRunner {
throw new Error('No tests defined.');
}
// eslint-disable-next-line
console.log(`--- Running ${relative(process.cwd(), this.configFile)}`);
const dockerServers = new DockerServersService(
config.get('dockerServers'),
this.log,

View file

@ -9,7 +9,7 @@
import { relative } from 'path';
import * as Rx from 'rxjs';
import { startWith, switchMap, take } from 'rxjs/operators';
import { withProcRunner, ToolingLog } from '@kbn/dev-utils';
import { withProcRunner, ToolingLog, REPO_ROOT } from '@kbn/dev-utils';
import dedent from 'dedent';
import {
@ -72,37 +72,49 @@ export async function runTests(options: RunTestsParams) {
log.warning('❗️❗️❗️');
}
const log = options.createLogger();
if (options.assertNoneExcluded) {
log.write('--- asserting that all tests belong to a ciGroup');
for (const configPath of options.configs) {
log.info('loading', configPath);
log.indent(4);
try {
await assertNoneExcluded({ configPath, options: { ...options, log } });
} finally {
log.indent(-4);
}
continue;
}
return;
}
log.write('--- determining which ftr configs to run');
const configPathsWithTests: string[] = [];
for (const configPath of options.configs) {
const log = options.createLogger();
const opts = {
...options,
log,
};
log.info('Running', configPath);
log.indent(2);
if (options.assertNoneExcluded) {
await assertNoneExcluded({ configPath, options: opts });
continue;
log.info('testing', configPath);
log.indent(4);
try {
if (await hasTests({ configPath, options: { ...options, log } })) {
configPathsWithTests.push(configPath);
}
} finally {
log.indent(-4);
}
}
if (!(await hasTests({ configPath, options: opts }))) {
log.info('Skipping', configPath, 'since all tests are excluded');
continue;
}
// eslint-disable-next-line no-console
console.log(`--- Running ${relative(process.cwd(), configPath)}`);
for (const configPath of configPathsWithTests) {
log.write(`--- Running ${relative(REPO_ROOT, configPath)}`);
await withProcRunner(log, async (procs) => {
const config = await readConfigFile(log, configPath);
let es;
try {
es = await runElasticsearch({ config, options: opts });
await runKibanaServer({ procs, config, options: opts });
await runFtr({ configPath, options: opts });
es = await runElasticsearch({ config, options: { ...options, log } });
await runKibanaServer({ procs, config, options });
await runFtr({ configPath, options: { ...options, log } });
} finally {
try {
const delay = config.get('kbnTestServer.delayShutdown');