[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) |
alisonelizabeth
left a comment
There was a problem hiding this comment.
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.
We determined that it is not best practice to use the waitFor helper in tests.
There was a problem hiding this comment.
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? |
alisonelizabeth
left a comment
There was a problem hiding this comment.
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.
| ({ 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.
Can you uncomment this line for now?
There was a problem hiding this comment.
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: