[8.x] [APM] Attempt to fix APMEventClient unit test (#193049) (#193168)

# Backport

This will backport the following commits from `main` to `8.x`:
- [[APM] Attempt to fix APMEventClient unit test
(#193049)](https://github.com/elastic/kibana/pull/193049)

<!--- Backport version: 9.4.3 -->

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

<!--BACKPORT [{"author":{"name":"Carlos
Crespo","email":"crespocarlos@users.noreply.github.com"},"sourceCommit":{"committedDate":"2024-09-17T13:25:34Z","message":"[APM]
Attempt to fix APMEventClient unit test (#193049)\n\nfixes
https://github.com/elastic/kibana/issues/190703\r\n\r\n##
Summary\r\n\r\nThe problem seems to be on the `void` keyword used when
calling\r\n`incomingRequest.abort()`.\r\n\r\nI ran a few tests changing
the `setTimeout` interval with and without\r\nusing the `void` keyword,
and the test always passed when running\r\nwithout
it.\r\n\r\nCo-authored-by: Elastic Machine
<elasticmachine@users.noreply.github.com>","sha":"f4fe0bdaabaf8a8fddfc1d498743bd8a03c557e0","branchLabelMapping":{"^v9.0.0$":"main","^v8.16.0$":"8.x","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["release_note:skip","v9.0.0","backport:prev-minor","ci:project-deploy-observability","Team:obs-ux-infra_services","v8.16.0"],"title":"[APM]
Attempt to fix APMEventClient unit
test","number":193049,"url":"https://github.com/elastic/kibana/pull/193049","mergeCommit":{"message":"[APM]
Attempt to fix APMEventClient unit test (#193049)\n\nfixes
https://github.com/elastic/kibana/issues/190703\r\n\r\n##
Summary\r\n\r\nThe problem seems to be on the `void` keyword used when
calling\r\n`incomingRequest.abort()`.\r\n\r\nI ran a few tests changing
the `setTimeout` interval with and without\r\nusing the `void` keyword,
and the test always passed when running\r\nwithout
it.\r\n\r\nCo-authored-by: Elastic Machine
<elasticmachine@users.noreply.github.com>","sha":"f4fe0bdaabaf8a8fddfc1d498743bd8a03c557e0"}},"sourceBranch":"main","suggestedTargetBranches":["8.x"],"targetPullRequestStates":[{"branch":"main","label":"v9.0.0","branchLabelMappingKey":"^v9.0.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/193049","number":193049,"mergeCommit":{"message":"[APM]
Attempt to fix APMEventClient unit test (#193049)\n\nfixes
https://github.com/elastic/kibana/issues/190703\r\n\r\n##
Summary\r\n\r\nThe problem seems to be on the `void` keyword used when
calling\r\n`incomingRequest.abort()`.\r\n\r\nI ran a few tests changing
the `setTimeout` interval with and without\r\nusing the `void` keyword,
and the test always passed when running\r\nwithout
it.\r\n\r\nCo-authored-by: Elastic Machine
<elasticmachine@users.noreply.github.com>","sha":"f4fe0bdaabaf8a8fddfc1d498743bd8a03c557e0"}},{"branch":"8.x","label":"v8.16.0","branchLabelMappingKey":"^v8.16.0$","isSourceBranch":false,"state":"NOT_CREATED"}]}]
BACKPORT-->

Co-authored-by: Carlos Crespo <crespocarlos@users.noreply.github.com>
This commit is contained in:
Kibana Machine 2024-09-18 19:20:43 +10:00 committed by GitHub
parent 137ed13f96
commit 4b862c0794
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -76,8 +76,9 @@ describe('APMEventClient', () => {
resolve(undefined);
}, 100);
});
void incomingRequest.abort();
}, 100);
}, 200);
});
expect(abortSignal?.aborted).toBe(true);