Skip to content

Commit

Permalink
[8.x] [APM] Attempt to fix APMEventClient unit test (#193049) (#193168)
Browse files Browse the repository at this point in the history
# Backport

This will backport the following commits from `main` to `8.x`:
- [[APM] Attempt to fix APMEventClient unit test
(#193049)](#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>
  • Loading branch information
kibanamachine and crespocarlos authored Sep 18, 2024
1 parent 137ed13 commit 4b862c0
Showing 1 changed file with 2 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -76,8 +76,9 @@ describe('APMEventClient', () => {
resolve(undefined);
}, 100);
});

void incomingRequest.abort();
}, 100);
}, 200);
});

expect(abortSignal?.aborted).toBe(true);
Expand Down

0 comments on commit 4b862c0

Please sign in to comment.