-
Notifications
You must be signed in to change notification settings - Fork 8.3k
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
[scout] add ci pipeline #202707
Merged
Merged
[scout] add ci pipeline #202707
Changes from 9 commits
Commits
Show all changes
24 commits
Select commit
Hold shift + click to select a range
b06b1e3
[kbn/scout] update script to use tagging
dmlemeshko 2196b50
[ci] add pipeline to run stateful tests
dmlemeshko 3bf06d8
Merge remote-tracking branch 'upstream/main' into scout/add-ci-pipeline
dmlemeshko 15db0aa
refactor and add serverless tests
dmlemeshko 11648e6
exclude security project where viewer has no permission to index
dmlemeshko 21828c6
Merge branch 'main' into scout/add-ci-pipeline
dmlemeshko d82f4cd
bump timeout to 30 min
dmlemeshko ffa7a7b
Merge branch 'scout/add-ci-pipeline' of github.com:dmlemeshko/kibana …
dmlemeshko 2774f7b
update script
dmlemeshko 9fe0a76
Merge remote-tracking branch 'upstream/main' into scout/add-ci-pipeline
dmlemeshko b1feb44
Merge remote-tracking branch 'upstream/main' into scout/add-ci-pipeline
dmlemeshko 3a966c4
update config
dmlemeshko 7277a38
Merge remote-tracking branch 'upstream/main' into scout/add-ci-pipeline
dmlemeshko ea67b2d
[kbn-scout] fix svl configs to run Kibana build
dmlemeshko a250a59
update config type
dmlemeshko 040f224
Merge remote-tracking branch 'upstream/main' into scout/add-ci-pipeline
dmlemeshko 7fb9639
update ci script
dmlemeshko 2b49bff
update pipeline script
dmlemeshko ffae7d3
Merge branch 'main' into scout/add-ci-pipeline
dmlemeshko a514f73
update pipeline
dmlemeshko 302ad67
improve script
dmlemeshko 1a06832
Merge branch 'scout/add-ci-pipeline' of github.com:dmlemeshko/kibana …
dmlemeshko 868095c
Merge branch 'main' into scout/add-ci-pipeline
dmlemeshko ca92b74
Merge branch 'main' into scout/add-ci-pipeline
dmlemeshko 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
There are no files selected for viewing
This file contains 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,19 @@ | ||
steps: | ||
- command: .buildkite/scripts/steps/functional/scout_ui_tests.sh | ||
label: 'Scout UI Tests' | ||
agents: | ||
machineType: n2-standard-4 | ||
preemptible: true | ||
depends_on: | ||
- build | ||
- quick_checks | ||
- checks | ||
- linting | ||
- linting_with_types | ||
- check_types | ||
- check_oas_snapshot | ||
timeout_in_minutes: 30 | ||
retry: | ||
automatic: | ||
- exit_status: '-1' | ||
limit: 3 |
This file contains 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 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,31 @@ | ||
#!/usr/bin/env bash | ||
|
||
set -euo pipefail | ||
|
||
source .buildkite/scripts/steps/functional/common.sh | ||
|
||
export JOB=kibana-scout-ui-tests | ||
|
||
echo "--- Stateful: 'discover_enhanced' plugin UI Tests" | ||
node scripts/scout_test \ | ||
--stateful \ | ||
--config x-pack/plugins/discover_enhanced/ui_tests/playwright.config.ts \ | ||
--kibana-install-dir "$KIBANA_BUILD_LOCATION" | ||
|
||
echo "--- Serverless Elasticsearch: 'discover_enhanced' plugin UI Tests" | ||
node scripts/scout_test \ | ||
--serverless=es \ | ||
--config x-pack/plugins/discover_enhanced/ui_tests/playwright.config.ts \ | ||
--kibana-install-dir "$KIBANA_BUILD_LOCATION" | ||
|
||
echo "--- Serverless Observability: 'discover_enhanced' plugin UI Tests" | ||
node scripts/scout_test \ | ||
--serverless=oblt \ | ||
--config x-pack/plugins/discover_enhanced/ui_tests/playwright.config.ts \ | ||
--kibana-install-dir "$KIBANA_BUILD_LOCATION" | ||
|
||
echo "--- Serverless Security: 'discover_enhanced' plugin UI Tests" | ||
node scripts/scout_test \ | ||
--serverless=security \ | ||
--config x-pack/plugins/discover_enhanced/ui_tests/playwright.config.ts \ | ||
--kibana-install-dir "$KIBANA_BUILD_LOCATION" |
This file contains 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 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
35 changes: 35 additions & 0 deletions
35
packages/kbn-scout/src/playwright/fixtures/test/validate_tags.ts
This file contains 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,35 @@ | ||
/* | ||
* 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 { test as base } from '@playwright/test'; | ||
import { tags } from '../../tags'; | ||
|
||
const supportedTags = tags.DEPLOYMENT_AGNOSTIC; | ||
|
||
export const validateTagsFixture = base.extend<{ validateTags: void }>({ | ||
validateTags: [ | ||
async ({}, use, testInfo) => { | ||
if (testInfo.tags.length === 0) { | ||
throw new Error(`At least one tag is required: ${supportedTags.join(', ')}`); | ||
} | ||
|
||
const invalidTags = testInfo.tags.filter((tag: string) => !supportedTags.includes(tag)); | ||
if (invalidTags.length > 0) { | ||
throw new Error( | ||
`Unsupported tag(s) found in test suite "${testInfo.title}": ${invalidTags.join( | ||
', ' | ||
)}. ` + `Supported tags are: ${supportedTags.join(', ')}.` | ||
); | ||
} | ||
|
||
await use(); | ||
}, | ||
{ auto: true }, | ||
], | ||
}); | ||
This file contains 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 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 |
---|---|---|
|
@@ -18,12 +18,14 @@ import { loadServersConfig } from '../../config'; | |
import { silence } from '../../common'; | ||
import { RunTestsOptions } from './flags'; | ||
import { getExtraKbnOpts } from '../../servers/run_kibana_server'; | ||
import { getPlaywrightGrepTag } from '../utils'; | ||
|
||
export async function runTests(log: ToolingLog, options: RunTestsOptions) { | ||
const runStartTime = Date.now(); | ||
const reportTime = getTimeReporter(log, 'scripts/scout_test'); | ||
|
||
const config = await loadServersConfig(options.mode, log); | ||
const playwrightGrepTag = getPlaywrightGrepTag(config); | ||
const playwrightConfigPath = options.configPath; | ||
|
||
await withProcRunner(log, async (procs) => { | ||
|
@@ -59,7 +61,12 @@ export async function runTests(log: ToolingLog, options: RunTestsOptions) { | |
// Running 'npx playwright test --config=${playwrightConfigPath}' | ||
await procs.run(`playwright`, { | ||
cmd: resolve(REPO_ROOT, './node_modules/.bin/playwright'), | ||
args: ['test', `--config=${playwrightConfigPath}`, ...(options.headed ? ['--headed'] : [])], | ||
args: [ | ||
'test', | ||
`--config=${playwrightConfigPath}`, | ||
`--grep=${playwrightGrepTag}`, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Passing one of |
||
...(options.headed ? ['--headed'] : []), | ||
], | ||
cwd: resolve(REPO_ROOT), | ||
env: { | ||
...process.env, | ||
|
This file contains 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,27 @@ | ||
/* | ||
* 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". | ||
*/ | ||
|
||
const SERVERLESS_ONLY = ['@svlSecurity', '@svlOblt', '@svlSearch']; | ||
const ESS_ONLY = ['@ess']; | ||
const DEPLOYMENT_AGNOSTIC = SERVERLESS_ONLY.concat(ESS_ONLY); | ||
|
||
export const tags = { | ||
ESS_ONLY, | ||
SERVERLESS_ONLY, | ||
DEPLOYMENT_AGNOSTIC, | ||
}; | ||
|
||
export const tagsByMode = { | ||
stateful: '@ess', | ||
serverless: { | ||
es: '@svlSearch', | ||
oblt: '@svlOblt', | ||
security: '@svlSecurity', | ||
}, | ||
}; |
This file contains 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 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 |
---|---|---|
|
@@ -5,10 +5,10 @@ | |
* 2.0. | ||
*/ | ||
|
||
import { expect } from '@kbn/scout'; | ||
import { expect, tags } from '@kbn/scout'; | ||
import { test, testData } from '../fixtures'; | ||
|
||
test.describe('Discover app - errors', { tag: ['@ess'] }, () => { | ||
test.describe('Discover app - errors', { tag: tags.ESS_ONLY }, () => { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. alias to simplify the process and avoid spelling/incorrect tagging issues |
||
test.beforeAll(async ({ esArchiver, kbnClient, uiSettings }) => { | ||
await kbnClient.savedObjects.clean({ types: ['search', 'index-pattern'] }); | ||
await esArchiver.loadIfNeeded(testData.ES_ARCHIVES.LOGSTASH); | ||
|
This file contains 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
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The goal: notify test author about requirement of tags definition and validating its correctness. I also introduces aliases through
tags
variable to minimize spelling error.Note: it only work when you run tests in IDE; when you run tests via
npx playwright test --grep <tag>
playwright is doing filtering in advance and no tags or incorrect tags will cause test to be filtered out.That said, for CI we will need to come up with some script to validate tags being defined. But I still believe there is a benefit of raising error during test development process
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Example: adding non-supported tag
@xyz
likewill lead to runtime error