Skip to content

Commit

Permalink
[Security Solutions] Fixes 11 different flakey FTR/e2e tests and scen…
Browse files Browse the repository at this point in the history
…arios (#115688)

## Summary

Fixes flakes across tests that have either been skipped or have been a source of flake in the categories of:
* Sorting fixes because Elasticsearch can return hits/arrays back in different orders
* Flat array fixes because Elasticsearch can sometimes return `[]` or `[[]]` in-deterministically in some cases 🤷 , so we just flatten the array out completely and test for `[]` within those tests.
* `waitForSignalsToBePresent` was missing in a test and sometimes we would get an empty array response which would fail CI.

Also I audited other tests for `[[]]` and `waitForSignalsToBePresent` and fixed them where they were present or if the `waitForSignalsToBePresent` count was incorrect. This should give us more stability when the CI is under pressure.

Sorting fixes:
#115554
#115321
#115319
#114581


Flat array fixes:
#89052
#115315
#115308
#115304
#115313
#113418

Missing additional check for "waitForSignalsToBePresent" or incorrect number of signals to wait for fixes:
#115310


### 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
FrankHassanabad authored and kibanamachine committed Oct 20, 2021
1 parent 5744be6 commit 711c67c
Show file tree
Hide file tree
Showing 9 changed files with 150 additions and 134 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -51,9 +51,9 @@ export default ({ getService }: FtrProviderContext) => {
await waitForRuleSuccessOrStatus(supertest, id);
await waitForSignalsToBePresent(supertest, 4, [id]);
const signalsOpen = await getSignalsById(supertest, id);
const hits = signalsOpen.hits.hits.map(
(signal) => (signal._source?.host_alias as HostAlias).name
);
const hits = signalsOpen.hits.hits
.map((signal) => (signal._source?.host_alias as HostAlias).name)
.sort();
expect(hits).to.eql(['host name 1', 'host name 2', 'host name 3', 'host name 4']);
});

Expand All @@ -63,7 +63,9 @@ export default ({ getService }: FtrProviderContext) => {
await waitForRuleSuccessOrStatus(supertest, id);
await waitForSignalsToBePresent(supertest, 4, [id]);
const signalsOpen = await getSignalsById(supertest, id);
const hits = signalsOpen.hits.hits.map((signal) => (signal._source?.host as HostAlias).name);
const hits = signalsOpen.hits.hits
.map((signal) => (signal._source?.host as HostAlias).name)
.sort();
expect(hits).to.eql(['host name 1', 'host name 2', 'host name 3', 'host name 4']);
});
});
Expand Down
Loading

0 comments on commit 711c67c

Please sign in to comment.