Skip to content

Commit

Permalink
Fixing flaky find tests (#183746)
Browse files Browse the repository at this point in the history
Resolves #182263
Resolves #182284
Resolves #182314

## Summary

Missing `await` in the backfill tests caused a rule created for those
tests not to finish getting deleted before the `find` tests ran

---------

Co-authored-by: Kibana Machine <[email protected]>
  • Loading branch information
ymao1 and kibanamachine authored May 20, 2024
1 parent 79b8bab commit 8289548
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ export default function createBackfillTaskRunnerTests({ getService }: FtrProvide
await esTestIndexTool.setup();
});
afterEach(async () => {
objectRemover.removeAll();
await objectRemover.removeAll();
await esTestIndexTool.destroy();
});
after(async () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,10 @@ const findTestUtils = (
supertest: SuperTestAgent,
supertestWithoutAuth: any
) => {
describe.skip(describeType, () => {
afterEach(() => objectRemover.removeAll());
describe(describeType, () => {
afterEach(async () => {
await objectRemover.removeAll();
});

for (const scenario of UserAtSpaceScenarios) {
const { user, space } = scenario;
Expand Down Expand Up @@ -651,12 +653,12 @@ export default function createFindTests({ getService }: FtrProviderContext) {
const supertest = getService('supertest');
const supertestWithoutAuth = getService('supertestWithoutAuth');

// Failing: See https://github.com/elastic/kibana/issues/182263
// Failing: See https://github.com/elastic/kibana/issues/182284
describe.skip('find', () => {
describe('find', () => {
const objectRemover = new ObjectRemover(supertest);

afterEach(() => objectRemover.removeAll());
afterEach(async () => {
await objectRemover.removeAll();
});

findTestUtils('public', objectRemover, supertest, supertestWithoutAuth);
findTestUtils('internal', objectRemover, supertest, supertestWithoutAuth);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,14 @@ const findTestUtils = (
supertest: SuperTestAgent,
supertestWithoutAuth: any
) => {
// FLAKY: https://github.com/elastic/kibana/issues/182314
describe.skip(describeType, () => {
afterEach(() => objectRemover.removeAll());
describe(describeType, () => {
afterEach(async () => {
await objectRemover.removeAll();
});

for (const scenario of UserAtSpaceScenarios) {
const { user, space } = scenario;
// FLAKY: https://github.com/elastic/kibana/issues/182314
describe.skip(scenario.id, () => {
describe(scenario.id, () => {
it('should handle find alert request appropriately', async () => {
const { body: createdAlert } = await supertest
.post(`${getUrlPrefix(space.id)}/api/alerting/rule`)
Expand Down Expand Up @@ -581,7 +581,9 @@ export default function createFindTests({ getService }: FtrProviderContext) {
describe('find with post', () => {
const objectRemover = new ObjectRemover(supertest);

afterEach(() => objectRemover.removeAll());
afterEach(async () => {
await objectRemover.removeAll();
});

findTestUtils('internal', objectRemover, supertest, supertestWithoutAuth);
});
Expand Down

0 comments on commit 8289548

Please sign in to comment.