[8.10] [Security Solution][Endpoint] Fix and unskip flaky test (#165466) (#165559)

# Backport

This will backport the following commits from `main` to `8.10`:
- [[Security Solution][Endpoint] Fix and unskip flaky test
(#165466)](https://github.com/elastic/kibana/pull/165466)

<!--- Backport version: 8.9.7 -->

### Questions ?
Please refer to the [Backport tool
documentation](https://github.com/sqren/backport)

<!--BACKPORT
[{"author":{"name":"Ash","email":"1849116+ashokaditya@users.noreply.github.com"},"sourceCommit":{"committedDate":"2023-09-04T07:43:47Z","message":"[Security
Solution][Endpoint] Fix and unskip flaky test (#165466)\n\n##
Summary\r\n\r\nFixes and un-skips a test. Ensures that the test data
doesn't create an\r\nexisting index. If it still does, as a temp.
measure we're dismissing\r\nthe error toast that is blocking the button
so the rest of the test can\r\ncontinue.\r\n\r\ncloses
elastic/kibana/issues/139260\r\n\r\n**flakey test
runner**\r\n\r\nhttps://buildkite.com/elastic/kibana-flaky-test-suite-runner/builds/3036\r\nx
200 ( all green)\r\n\r\n### Checklist\r\n\r\n- [x] [Unit or
functional\r\ntests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)\r\nwere
updated or added to match the most common
scenarios","sha":"ada6671165ecfc2c27014fa0aa43c58ed8e965df","branchLabelMapping":{"^v8.11.0$":"main","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["release_note:skip","Team:Defend
Workflows","OLM
Sprint","v8.10.0","v8.11.0"],"number":165466,"url":"https://github.com/elastic/kibana/pull/165466","mergeCommit":{"message":"[Security
Solution][Endpoint] Fix and unskip flaky test (#165466)\n\n##
Summary\r\n\r\nFixes and un-skips a test. Ensures that the test data
doesn't create an\r\nexisting index. If it still does, as a temp.
measure we're dismissing\r\nthe error toast that is blocking the button
so the rest of the test can\r\ncontinue.\r\n\r\ncloses
elastic/kibana/issues/139260\r\n\r\n**flakey test
runner**\r\n\r\nhttps://buildkite.com/elastic/kibana-flaky-test-suite-runner/builds/3036\r\nx
200 ( all green)\r\n\r\n### Checklist\r\n\r\n- [x] [Unit or
functional\r\ntests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)\r\nwere
updated or added to match the most common
scenarios","sha":"ada6671165ecfc2c27014fa0aa43c58ed8e965df"}},"sourceBranch":"main","suggestedTargetBranches":["8.10"],"targetPullRequestStates":[{"branch":"8.10","label":"v8.10.0","labelRegex":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"},{"branch":"main","label":"v8.11.0","labelRegex":"^v8.11.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/165466","number":165466,"mergeCommit":{"message":"[Security
Solution][Endpoint] Fix and unskip flaky test (#165466)\n\n##
Summary\r\n\r\nFixes and un-skips a test. Ensures that the test data
doesn't create an\r\nexisting index. If it still does, as a temp.
measure we're dismissing\r\nthe error toast that is blocking the button
so the rest of the test can\r\ncontinue.\r\n\r\ncloses
elastic/kibana/issues/139260\r\n\r\n**flakey test
runner**\r\n\r\nhttps://buildkite.com/elastic/kibana-flaky-test-suite-runner/builds/3036\r\nx
200 ( all green)\r\n\r\n### Checklist\r\n\r\n- [x] [Unit or
functional\r\ntests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)\r\nwere
updated or added to match the most common
scenarios","sha":"ada6671165ecfc2c27014fa0aa43c58ed8e965df"}}]}]
BACKPORT-->

Co-authored-by: Ash <1849116+ashokaditya@users.noreply.github.com>
This commit is contained in:
Kibana Machine 2023-09-04 05:01:59 -04:00 committed by GitHub
parent cba05aa082
commit dc725140c2
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 13 additions and 5 deletions

View file

@ -127,14 +127,17 @@ const ensureEndpointRuleAlertsIndexExists = async (esClient: Client): Promise<vo
indexMappings.mappings._meta.kibana.version = kibanaPackageJson.version;
}
const doesIndexExist = await esClient.indices.exists({ index: indexMappings.index });
if (doesIndexExist) {
return;
}
try {
await esClient.indices.create({
index: indexMappings.index,
body: {
settings: indexMappings.settings,
mappings: indexMappings.mappings,
aliases: indexMappings.aliases,
},
settings: indexMappings.settings,
mappings: indexMappings.mappings,
aliases: indexMappings.aliases,
});
} catch (error) {
// ignore error that indicate index is already created

View file

@ -182,6 +182,11 @@ export default ({ getPageObjects, getService }: FtrProviderContext) => {
// Show event/alert details for the first one in the list
await pageObjects.timeline.showEventDetails();
// TODO: The index already exists error toast should not show up
// close and dismiss it if it does
if (await testSubjects.exists('globalToastList')) {
await testSubjects.click('toastCloseButton');
}
// Click responder from the take action button
await testSubjects.click('take-action-dropdown-btn');
await testSubjects.clickWhenNotDisabled('endpointResponseActions-action-item');