Skip to content

Commit

Permalink
[8.6] [Cases] Fix flaky delete case test (#150476) (#150560)
Browse files Browse the repository at this point in the history
# Backport

This will backport the following commits from `main` to `8.6`:
- [[Cases] Fix flaky delete case test
(#150476)](#150476)

<!--- Backport version: 8.9.7 -->

### Questions ?
Please refer to the [Backport tool
documentation](https://github.com/sqren/backport)

<!--BACKPORT [{"author":{"name":"Jonathan
Buttner","email":"56361221+jonathan-buttner@users.noreply.github.com"},"sourceCommit":{"committedDate":"2023-02-08T14:02:56Z","message":"[Cases]
Fix flaky delete case test (#150476)\n\nThis PR adds some `await` to
functions that might have been causing\r\nflakiness for some of our end
to end tests.\r\n\r\nFixes:
https://github.com/elastic/kibana/issues/145502\r\n\r\nFlaky test
run:\r\nhttps://buildkite.com/elastic/kibana-flaky-test-suite-runner/builds/1878","sha":"9bf320f8f6a4552f96ea470679f3835d16f7e31b","branchLabelMapping":{"^v8.7.0$":"main","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["release_note:skip","Team:ResponseOps","Feature:Cases","v8.7.0","v8.6.2"],"number":150476,"url":"https://github.com/elastic/kibana/pull/150476","mergeCommit":{"message":"[Cases]
Fix flaky delete case test (#150476)\n\nThis PR adds some `await` to
functions that might have been causing\r\nflakiness for some of our end
to end tests.\r\n\r\nFixes:
https://github.com/elastic/kibana/issues/145502\r\n\r\nFlaky test
run:\r\nhttps://buildkite.com/elastic/kibana-flaky-test-suite-runner/builds/1878","sha":"9bf320f8f6a4552f96ea470679f3835d16f7e31b"}},"sourceBranch":"main","suggestedTargetBranches":["8.6"],"targetPullRequestStates":[{"branch":"main","label":"v8.7.0","labelRegex":"^v8.7.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/150476","number":150476,"mergeCommit":{"message":"[Cases]
Fix flaky delete case test (#150476)\n\nThis PR adds some `await` to
functions that might have been causing\r\nflakiness for some of our end
to end tests.\r\n\r\nFixes:
https://github.com/elastic/kibana/issues/145502\r\n\r\nFlaky test
run:\r\nhttps://buildkite.com/elastic/kibana-flaky-test-suite-runner/builds/1878","sha":"9bf320f8f6a4552f96ea470679f3835d16f7e31b"}},{"branch":"8.6","label":"v8.6.2","labelRegex":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"}]}]
BACKPORT-->

Co-authored-by: Jonathan Buttner <56361221+jonathan-buttner@users.noreply.github.com>
  • Loading branch information
kibanamachine and jonathan-buttner authored Feb 8, 2023
1 parent a4db3e9 commit 10ed683
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 10ed683

Please sign in to comment.