Skip to content

Commit

Permalink
[Cases] Fix flaky delete case test (#150476)
Browse files Browse the repository at this point in the history
This PR adds some `await` to functions that might have been causing
flakiness for some of our end to end tests.

Fixes: #145502

Flaky test run:
https://buildkite.com/elastic/kibana-flaky-test-suite-runner/builds/1878
  • Loading branch information
jonathan-buttner authored Feb 8, 2023
1 parent 6a617e4 commit 9bf320f
Showing 1 changed file with 7 additions and 10 deletions.
17 changes: 7 additions & 10 deletions x-pack/test/functional/services/cases/api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,26 +36,23 @@ export function CasesAPIServiceProvider({ getService }: FtrProviderContext) {
...generateRandomCaseWithoutConnector(),
...overwrites,
} as CasePostRequest;
const res = await createCaseAPI(kbnSupertest, caseData);
return res;

return createCaseAPI(kbnSupertest, caseData);
},

async createNthRandomCases(amount: number = 3) {
const cases: CasePostRequest[] = Array.from(
{ length: amount },
() => generateRandomCaseWithoutConnector() as CasePostRequest
);
await pMap(
cases,
(caseData) => {
return createCaseAPI(kbnSupertest, caseData);
},
{ concurrency: 4 }
);

await pMap(cases, async (caseData) => createCaseAPI(kbnSupertest, caseData), {
concurrency: 4,
});
},

async deleteAllCases() {
deleteAllCaseItems(es);
await deleteAllCaseItems(es);
},

async createAttachment({
Expand Down

0 comments on commit 9bf320f

Please sign in to comment.