-
Notifications
You must be signed in to change notification settings - Fork 8.5k
[ILM] Fix detection of "migrate.enabled: false" #81642
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -10,7 +10,13 @@ import { setupEnvironment } from '../helpers/setup_environment'; | |
| import { EditPolicyTestBed, setup } from './edit_policy.helpers'; | ||
|
|
||
| import { API_BASE_PATH } from '../../../common/constants'; | ||
| import { DELETE_PHASE_POLICY, NEW_SNAPSHOT_POLICY_NAME, SNAPSHOT_POLICY_NAME } from './constants'; | ||
| import { | ||
| DELETE_PHASE_POLICY, | ||
| NEW_SNAPSHOT_POLICY_NAME, | ||
| SNAPSHOT_POLICY_NAME, | ||
| POLICY_WITH_NODE_ATTR_AND_OFF_ALLOCATION, | ||
| POLICY_WITH_NODE_ROLE_ALLOCATION, | ||
| } from './constants'; | ||
|
|
||
| window.scrollTo = jest.fn(); | ||
|
|
||
|
|
@@ -134,4 +140,57 @@ describe('<EditPolicy />', () => { | |
| expect(testBed.find('policiesErrorCallout').exists()).toBeTruthy(); | ||
| }); | ||
| }); | ||
|
|
||
| describe('data allocation', () => { | ||
| describe('node roles', () => { | ||
| beforeEach(async () => { | ||
| httpRequestsMockHelpers.setLoadPolicies([POLICY_WITH_NODE_ROLE_ALLOCATION]); | ||
| httpRequestsMockHelpers.setListNodes({ | ||
| isUsingDeprecatedDataRoleConfig: false, | ||
| nodesByAttributes: { test: ['123'] }, | ||
| nodesByRoles: { data: ['123'] }, | ||
| }); | ||
|
|
||
| await act(async () => { | ||
| testBed = await setup(); | ||
| }); | ||
|
|
||
| const { component } = testBed; | ||
| component.update(); | ||
| }); | ||
| test('showing "default" type', () => { | ||
| const { find } = testBed; | ||
| expect(find('warm-dataTierAllocationControls.dataTierSelect').text()).toContain( | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Instead of calling
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Instead of using And if we do this then we won't need to the last two assertions, I think? |
||
| 'recommended' | ||
| ); | ||
| expect(find('warm-dataTierAllocationControls.dataTierSelect').text()).not.toContain( | ||
| 'Custom' | ||
| ); | ||
| expect(find('warm-dataTierAllocationControls.dataTierSelect').text()).not.toContain('Off'); | ||
| }); | ||
| }); | ||
| describe('node attr and none', () => { | ||
| beforeEach(async () => { | ||
| httpRequestsMockHelpers.setLoadPolicies([POLICY_WITH_NODE_ATTR_AND_OFF_ALLOCATION]); | ||
| httpRequestsMockHelpers.setListNodes({ | ||
| isUsingDeprecatedDataRoleConfig: false, | ||
| nodesByAttributes: { test: ['123'] }, | ||
| nodesByRoles: { data: ['123'] }, | ||
| }); | ||
|
|
||
| await act(async () => { | ||
| testBed = await setup(); | ||
| }); | ||
|
|
||
| const { component } = testBed; | ||
| component.update(); | ||
| }); | ||
|
|
||
| test('showing "custom" and "off" types', () => { | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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". |
||
| const { find } = testBed; | ||
| expect(find('warm-dataTierAllocationControls.dataTierSelect').text()).toContain('Custom'); | ||
| expect(find('cold-dataTierAllocationControls.dataTierSelect').text()).toContain('Off'); | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can we use |
||
| }); | ||
| }); | ||
| }); | ||
| }); | ||
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".