Skip to content

Commit 7fe71b3

Browse files
authored
[Detection Engine][Test Fix] Ensure that alerts are absent before loading our alerts archive (#222691)
## Summary This test has [failed a few times recently](#219112) with a `version_conflict_engine_exception`, stating explicitly that the documents we're trying to load already exist in elasticsearch. In one case the reason was obvious (the suite was retried), but in another it was not clear why the data was there to cause this exception. Regardless, adding this sanity check (deleting all the alerts) should ensure that this behavior does not recur. Closes #219112. - [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 - [x] [Flaky Test Runner](https://ci-stats.kibana.dev/trigger_flaky_test_runner/1) was used on any tests changed ([200x](https://buildkite.com/elastic/kibana-flaky-test-suite-runner/builds/8329)) - [x] The PR description includes the appropriate Release Notes section, and the correct `release_note:*` label is applied per the [guidelines](https://www.elastic.co/guide/en/kibana/master/contributing.html#kibana-release-notes-process)
1 parent 61a4466 commit 7fe71b3

File tree

1 file changed

+6
-0
lines changed
  • x-pack/test/security_solution_api_integration/test_suites/detections_response/detection_engine/alerts/trial_license_complete_tier

1 file changed

+6
-0
lines changed

x-pack/test/security_solution_api_integration/test_suites/detections_response/detection_engine/alerts/trial_license_complete_tier/document_level_security.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ import expect from '@kbn/expect';
99

1010
import { DETECTION_ENGINE_QUERY_SIGNALS_URL } from '@kbn/security-solution-plugin/common/constants';
1111
import { FtrProviderContext } from '../../../../../ftr_provider_context';
12+
import { deleteAllAlerts } from '../../../../../../common/utils/security_solution';
1213

1314
const roleToAccessSecuritySolution = {
1415
name: 'sec_all_spaces',
@@ -73,6 +74,10 @@ export default ({ getService }: FtrProviderContext) => {
7374
const supertestWithoutAuth = getService('supertestWithoutAuth');
7475
const esArchiver = getService('esArchiver');
7576
const security = getService('security');
77+
const supertest = getService('supertest');
78+
const log = getService('log');
79+
const es = getService('es');
80+
7681
// Notes: Similar tests should be added for serverless once infrastructure
7782
// is in place to test roles in MKI enviornment.
7883
describe('@ess @skipInServerless find alert with/without doc level security', () => {
@@ -98,6 +103,7 @@ export default ({ getService }: FtrProviderContext) => {
98103
email: userAllSecWithDls.email,
99104
});
100105

106+
await deleteAllAlerts(supertest, log, es);
101107
await esArchiver.load(
102108
'x-pack/test/functional/es_archives/security_solution/alerts/8.8.0_multiple_docs',
103109
{

0 commit comments

Comments
 (0)