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

View file

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