Skip to content

Commit

Permalink
Unskips tests by adding additional checks that should reduce flakines…
Browse files Browse the repository at this point in the history
…s. One test that failed was due to a promition issue
  • Loading branch information
FrankHassanabad committed Jul 20, 2020
1 parent 11182c8 commit 18e76dc
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,15 @@ import {
deleteAllAlerts,
deleteAllTimelines,
deleteSignalsIndex,
waitFor,
} from '../../utils';

// eslint-disable-next-line import/no-default-export
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
Expand Down Expand Up @@ -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 an
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')
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,15 @@ import {
deleteAllAlerts,
deleteAllTimelines,
deleteSignalsIndex,
waitFor,
} from '../../utils';

// eslint-disable-next-line import/no-default-export
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
Expand Down Expand Up @@ -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 an
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')
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 18e76dc

Please sign in to comment.