-
Notifications
You must be signed in to change notification settings - Fork 8.5k
[FTR] Improve running FTR tests by avoiding rerunning a config when agent is lost #237705
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
Merged
Merged
Changes from 17 commits
Commits
Show all changes
25 commits
Select commit
Hold shift + click to select a range
28b5abd
Upload FTR reports after each test config completes
maryam-saeidi 4ab4097
temporary: pipeline adjustment
maryam-saeidi fc0e9cc
temporary: removing jest tests from CI
maryam-saeidi c2337f6
Add check-event scout command
maryam-saeidi 3e1f974
Check for stats before and after running a config
maryam-saeidi 072add6
Fix check-event env var
maryam-saeidi 275255e
Fix check-event query
maryam-saeidi e0f86cb
temporary: reducing number of test files
maryam-saeidi ca195db
Refresh index before query
maryam-saeidi 93fb1a4
Fix index
maryam-saeidi 2489f1a
Skip config when there is already telemetry data
maryam-saeidi 7b6416f
Fix logging
maryam-saeidi 00287dd
Revert "temporary: reducing number of test files"
maryam-saeidi 22a9fdf
Revert "temporary: removing jest tests from CI"
maryam-saeidi 7ac1259
Revert "temporary: pipeline adjustment"
maryam-saeidi b53270c
Improve log messages
maryam-saeidi 0300adf
Merge branch 'main' into improve-ftr-retry
maryam-saeidi 3dc9673
Use BK metadata to check successful config execution and address revi…
maryam-saeidi ebfc43a
Add missing fi
maryam-saeidi e27c24c
Merge branch 'main' into improve-ftr-retry
maryam-saeidi 75ab482
Add missing continue
maryam-saeidi 507199c
Revert check-event cli command
maryam-saeidi c9e4e0c
Revert scout_upload_report_events.sh changes
maryam-saeidi 2f6bf4e
Merge branch 'main' into improve-ftr-retry
maryam-saeidi 6f21b5c
Suppress metadata warning
maryam-saeidi File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Some comments aren't visible on the classic Files Changed page.
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
107 changes: 107 additions & 0 deletions
107
src/platform/packages/private/kbn-scout-reporting/src/cli/check_event.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,107 @@ | ||
| /* | ||
| * 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". | ||
| */ | ||
|
|
||
| import type { Command } from '@kbn/dev-cli-runner'; | ||
| import { | ||
| SCOUT_REPORTER_ES_URL, | ||
| SCOUT_REPORTER_ES_API_KEY, | ||
| SCOUT_REPORTER_ES_VERIFY_CERTS, | ||
| SCOUT_TEST_EVENTS_DATA_STREAM_NAME, | ||
| } from '@kbn/scout-info'; | ||
| import { getValidatedESClient } from '../helpers/elasticsearch'; | ||
|
|
||
| export const checkEventCommand: Command<void> = { | ||
| name: 'check-event', | ||
| description: | ||
| 'Check if a specific event exists in Elasticsearch for a given build and test config', | ||
| flags: { | ||
| string: ['buildNumber', 'testConfig', 'esURL', 'esAPIKey'], | ||
| boolean: ['verifyTLSCerts', 'dontFailOnError'], | ||
| default: { | ||
| esURL: SCOUT_REPORTER_ES_URL, | ||
| esAPIKey: SCOUT_REPORTER_ES_API_KEY, | ||
| verifyTLSCerts: SCOUT_REPORTER_ES_VERIFY_CERTS, | ||
| dontFailOnError: false, | ||
| }, | ||
| help: ` | ||
| --buildNumber (required) The Buildkite build number. | ||
| --testConfig (required) The path to the test config file. | ||
| --esURL (required) Elasticsearch URL [env: SCOUT_REPORTER_ES_URL] | ||
| --esAPIKey (required) Elasticsearch API Key [env: SCOUT_REPORTER_ES_API_KEY] | ||
| --verifyTLSCerts (optional) Verify TLS certificates [env: SCOUT_REPORTER_ES_VERIFY_CERTS] | ||
| --dontFailOnError (optional) If present, errors will be logged but the process will not fail (default: false) | ||
| `, | ||
| }, | ||
| run: async ({ flagsReader, log }) => { | ||
| const buildNumber = flagsReader.requiredString('buildNumber'); | ||
| const testConfig = flagsReader.requiredString('testConfig'); | ||
| const esURL = flagsReader.requiredString('esURL'); | ||
| const esAPIKey = flagsReader.requiredString('esAPIKey'); | ||
| const verifyTLSCerts = flagsReader.boolean('verifyTLSCerts'); | ||
| const dontFailOnError = flagsReader.boolean('dontFailOnError'); | ||
|
|
||
| log.info(`Connecting to Elasticsearch at ${esURL}`); | ||
| const es = await getValidatedESClient( | ||
| { | ||
| node: esURL, | ||
| auth: { apiKey: esAPIKey }, | ||
| tls: { | ||
| rejectUnauthorized: verifyTLSCerts, | ||
| }, | ||
| }, | ||
| { log, cli: true } | ||
| ); | ||
|
|
||
| log.info(`Checking for events with buildNumber: ${buildNumber} and testConfig: ${testConfig}`); | ||
|
|
||
| try { | ||
| const result = await es.search({ | ||
| index: SCOUT_TEST_EVENTS_DATA_STREAM_NAME, | ||
| size: 0, | ||
| query: { | ||
| bool: { | ||
| filter: [ | ||
| { | ||
| range: { | ||
| '@timestamp': { | ||
| gte: 'now-1d/d', | ||
| lte: 'now', | ||
| }, | ||
| }, | ||
| }, | ||
| ], | ||
| must: [ | ||
| { term: { 'buildkite.build.number': buildNumber } }, | ||
| { term: { 'test_run.config.file.path': testConfig } }, | ||
| ], | ||
| }, | ||
| }, | ||
| }); | ||
|
|
||
| if ((result.hits.total as any).value > 0) { | ||
| log.success(`Found events for buildNumber: ${buildNumber} and testConfig: ${testConfig}`); | ||
| } else { | ||
| log.info( | ||
| `No events was found for buildNumber: ${buildNumber} and testConfig: ${testConfig}` | ||
| ); | ||
| if (!dontFailOnError) { | ||
| process.exitCode = 1; | ||
| } | ||
| } | ||
| } catch (error) { | ||
| log.error( | ||
| `Error checking events for buildNumber: ${buildNumber} and testConfig: ${testConfig}` | ||
| ); | ||
| log.error(error); | ||
| if (!dontFailOnError) { | ||
| process.exitCode = 1; | ||
| } | ||
| } | ||
| }, | ||
| }; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.