-
Notifications
You must be signed in to change notification settings - Fork 8.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix flaky Jest test on generateVulnerabilitiesRuleQuery #195681
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Pinging @elastic/kibana-cloud-security-posture (Team:Cloud Security) |
opauloh
added
v9.0.0
v8.16.0
backport:version
Backport to applied version labels
release_note:skip
Skip the PR/issue when compiling release notes
labels
Oct 9, 2024
opauloh
changed the title
fix flaky test with timestamp
Fix flaky Jest test on generateVulnerabilitiesRuleQuery
Oct 9, 2024
kfirpeled
approved these changes
Oct 9, 2024
Starting backport for target branches: 8.x |
💚 Build Succeeded
Metrics [docs]Async chunks
|
kibanamachine
pushed a commit
to kibanamachine/kibana
that referenced
this pull request
Oct 10, 2024
## Summary It fixes the flaky test raised on elastic#195634 by adding the possibility to pass the timestamp to the function. That helps to eliminate flakiness, by passing the same `currentTimestamp` to both the test and the function. Also, it's a simpler approach that doesn't require mocking global objects or using Jest's fake timers, keeping your test straightforward and easy to understand. (cherry picked from commit b51ba0a)
💚 All backports created successfully
Note: Successful backport PRs will be merged automatically after passing CI. Questions ?Please refer to the Backport tool documentation |
kibanamachine
added a commit
that referenced
this pull request
Oct 10, 2024
# Backport This will backport the following commits from `main` to `8.x`: - [fix flaky test with timestamp (#195681)](#195681) <!--- Backport version: 9.4.3 --> ### Questions ? Please refer to the [Backport tool documentation](https://github.com/sqren/backport) <!--BACKPORT [{"author":{"name":"Paulo Silva","email":"[email protected]"},"sourceCommit":{"committedDate":"2024-10-10T00:36:33Z","message":"fix flaky test with timestamp (#195681)\n\n## Summary\r\n\r\nIt fixes the flaky test raised on #195634 by adding the possibility to\r\npass the timestamp to the function. That helps to eliminate flakiness,\r\nby passing the same `currentTimestamp` to both the test and the\r\nfunction. Also, it's a simpler approach that doesn't require mocking\r\nglobal objects or using Jest's fake timers, keeping your test\r\nstraightforward and easy to understand.","sha":"b51ba0a27c852f967b922130d01ac7cf2ec11d64","branchLabelMapping":{"^v9.0.0$":"main","^v8.16.0$":"8.x","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["release_note:skip","v9.0.0","Team:Cloud Security","v8.16.0","backport:version"],"title":"Fix flaky Jest test on generateVulnerabilitiesRuleQuery","number":195681,"url":"https://github.com/elastic/kibana/pull/195681","mergeCommit":{"message":"fix flaky test with timestamp (#195681)\n\n## Summary\r\n\r\nIt fixes the flaky test raised on #195634 by adding the possibility to\r\npass the timestamp to the function. That helps to eliminate flakiness,\r\nby passing the same `currentTimestamp` to both the test and the\r\nfunction. Also, it's a simpler approach that doesn't require mocking\r\nglobal objects or using Jest's fake timers, keeping your test\r\nstraightforward and easy to understand.","sha":"b51ba0a27c852f967b922130d01ac7cf2ec11d64"}},"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/195681","number":195681,"mergeCommit":{"message":"fix flaky test with timestamp (#195681)\n\n## Summary\r\n\r\nIt fixes the flaky test raised on #195634 by adding the possibility to\r\npass the timestamp to the function. That helps to eliminate flakiness,\r\nby passing the same `currentTimestamp` to both the test and the\r\nfunction. Also, it's a simpler approach that doesn't require mocking\r\nglobal objects or using Jest's fake timers, keeping your test\r\nstraightforward and easy to understand.","sha":"b51ba0a27c852f967b922130d01ac7cf2ec11d64"}},{"branch":"8.x","label":"v8.16.0","branchLabelMappingKey":"^v8.16.0$","isSourceBranch":false,"state":"NOT_CREATED"}]}] BACKPORT--> Co-authored-by: Paulo Silva <[email protected]>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
backport:version
Backport to applied version labels
release_note:skip
Skip the PR/issue when compiling release notes
Team:Cloud Security
Cloud Security team related
v8.16.0
v9.0.0
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary
It fixes the flaky test raised on #195634 by adding the possibility to pass the timestamp to the function. That helps to eliminate flakiness, by passing the same
currentTimestamp
to both the test and the function. Also, it's a simpler approach that doesn't require mocking global objects or using Jest's fake timers, keeping your test straightforward and easy to understand.