Skip to content

Commit

Permalink
[Security Solution][Endpoint] Fix and unskip flaky test (elastic#165466)
Browse files Browse the repository at this point in the history
## Summary

Fixes and un-skips a test. Ensures that the test data doesn't create an
existing index. If it still does, as a temp. measure we're dismissing
the error toast that is blocking the button so the rest of the test can
continue.

closes elastic/issues/139260

**flakey test runner**

https://buildkite.com/elastic/kibana-flaky-test-suite-runner/builds/3036
x 200 ( all green)

### Checklist

- [x] [Unit or functional
tests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)
were updated or added to match the most common scenarios
  • Loading branch information
ashokaditya authored and sphilipse committed Sep 4, 2023
1 parent e4b9f12 commit 20729ba
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,8 +81,7 @@ export default ({ getPageObjects, getService }: FtrProviderContext) => {
);
};

// Failing: See https://github.com/elastic/kibana/issues/139260
describe.skip('Response Actions Responder', function () {
describe('Response Actions Responder', function () {
let indexedData: IndexedHostsAndAlertsResponse;
let endpointAgentId: string;

Expand Down Expand Up @@ -183,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');
Expand Down

0 comments on commit 20729ba

Please sign in to comment.