-
Notifications
You must be signed in to change notification settings - Fork 8.2k
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
[ILM] Fix detection of "migrate.enabled: false" #81642
[ILM] Fix detection of "migrate.enabled: false" #81642
Conversation
- with jest tests see origin here: elastic#81642
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.
Tested locally, code LGTM. I'll merge this once CI is green so it can ship with 7.10. @jloleysens I think the comments I left are worth considering incorporating into master and 7.x.
}); | ||
test('showing "default" type', () => { | ||
const { find } = testBed; | ||
expect(find('warm-dataTierAllocationControls.dataTierSelect').text()).toContain( |
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.
Instead of calling find('warm-dataTierAllocationControls.dataTierSelect').text()
three times can we store its return value in a variable and refer to that in our assertions?
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.
Instead of using toContain
can we use toBe
and be 100% explicit about the expected text value in each assertion, too?
And if we do this then we won't need to the last two assertions, I think?
const { component } = testBed; | ||
component.update(); | ||
}); | ||
test('showing "default" type', () => { |
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.
Nit: I had to read this a couple times to connect it to the assertions being made. Might be clearer if it's something like, "interprets absence of allocate and migrate configurations as default node role allocation".
component.update(); | ||
}); | ||
|
||
test('showing "custom" and "off" types', () => { |
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.
Similar nit here. I think I'd find the intention behind these assertions easier to understand if they were two separate test cases, each with an individual assertion, with descriptions like "interprets presence of allocate config as custom node attribute allocation" and "interprets presence of migrate.enabled configuration as disabling allocation".
test('showing "custom" and "off" types', () => { | ||
const { find } = testBed; | ||
expect(find('warm-dataTierAllocationControls.dataTierSelect').text()).toContain('Custom'); | ||
expect(find('cold-dataTierAllocationControls.dataTierSelect').text()).toContain('Off'); |
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 we use toBe
in these cases too?
Pinging @elastic/es-ui (Team:Elasticsearch UI) |
* migrate all fields on warm phase except, data alloc, replicas and shrink * introduce edit policy context to share original policy and migrate shrink and replicas fields * Refactored biggest field; data allocation Copied the entire field for now duplicating all of the components * remove unused import * complete migration of new serialization * Remove last vestiges of legacy warm phase - also removed policy serialization tests for warm phase * fix existing test coverage and remove use of "none" for node attribute * added policy serialization tests * remove unused translations * Fix use of useFormData after update - also minor refactor to use useCallback in policy flyout now that getFormData changes when the form data changes. * fix import path * simplify serialization snapshot tests * type phases: string -> phases: Phases * Addressed some PR review items - refactor toggle click to take a boolean arg - refactor selection options in data tier component to use a func to get select options. * updated data tier callout logic after new changes * getPolicy -> updatePolicy Also rather deconstruct the validate fn from the form object * fix detection of migrate false and refactor serialization to pure function * fix type issue * fix for correctly detecting policy data tier type - with jest tests see origin here: #81642 Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
* migrate all fields on warm phase except, data alloc, replicas and shrink * introduce edit policy context to share original policy and migrate shrink and replicas fields * Refactored biggest field; data allocation Copied the entire field for now duplicating all of the components * remove unused import * complete migration of new serialization * Remove last vestiges of legacy warm phase - also removed policy serialization tests for warm phase * fix existing test coverage and remove use of "none" for node attribute * added policy serialization tests * remove unused translations * Fix use of useFormData after update - also minor refactor to use useCallback in policy flyout now that getFormData changes when the form data changes. * fix import path * simplify serialization snapshot tests * type phases: string -> phases: Phases * Addressed some PR review items - refactor toggle click to take a boolean arg - refactor selection options in data tier component to use a func to get select options. * updated data tier callout logic after new changes * getPolicy -> updatePolicy Also rather deconstruct the validate fn from the form object * fix detection of migrate false and refactor serialization to pure function * fix type issue * fix for correctly detecting policy data tier type - with jest tests see origin here: elastic#81642 Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
* migrate all fields on warm phase except, data alloc, replicas and shrink * introduce edit policy context to share original policy and migrate shrink and replicas fields * Refactored biggest field; data allocation Copied the entire field for now duplicating all of the components * remove unused import * complete migration of new serialization * Remove last vestiges of legacy warm phase - also removed policy serialization tests for warm phase * fix existing test coverage and remove use of "none" for node attribute * added policy serialization tests * remove unused translations * Fix use of useFormData after update - also minor refactor to use useCallback in policy flyout now that getFormData changes when the form data changes. * fix import path * simplify serialization snapshot tests * type phases: string -> phases: Phases * Addressed some PR review items - refactor toggle click to take a boolean arg - refactor selection options in data tier component to use a func to get select options. * updated data tier callout logic after new changes * getPolicy -> updatePolicy Also rather deconstruct the validate fn from the form object * fix detection of migrate false and refactor serialization to pure function * fix type issue * fix for correctly detecting policy data tier type - with jest tests see origin here: #81642 Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com> Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
Summary
Fix for correctly detecting when migration.enabled = false has been set in an ILM policy (introduced in this PR #76126)
This bug will cause policies with "migrate.enabled: false" set to not be correctly detected in the UI. Users are still able set this value in the UI, but they are not able to see it as being again on subsequent viewings of the policy with "migrate.enabled=false" set.
Gif of fixed behaviour
Sample JSON for creating a policy with migration "off"
Checklist