-
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
[Remote clusters] Reorganize test files #82362
[Remote clusters] Reorganize test files #82362
Conversation
- Colocate helpers with test files. - Remove default API responses from HTTP response mocking functions to make behavior clearer at call sites.
Pinging @elastic/es-ui (Team:Elasticsearch UI) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for taking this on @cjcenizal!
I left a comment in the code regarding the use of waitFor
- @sebelga determined that it is not good practice to use this anymore in tests. I opened #82393 to update the test_utils
readme with some best practices that Seb shared awhile back.
I think the remote clusters component integration tests as a whole probably need to be refactored to fix the flakiness and remove the use of waitFor
introduced in #58768. I'm happy to take this over if you like. I recently did similar work for the ingest node pipeline tests in #78838.
|
||
beforeEach(async () => { | ||
({ exists, component } = setup()); | ||
({ waitFor, exists } = setup()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We determined that it is not best practice to use the waitFor
helper in tests.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yep, no more waitFor
in our jest tests 🙏
This reverts commit 8ee1674.
@elasticmachine merge upstream |
Thanks @alisonelizabeth! I reverted that commit, so this PR is now limited to reorganizing the test files only. Could you please take another look? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @cjcenizal! The reorganization LGTM. I'm approving to not block you, but I think there is one line (left a comment) that should be reverted until a better assessment is made as to what needs to be refactored in the tests.
@@ -56,7 +49,7 @@ describe('<RemoteClusterList />', () => { | |||
beforeEach(async () => { | |||
({ exists, component } = setup()); | |||
|
|||
await nextTick(100); // We need to wait next tick for the mock server response to kick in | |||
// await nextTick(100); // We need to wait next tick for the mock server response to kick in |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you uncomment this line for now?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good catch, that was a leftover!
💚 Build SucceededMetrics [docs]
History
To update your PR or re-run it, just comment with: |
I reorganized the test files to improve readability in two ways: