[SIEM][Detection Engine] Reduces flakiness within the tests using waitFor() and un-skips the tests (#72479)
## Summary * Utilizes the `waitFor` so that the tests are less flaky and more resilient * Unskips a test that was due to a regression within Elastic Search that should be fixed now * https://github.com/elastic/kibana/issues/71867 * https://github.com/elastic/kibana/issues/71814 * https://github.com/elastic/kibana/issues/71612 ### Checklist Delete any items that are not applicable to this PR. - [x] [Unit or functional tests](https://github.com/elastic/kibana/blob/master/CONTRIBUTING.md#cross-browser-compatibility) were updated or added to match the most common scenarios
This commit is contained in:
parent
2771d69c96
commit
3ccdd79aa7
|
@ -13,6 +13,7 @@ import {
|
|||
deleteAllAlerts,
|
||||
deleteAllTimelines,
|
||||
deleteSignalsIndex,
|
||||
waitFor,
|
||||
} from '../../utils';
|
||||
|
||||
// eslint-disable-next-line import/no-default-export
|
||||
|
@ -20,8 +21,7 @@ export default ({ getService }: FtrProviderContext): void => {
|
|||
const supertest = getService('supertest');
|
||||
const es = getService('es');
|
||||
|
||||
// FLAKY: https://github.com/elastic/kibana/issues/71867
|
||||
describe.skip('add_prepackaged_rules', () => {
|
||||
describe('add_prepackaged_rules', () => {
|
||||
describe('validation errors', () => {
|
||||
it('should give an error that the index must exist first if it does not exist before adding prepackaged rules', async () => {
|
||||
const { body } = await supertest
|
||||
|
@ -91,6 +91,16 @@ export default ({ getService }: FtrProviderContext): void => {
|
|||
.send()
|
||||
.expect(200);
|
||||
|
||||
// NOTE: I call the GET call until eventually it becomes consistent and that the number of rules to install are zero.
|
||||
// This is to reduce flakiness where it can for a short period of time try to install the same rule twice.
|
||||
await waitFor(async () => {
|
||||
const { body } = await supertest
|
||||
.get(`${DETECTION_ENGINE_PREPACKAGED_URL}/_status`)
|
||||
.set('kbn-xsrf', 'true')
|
||||
.expect(200);
|
||||
return body.rules_not_installed === 0;
|
||||
});
|
||||
|
||||
const { body } = await supertest
|
||||
.put(DETECTION_ENGINE_PREPACKAGED_URL)
|
||||
.set('kbn-xsrf', 'true')
|
||||
|
|
|
@ -13,6 +13,7 @@ import {
|
|||
deleteAllAlerts,
|
||||
deleteAllTimelines,
|
||||
deleteSignalsIndex,
|
||||
waitFor,
|
||||
} from '../../utils';
|
||||
|
||||
// eslint-disable-next-line import/no-default-export
|
||||
|
@ -20,8 +21,7 @@ export default ({ getService }: FtrProviderContext): void => {
|
|||
const supertest = getService('supertest');
|
||||
const es = getService('es');
|
||||
|
||||
// FLAKY: https://github.com/elastic/kibana/issues/71814
|
||||
describe.skip('add_prepackaged_rules', () => {
|
||||
describe('add_prepackaged_rules', () => {
|
||||
describe('validation errors', () => {
|
||||
it('should give an error that the index must exist first if it does not exist before adding prepackaged rules', async () => {
|
||||
const { body } = await supertest
|
||||
|
@ -91,6 +91,16 @@ export default ({ getService }: FtrProviderContext): void => {
|
|||
.send()
|
||||
.expect(200);
|
||||
|
||||
// NOTE: I call the GET call until eventually it becomes consistent and that the number of rules to install are zero.
|
||||
// This is to reduce flakiness where it can for a short period of time try to install the same rule the same rule twice.
|
||||
await waitFor(async () => {
|
||||
const { body } = await supertest
|
||||
.get(`${DETECTION_ENGINE_PREPACKAGED_URL}/_status`)
|
||||
.set('kbn-xsrf', 'true')
|
||||
.expect(200);
|
||||
return body.rules_not_installed === 0;
|
||||
});
|
||||
|
||||
const { body } = await supertest
|
||||
.put(DETECTION_ENGINE_PREPACKAGED_URL)
|
||||
.set('kbn-xsrf', 'true')
|
||||
|
|
|
@ -29,8 +29,7 @@ export default ({ getService }: FtrProviderContext): void => {
|
|||
const supertest = getService('supertest');
|
||||
const es = getService('es');
|
||||
|
||||
// Failing ES promotion: https://github.com/elastic/kibana/issues/71612
|
||||
describe.skip('create_rules_bulk', () => {
|
||||
describe('create_rules_bulk', () => {
|
||||
describe('validation errors', () => {
|
||||
it('should give a 200 even if the index does not exist as all bulks return a 200 but have an error of 409 bad request in the body', async () => {
|
||||
const { body } = await supertest
|
||||
|
|
Loading…
Reference in a new issue