[8.6] [Cases] Fix flaky delete case test (#150476) (#150560)

# Backport

This will backport the following commits from `main` to `8.6`:
- [[Cases] Fix flaky delete case test
(#150476)](https://github.com/elastic/kibana/pull/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>
This commit is contained in:
Kibana Machine 2023-02-08 15:03:43 -05:00 committed by GitHub
parent a4db3e937d
commit 10ed683e56
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -36,8 +36,8 @@ 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) {
@ -45,17 +45,14 @@ export function CasesAPIServiceProvider({ getService }: FtrProviderContext) {
{ 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({