-
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
[ML] Fix flaky update_groups api test #161326
[ML] Fix flaky update_groups api test #161326
Conversation
Pinging @elastic/ml-ui (:ml) |
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.
I'm wondering if this extra step is actually needed in all the places. A usual after
block looks like this:
await spacesService.delete(idSpace1);
await spacesService.delete(idSpace2);
await ml.api.cleanMlIndices();
await ml.testResources.cleanMLSavedObjects();
Since we delete the created spaces first, the should be no saved objects left to clean in these spaces anymore (unless we do things behind the scenes there on space delete that I'm not aware of). The cleanMLSavedObjects
method was introduced because we can't delete the default
space to clean up.
However, it doesn't hurt in these places and is actually needed for situations where we run multiple tests in the same space setup and clean saved objects during afterEach
and only remove spaces in the after
block.
Having said that, I leave it to you whether or not to remove the optional spaces parameter from the cleanMLSavedObjects
call where we've already cleaned up the spaces. I'm fine either way.
}, | ||
|
||
async cleanMLJobSavedObjects() { | ||
async cleanMLJobSavedObjects(space?: string) { |
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.
The deleteSavedObjectById
call in this method should pass through the space
.
This is a good point, and looking at it again I think the problem might actually be the tests in I'll see if creating and deleting the spaces in the before and after also fixes the flakiness and if so, revert a lot the calls to |
💚 Build Succeeded
Metrics [docs]
History
To update your PR or re-run it, just comment with: |
@pheyos I've made changes so now I'm only calling |
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.
Code LGTM
Related to elastic#161324 and elastic#160370 Flaky test runner https://buildkite.com/elastic/kibana-flaky-test-suite-runner/builds/2649 I believe the problem lies with the function `cleanMLSavedObjects` only cleaning up saved objects in the default space and not in any other of the spaces which jobs or trained models may have been added to. This causes an intermittent clash where a job's saved object already exists, but is in a different space. I don't know why this doesn't fail on every run. The fix is to update `cleanMLSavedObjects` so it can take a list of additional space IDs to also clean. Any test which adds jobs or trained models to spaces other than `default` need to call this function and supply the list of space IDs it is using. I've updated every test I could find in this PR.
Related to #161324 and #160370
Flaky test runner https://buildkite.com/elastic/kibana-flaky-test-suite-runner/builds/2649
I believe the problem lies with the function
cleanMLSavedObjects
only cleaning up saved objects in the default space and not in any other of the spaces which jobs or trained models may have been added to.This causes an intermittent clash where a job's saved object already exists, but is in a different space. I don't know why this doesn't fail on every run.
The fix is to update
cleanMLSavedObjects
so it can take a list of additional space IDs to also clean. Any test which adds jobs or trained models to spaces other thandefault
need to call this function and supply the list of space IDs it is using.I've updated every test I could find in this PR.