Skip to content
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
Original file line number Diff line number Diff line change
Expand Up @@ -463,6 +463,9 @@ export async function pickTestGroupRunOrder() {
...expandAgentQueue('n2-4-spot'),
diskSizeGb: 85,
},
env: {
SCOUT_TARGET_TYPE: 'local',
},
retry: {
automatic: [
{ exit_status: '-1', limit: 3 },
Expand All @@ -481,6 +484,9 @@ export async function pickTestGroupRunOrder() {
timeout_in_minutes: 120,
key: 'jest-integration',
agents: expandAgentQueue('n2-4-spot'),
env: {
SCOUT_TARGET_TYPE: 'local',
},
retry: {
automatic: [
{ exit_status: '-1', limit: 3 },
Expand Down Expand Up @@ -516,6 +522,7 @@ export async function pickTestGroupRunOrder() {
timeout_in_minutes: 90,
agents: expandAgentQueue(queue),
env: {
SCOUT_TARGET_TYPE: 'local',
FTR_CONFIG_GROUP_KEY: key,
...ftrExtraArgs,
...envFromlabels,
Expand Down
1 change: 1 addition & 0 deletions src/platform/packages/private/kbn-scout-info/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,4 @@

export * from './src/paths';
export * from './src/reporting';
export * from './src/runtime';
11 changes: 11 additions & 0 deletions src/platform/packages/private/kbn-scout-info/src/runtime.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the "Elastic License
* 2.0", the "GNU Affero General Public License v3.0 only", and the "Server Side
* Public License v 1"; you may not use this file except in compliance with, at
* your election, the "Elastic License 2.0", the "GNU Affero General Public
* License v3.0 only", or the "Server Side Public License, v 1".
*/

export const SCOUT_TARGET_TYPE: string = process.env.SCOUT_TARGET_TYPE || 'unknown';
export const SCOUT_TARGET_MODE: string = process.env.SCOUT_TARGET_MODE || 'unknown';
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import {
getCodeOwnersEntries,
getOwningTeamsForPath,
} from '@kbn/code-owners';
import { SCOUT_REPORT_OUTPUT_ROOT } from '@kbn/scout-info';
import { SCOUT_REPORT_OUTPUT_ROOT, SCOUT_TARGET_MODE, SCOUT_TARGET_TYPE } from '@kbn/scout-info';
import path from 'node:path';
import { REPO_ROOT } from '@kbn/repo-info';
import stripAnsi from 'strip-ansi';
Expand Down Expand Up @@ -61,6 +61,10 @@ export class ScoutJestReporter extends BaseReporter {
this.report = new ScoutEventsReport(this.scoutLog);
this.baseTestRunInfo = {
id: this.runId,
target: {
type: SCOUT_TARGET_TYPE,
mode: SCOUT_TARGET_MODE,
},
config: {
category: reporterOptions.configCategory,
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ import {
getOwningTeamsForPath,
findAreaForCodeOwner,
} from '@kbn/code-owners';
import { SCOUT_TARGET_TYPE, SCOUT_TARGET_MODE } from '@kbn/scout-info';
import {
ScoutEventsReport,
ScoutFileInfo,
Expand Down Expand Up @@ -62,7 +63,13 @@ export class ScoutPlaywrightReporter implements Reporter {
this.log.info(`Scout test run ID: ${this.runId}`);

this.report = new ScoutEventsReport(this.log);
this.baseTestRunInfo = { id: this.runId };
this.baseTestRunInfo = {
id: this.runId,
target: {
type: SCOUT_TARGET_TYPE,
mode: SCOUT_TARGET_MODE,
},
};
this.codeOwnersEntries = getCodeOwnersEntries();
}

Expand Down Expand Up @@ -112,6 +119,7 @@ export class ScoutPlaywrightReporter implements Reporter {

this.baseTestRunInfo = {
...this.baseTestRunInfo,
fully_parallel: config.fullyParallel,
config: configInfo,
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,11 @@ export interface ScoutFileInfo {
*/
export interface ScoutTestRunInfo {
id: string;
target: {
type: string;
mode: string;
};
fully_parallel?: boolean;
config?: {
file?: ScoutFileInfo;
category?: ScoutTestRunConfigCategory;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ export const reporterMappings: ClusterPutComponentTemplateRequest = {

export const testRunMappings: ClusterPutComponentTemplateRequest = {
name: 'scout-test-event.mappings.test-run',
version: 2,
version: 3,
template: {
mappings: {
properties: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,20 @@ export const testRunProperties: Record<PropertyName, MappingProperty> = {
id: {
type: 'wildcard',
},
target: {
type: 'object',
properties: {
type: {
type: 'keyword',
},
mode: {
type: 'keyword',
},
},
},
fully_parallel: {
type: 'boolean',
},
status: {
type: 'keyword',
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -159,19 +159,20 @@ export async function runTests(log: ToolingLog, options: RunTestsOptions) {

await withProcRunner(log, async (procs) => {
const exitCode = await hasTestsInPlaywrightConfig(log, pwBinPath, pwCmdArgs, pwConfigPath);
const pwEnv = {
SCOUT_LOG_LEVEL: logsLevel,
SCOUT_TARGET_TYPE: options.testTarget,
SCOUT_TARGET_MODE: options.mode,
};

if (exitCode !== 0) {
process.exit(exitCode);
}

if (pwProject === 'local') {
await runLocalServersAndTests(procs, log, options, pwBinPath, pwCmdArgs, {
SCOUT_LOG_LEVEL: logsLevel,
});
await runLocalServersAndTests(procs, log, options, pwBinPath, pwCmdArgs, pwEnv);
} else {
await runPlaywrightTest(procs, pwBinPath, pwCmdArgs, {
SCOUT_LOG_LEVEL: logsLevel,
});
await runPlaywrightTest(procs, pwBinPath, pwCmdArgs, pwEnv);
}

reportTime(runStartTime, 'ready', {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

import path from 'node:path';
import { ToolingLog } from '@kbn/tooling-log';
import { SCOUT_REPORT_OUTPUT_ROOT } from '@kbn/scout-info';
import { SCOUT_REPORT_OUTPUT_ROOT, SCOUT_TARGET_MODE, SCOUT_TARGET_TYPE } from '@kbn/scout-info';
import { REPO_ROOT } from '@kbn/repo-info';
import {
datasources,
Expand Down Expand Up @@ -67,6 +67,10 @@ export class ScoutFTRReporter {
this.codeOwnersEntries = getCodeOwnersEntries();
this.baseTestRunInfo = {
id: this.runId,
target: {
type: SCOUT_TARGET_TYPE,
mode: SCOUT_TARGET_MODE,
},
config: {
file: this.getScoutFileInfoForPath(path.relative(REPO_ROOT, config.path)),
category: config.get('testConfigCategory'),
Expand Down