@rancher/shell 0.5.3 → 1.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.DS_Store +0 -0
- package/assets/images/providers/aks-black.svg +28 -0
- package/assets/images/providers/aks.svg +31 -0
- package/assets/styles/global/_labeled-input.scss +1 -0
- package/assets/styles/global/_layout.scss +0 -99
- package/assets/translations/en-us.yaml +76 -74
- package/assets/translations/zh-hans.yaml +25 -23
- package/babel.config.js +1 -7
- package/chart/gatekeeper.vue +11 -2
- package/chart/istio.vue +10 -1
- package/chart/logging/index.vue +11 -2
- package/chart/monitoring/alerting/index.vue +21 -7
- package/chart/monitoring/grafana/index.vue +2 -57
- package/chart/monitoring/index.vue +26 -52
- package/chart/monitoring/prometheus/index.vue +43 -37
- package/chart/rancher-backup/index.vue +10 -3
- package/cloud-credential/azure.vue +17 -4
- package/components/AsyncButton.vue +0 -9
- package/components/Carousel.vue +0 -1
- package/components/ChartPsp.vue +76 -0
- package/components/ClusterIconMenu.vue +9 -24
- package/components/CodeMirror.vue +16 -75
- package/components/CopyCode.vue +2 -6
- package/components/CopyToClipboard.vue +1 -2
- package/components/CopyToClipboardText.vue +9 -14
- package/components/CruResource.vue +0 -1
- package/components/EtcdInfoBanner.vue +5 -5
- package/components/ExplorerProjectsNamespaces.vue +1 -25
- package/components/FixedBanner.vue +0 -1
- package/components/IconOrSvg.vue +1 -1
- package/components/Markdown.vue +12 -16
- package/components/Questions/index.vue +1 -1
- package/components/ResourceDetail/Masthead.vue +9 -25
- package/components/ResourceDetail/index.vue +4 -1
- package/components/ResourceList/Masthead.vue +18 -1
- package/components/ResourceTable.vue +2 -14
- package/components/ResourceYaml.vue +5 -34
- package/components/SideNav.vue +65 -43
- package/components/SortableTable/THead.vue +9 -7
- package/components/SortableTable/index.vue +2 -1
- package/components/StatusTable.vue +1 -5
- package/components/TabTitle.vue +84 -0
- package/components/Tabbed/index.vue +0 -12
- package/components/YamlEditor.vue +0 -1
- package/components/__tests__/ChartPsp.test.ts +75 -0
- package/components/__tests__/CopyCode.test.ts +4 -5
- package/components/fleet/FleetBundles.vue +11 -5
- package/components/fleet/FleetRepos.vue +27 -62
- package/components/fleet/FleetResources.vue +1 -6
- package/components/fleet/FleetStatus.vue +3 -3
- package/components/fleet/FleetSummary.vue +30 -35
- package/components/form/ArrayList.vue +8 -1
- package/components/form/ArrayListSelect.vue +9 -9
- package/components/form/BannerSettings.vue +0 -3
- package/components/form/FileSelector.vue +0 -1
- package/components/form/KeyValue.vue +0 -2
- package/components/form/LabeledSelect.vue +0 -4
- package/components/form/Password.vue +1 -3
- package/components/form/Select.vue +1 -1
- package/components/form/SelectOrCreateAuthSecret.vue +4 -4
- package/components/form/__tests__/KeyValue.test.ts +1 -1
- package/components/formatter/Checked.vue +3 -11
- package/components/formatter/ClusterProvider.vue +18 -1
- package/components/formatter/FleetSummaryGraph.vue +11 -23
- package/components/formatter/LiveDate.vue +16 -0
- package/components/formatter/LiveDuration.vue +1 -1
- package/components/formatter/PercentageBar.vue +1 -1
- package/components/formatter/WorkloadDetailEndpoints.vue +22 -12
- package/components/formatter/__tests__/ClusterProvider.test.ts +28 -0
- package/components/nav/Group.vue +2 -2
- package/components/nav/Header.vue +2 -2
- package/components/nav/Jump.vue +9 -19
- package/components/nav/TopLevelMenu.vue +18 -66
- package/components/nav/Type.vue +7 -16
- package/components/nav/WindowManager/ContainerLogs.vue +19 -120
- package/components/nav/WindowManager/ContainerShell.vue +1 -6
- package/components/nav/WindowManager/index.vue +10 -11
- package/components/nav/__tests__/TopLevelMenu.test.ts +1 -34
- package/components/nav/__tests__/Type.test.ts +1 -31
- package/components/nuxt/nuxt-child.js +78 -14
- package/components/nuxt/nuxt.js +1 -1
- package/components/user.retention/user-retention-header.vue +34 -0
- package/composables/useI18n.ts +26 -0
- package/composables/useStore.ts +16 -0
- package/config/harvester-manager-types.js +0 -2
- package/config/home-links.js +32 -2
- package/config/private-label.js +0 -22
- package/config/product/explorer.js +4 -4
- package/config/product/fleet.js +1 -6
- package/config/product/legacy.js +1 -84
- package/config/product/manager.js +15 -8
- package/config/query-params.js +0 -1
- package/config/router.js +368 -385
- package/config/settings.ts +9 -2
- package/config/store.js +1 -1
- package/config/system-namespaces.js +0 -3
- package/config/table-headers.js +27 -47
- package/config/types.js +5 -0
- package/config/uiplugins.js +1 -1
- package/core/plugin-helpers.js +5 -3
- package/core/plugin-routes.ts +114 -56
- package/core/plugin.ts +10 -16
- package/core/plugins-loader.js +9 -7
- package/core/plugins.js +3 -0
- package/core/types-provisioning.ts +0 -7
- package/creators/app/init +0 -19
- package/detail/fleet.cattle.io.bundle.vue +1 -1
- package/detail/fleet.cattle.io.cluster.vue +1 -11
- package/detail/node.vue +0 -42
- package/detail/pod.vue +1 -68
- package/detail/provisioning.cattle.io.cluster.vue +8 -25
- package/detail/workload/index.vue +1 -15
- package/dialog/ScaleMachineDownDialog.vue +17 -34
- package/edit/auth/googleoauth.vue +5 -1
- package/edit/catalog.cattle.io.clusterrepo.vue +7 -20
- package/edit/cloudcredential.vue +0 -2
- package/edit/fleet.cattle.io.gitrepo.vue +4 -3
- package/edit/management.cattle.io.project.vue +52 -1
- package/edit/management.cattle.io.setting.vue +2 -32
- package/edit/monitoring.coreos.com.alertmanagerconfig/types/opsgenie.vue +1 -1
- package/edit/monitoring.coreos.com.alertmanagerconfig/types/pagerduty.vue +2 -1
- package/edit/monitoring.coreos.com.alertmanagerconfig/types/slack.vue +1 -1
- package/edit/monitoring.coreos.com.prometheusrule/AlertingRule.vue +3 -12
- package/edit/monitoring.coreos.com.prometheusrule/GroupRules.vue +1 -2
- package/edit/networking.k8s.io.networkpolicy/__tests__/PolicyRuleTarget.spec.ts +1 -1
- package/edit/provisioning.cattle.io.cluster/{tabs/Basics.vue → Basics.vue} +125 -106
- package/edit/provisioning.cattle.io.cluster/{tabs/MachinePool.vue → MachinePool.vue} +7 -1
- package/edit/provisioning.cattle.io.cluster/SelectCredential.vue +7 -15
- package/edit/provisioning.cattle.io.cluster/__tests__/Basics.tests.ts +237 -0
- package/edit/provisioning.cattle.io.cluster/__tests__/{CustomCommand.test.ts → CustomCommand.tests.ts} +0 -6
- package/edit/provisioning.cattle.io.cluster/__tests__/DrainOptions.test.ts +1 -1
- package/edit/provisioning.cattle.io.cluster/__tests__/rke2.test.ts +1 -7
- package/edit/provisioning.cattle.io.cluster/import.vue +2 -2
- package/edit/provisioning.cattle.io.cluster/index.vue +40 -109
- package/edit/provisioning.cattle.io.cluster/rke2.vue +689 -152
- package/edit/service.vue +0 -12
- package/edit/token.vue +0 -1
- package/edit/workload/Upgrading.vue +2 -3
- package/edit/workload/index.vue +1 -2
- package/edit/workload/mixins/workload.js +1 -1
- package/initialize/App.js +71 -25
- package/initialize/client.js +162 -21
- package/initialize/index.js +124 -47
- package/initialize/layouts.ts +26 -0
- package/{components/templates → layouts}/blank.vue +1 -1
- package/{components/templates → layouts}/default.vue +98 -8
- package/{components/templates → layouts}/error.vue +19 -10
- package/{components/templates → layouts}/home.vue +1 -4
- package/{components/templates → layouts}/plain.vue +1 -4
- package/{components/templates → layouts}/standalone.vue +1 -1
- package/{components/templates → layouts}/unauthenticated.vue +1 -1
- package/list/catalog.cattle.io.app.vue +0 -1
- package/list/management.cattle.io.feature.vue +7 -1
- package/list/management.cattle.io.setting.vue +0 -1
- package/list/management.cattle.io.user.vue +25 -1
- package/list/node.vue +0 -1
- package/machine-config/__tests__/vmwarevsphere.test.ts +161 -56
- package/machine-config/azure.vue +37 -21
- package/machine-config/vmwarevsphere.vue +47 -42
- package/middleware/authenticated.js +19 -14
- package/mixins/auth-config.js +7 -2
- package/mixins/brand.js +41 -29
- package/mixins/fetch.server.js +73 -0
- package/mixins/labeled-form-element.ts +1 -6
- package/models/__tests__/management.cattle.io.node.ts +0 -85
- package/models/__tests__/namespace.test.ts +9 -49
- package/models/cluster/node.js +4 -4
- package/models/cluster.x-k8s.io.machine.js +1 -1
- package/models/cluster.x-k8s.io.machinedeployment.js +0 -14
- package/models/fleet.cattle.io.cluster.js +0 -4
- package/models/fleet.cattle.io.gitrepo.js +13 -56
- package/models/management.cattle.io.cluster.js +3 -11
- package/models/management.cattle.io.kontainerdriver.js +0 -1
- package/models/management.cattle.io.node.js +14 -18
- package/models/management.cattle.io.nodepool.js +0 -17
- package/models/management.cattle.io.project.js +36 -0
- package/models/management.cattle.io.setting.js +7 -11
- package/models/management.cattle.io.user.js +65 -0
- package/models/namespace.js +1 -1
- package/models/pod.js +0 -20
- package/models/provisioning.cattle.io.cluster.js +9 -91
- package/models/secret.js +18 -126
- package/models/storage.k8s.io.storageclass.js +1 -1
- package/models/workload.js +0 -16
- package/models/workload.service.js +0 -18
- package/package.json +10 -12
- package/pages/about.vue +1 -0
- package/pages/account/create-key.vue +1 -0
- package/pages/account/index.vue +1 -0
- package/pages/auth/login.vue +1 -0
- package/pages/auth/logout.vue +2 -0
- package/pages/auth/setup.vue +4 -37
- package/pages/auth/verify.vue +8 -14
- package/pages/c/_cluster/apps/charts/__tests__/install.helper.test.ts +17 -2
- package/pages/c/_cluster/apps/charts/index.vue +58 -64
- package/pages/c/_cluster/apps/charts/install.helpers.js +13 -2
- package/pages/c/_cluster/apps/charts/install.vue +5 -5
- package/pages/c/_cluster/apps/index.vue +2 -0
- package/pages/c/_cluster/auth/index.vue +2 -0
- package/pages/c/_cluster/auth/user.retention/index.vue +384 -0
- package/pages/c/_cluster/ecm/index.vue +2 -0
- package/pages/c/_cluster/explorer/index.vue +53 -56
- package/pages/c/_cluster/explorer/tools/index.vue +3 -171
- package/pages/c/_cluster/fleet/index.vue +1 -1
- package/pages/c/_cluster/index.vue +2 -0
- package/pages/c/_cluster/manager/pages/_page.vue +5 -4
- package/pages/c/_cluster/monitoring/index.vue +1 -17
- package/pages/c/_cluster/settings/DefaultLinksEditor.vue +1 -1
- package/pages/c/_cluster/settings/banners.vue +2 -0
- package/pages/c/_cluster/settings/brand.vue +2 -3
- package/pages/c/_cluster/settings/index.vue +2 -0
- package/pages/c/_cluster/settings/links.vue +3 -2
- package/pages/c/_cluster/settings/performance.vue +1 -0
- package/pages/c/_cluster/uiplugins/CatalogList/CatalogLoadDialog.vue +1 -2
- package/pages/c/_cluster/uiplugins/CatalogList/index.vue +46 -10
- package/pages/c/_cluster/uiplugins/index.vue +2 -0
- package/pages/c/index.vue +9 -0
- package/pages/diagnostic.vue +2 -1
- package/pages/fail-whale.vue +1 -0
- package/pages/prefs.vue +1 -0
- package/pages/rio/mesh.vue +508 -0
- package/pages/support/index.vue +8 -2
- package/pkg/auto-import.js +1 -1
- package/plugins/axios.js +36 -0
- package/plugins/back-button.js +5 -3
- package/plugins/clean-html-directive.js +19 -1
- package/plugins/clean-tooltip-directive.js +1 -1
- package/plugins/codemirror-loader.js +1 -1
- package/plugins/codemirror.js +0 -41
- package/plugins/dashboard-store/__tests__/{mutations.test.ts → mutations.spec.ts} +1 -1
- package/plugins/dashboard-store/actions.js +17 -16
- package/plugins/dashboard-store/classify.js +18 -1
- package/plugins/dashboard-store/getters.js +7 -70
- package/plugins/dashboard-store/index.js +12 -0
- package/plugins/dashboard-store/mutations.js +4 -0
- package/plugins/dashboard-store/resource-class.js +20 -65
- package/plugins/i18n.js +1 -1
- package/plugins/steve/__tests__/getters.spec.ts +48 -26
- package/plugins/steve/__tests__/subscribe.spec.ts +106 -0
- package/plugins/steve/actions.js +37 -3
- package/plugins/steve/getters.js +24 -7
- package/plugins/steve/mutations.js +5 -2
- package/plugins/steve/norman-class.js +0 -19
- package/plugins/steve/steve-class.js +0 -22
- package/plugins/steve/subscribe.js +34 -13
- package/plugins/transitions.js +4 -0
- package/plugins/vue-clipboard2.js +4 -0
- package/rancher-components/Accordion/Accordion.vue +3 -2
- package/rancher-components/BadgeState/BadgeState.vue +3 -3
- package/rancher-components/Banner/Banner.test.ts +1 -5
- package/rancher-components/Banner/Banner.vue +2 -2
- package/rancher-components/Card/Card.vue +4 -4
- package/rancher-components/Form/Checkbox/Checkbox.vue +4 -3
- package/rancher-components/Form/LabeledInput/LabeledInput.test.ts +1 -1
- package/rancher-components/Form/LabeledInput/LabeledInput.vue +55 -24
- package/rancher-components/Form/Radio/RadioButton.test.ts +1 -3
- package/rancher-components/Form/Radio/RadioButton.vue +13 -7
- package/rancher-components/Form/Radio/RadioGroup.vue +4 -3
- package/rancher-components/Form/TextArea/TextAreaAutoGrow.vue +7 -5
- package/rancher-components/Form/ToggleSwitch/ToggleSwitch.vue +7 -4
- package/rancher-components/LabeledTooltip/LabeledTooltip.vue +9 -4
- package/rancher-components/StringList/StringList.vue +8 -8
- package/rancher-components/components/Accordion/Accordion.vue +3 -2
- package/rancher-components/components/BadgeState/BadgeState.test.ts +12 -0
- package/rancher-components/components/Form/LabeledInput/LabeledInput.test.ts +2 -19
- package/rancher-components/components/Form/LabeledInput/LabeledInput.vue +14 -11
- package/rancher-components/components/Form/TextArea/TextAreaAutoGrow.vue +1 -1
- package/rancher-components/components/StringList/StringList.test.ts +0 -270
- package/rancher-components/components/StringList/StringList.vue +18 -57
- package/scripts/extension/bundle +7 -19
- package/scripts/extension/helm/scripts/package +3 -11
- package/scripts/extension/parse-tag-name +4 -4
- package/scripts/extension/publish +9 -20
- package/scripts/publish-shell.sh +1 -11
- package/scripts/test-plugins-build.sh +9 -85
- package/store/catalog.js +1 -1
- package/store/features.js +0 -1
- package/store/i18n.js +0 -11
- package/store/index.js +13 -11
- package/store/prefs.js +38 -33
- package/store/type-map.js +82 -157
- package/tsconfig.default.json +46 -0
- package/tsconfig.json +9 -35
- package/types/shell/index.d.ts +404 -465
- package/utils/axios.js +19 -0
- package/utils/create-yaml.js +1 -5
- package/utils/custom-validators.js +2 -0
- package/utils/error.js +1 -16
- package/utils/monitoring.js +2 -37
- package/utils/nuxt.js +39 -18
- package/utils/object.js +0 -24
- package/utils/router.scrollBehavior.js +14 -12
- package/utils/socket.js +1 -0
- package/utils/time.js +1 -1
- package/utils/title.ts +3 -0
- package/utils/url.ts +1 -1
- package/utils/validators/formRules/__tests__/index.test.ts +4 -49
- package/utils/validators/formRules/index.ts +9 -12
- package/utils/validators/setting.js +10 -6
- package/vue.config.js +3 -24
- package/chart/monitoring/steps/uninstall-v1.vue +0 -135
- package/components/Certificates.vue +0 -164
- package/components/__tests__/CodeMirror.spec.ts +0 -99
- package/components/fleet/__tests__/FleetSummary.test.ts +0 -316
- package/components/formatter/FleetClusterSummaryGraph.vue +0 -27
- package/components/formatter/__tests__/Checked.test.ts +0 -19
- package/components/formatter/__tests__/WorkloadDetailEndpoints.test.ts +0 -81
- package/components/nav/WindowManager/__tests__/ContainerLogs.test.ts +0 -186
- package/composables/useCompactInput.ts +0 -20
- package/composables/useLabeledFormElement.ts +0 -138
- package/creators/app/files/.gitlab-ci.yml +0 -14
- package/detail/__tests__/provisioning.cattle.io.cluster.test.ts +0 -77
- package/edit/__tests__/service.test.ts +0 -89
- package/edit/provisioning.cattle.io.cluster/__tests__/Advanced.test.ts +0 -112
- package/edit/provisioning.cattle.io.cluster/__tests__/Basics.test.ts +0 -473
- package/edit/provisioning.cattle.io.cluster/__tests__/index.test.ts +0 -73
- package/edit/provisioning.cattle.io.cluster/__tests__/utils/cluster.ts +0 -386
- package/edit/provisioning.cattle.io.cluster/tabs/AddOnConfig.vue +0 -137
- package/edit/provisioning.cattle.io.cluster/tabs/Advanced.vue +0 -157
- package/edit/provisioning.cattle.io.cluster/tabs/etcd/index.vue +0 -135
- package/edit/provisioning.cattle.io.cluster/tabs/networking/index.vue +0 -189
- package/edit/provisioning.cattle.io.cluster/tabs/registries/index.vue +0 -147
- package/edit/provisioning.cattle.io.cluster/tabs/upgrade/index.vue +0 -76
- package/mixins/v1-workload-metrics.js +0 -43
- package/models/__tests__/management.cattle.io.cluster.test.ts +0 -23
- package/models/__tests__/management.cattle.io.nodepool.ts +0 -83
- package/models/__tests__/provisioning.cattle.io.cluster.test.ts +0 -241
- package/models/__tests__/secret.test.ts +0 -37
- package/models/__tests__/storage.k8s.io.storageclass.test.ts +0 -22
- package/models/__tests__/workload.test.ts +0 -91
- package/plugins/clean-html.js +0 -53
- package/plugins/dashboard-store/__tests__/resource-class.test.ts +0 -49
- package/plugins/dashboard-store/__tests__/utils/store-mocks.ts +0 -7
- package/plugins/index.js +0 -11
- package/plugins/steve/__tests__/resource-utils.test.ts +0 -159
- package/plugins/steve/__tests__/steve-class.spec.ts +0 -59
- package/plugins/steve/__tests__/utils/steve-mocks.ts +0 -31
- package/plugins/steve/resource-utils.ts +0 -38
- package/scripts/.gitlab/workflows/build-extension-catalog.gitlab-ci.yml +0 -50
- package/server/har-file.js +0 -183
- package/store/__tests__/type-map.test.ts +0 -1122
- package/tsconfig.paths.json +0 -18
- package/utils/azure.js +0 -24
- package/utils/clipboard.js +0 -5
- /package/components/form/__tests__/{NameNsDescription.test.ts → NameNsDescription.ts} +0 -0
- /package/edit/networking.k8s.io.networkpolicy/__tests__/utils/{selectors.test.ts → selectors.ts} +0 -0
- /package/edit/provisioning.cattle.io.cluster/{tabs/networking/ACE.vue → ACE.vue} +0 -0
- /package/edit/provisioning.cattle.io.cluster/{tabs/AgentConfiguration.vue → AgentConfiguration.vue} +0 -0
- /package/edit/provisioning.cattle.io.cluster/{tabs/upgrade/DrainOptions.vue → DrainOptions.vue} +0 -0
- /package/edit/provisioning.cattle.io.cluster/{tabs/MemberRoles.vue → MemberRoles.vue} +0 -0
- /package/edit/provisioning.cattle.io.cluster/{tabs/registries/RegistryConfigs.vue → RegistryConfigs.vue} +0 -0
- /package/edit/provisioning.cattle.io.cluster/{tabs/registries/RegistryMirrors.vue → RegistryMirrors.vue} +0 -0
- /package/edit/provisioning.cattle.io.cluster/{tabs/etcd/S3Config.vue → S3Config.vue} +0 -0
- /package/plugins/dashboard-store/__tests__/{actions.test.ts → actions.spec.ts} +0 -0
- /package/plugins/dashboard-store/__tests__/{getters.test.ts → getters.spec.ts} +0 -0
- /package/rancher-components/BadgeState/{BadgeState.spec.ts → BadgeState.test.ts} +0 -0
|
@@ -1,112 +0,0 @@
|
|
|
1
|
-
/* eslint-disable jest/no-hooks */
|
|
2
|
-
import { mount, Wrapper } from '@vue/test-utils';
|
|
3
|
-
import Advanced from '@shell/edit/provisioning.cattle.io.cluster/tabs/Advanced.vue';
|
|
4
|
-
import { _YAML, _VIEW } from '@shell/config/query-params';
|
|
5
|
-
import { clone } from '@shell/utils/object';
|
|
6
|
-
import { PROV_CLUSTER, VERSION_CLUSTER } from '@shell/edit/provisioning.cattle.io.cluster/__tests__/utils/cluster';
|
|
7
|
-
|
|
8
|
-
describe('component: Advanced', () => {
|
|
9
|
-
let wrapper: Wrapper<InstanceType<typeof Advanced>>;
|
|
10
|
-
|
|
11
|
-
const mountOptions = {
|
|
12
|
-
propsData: {
|
|
13
|
-
value: {},
|
|
14
|
-
mode: _VIEW,
|
|
15
|
-
haveArgInfo: true,
|
|
16
|
-
selectedVersion: VERSION_CLUSTER
|
|
17
|
-
},
|
|
18
|
-
mocks: {
|
|
19
|
-
$store: {
|
|
20
|
-
getters: {
|
|
21
|
-
currentStore: () => 'current_store',
|
|
22
|
-
'current_store/schemaFor': jest.fn(),
|
|
23
|
-
'current_store/all': jest.fn(),
|
|
24
|
-
'i18n/t': jest.fn(),
|
|
25
|
-
'i18n/exists': jest.fn(),
|
|
26
|
-
}
|
|
27
|
-
},
|
|
28
|
-
$route: { query: { AS: _YAML } },
|
|
29
|
-
$router: { applyQuery: jest.fn() },
|
|
30
|
-
}
|
|
31
|
-
};
|
|
32
|
-
|
|
33
|
-
describe('cluster configurations', () => {
|
|
34
|
-
it(`should support empty machineSelectorConfig`, () => {
|
|
35
|
-
const value = clone(PROV_CLUSTER);
|
|
36
|
-
|
|
37
|
-
value.spec.rkeConfig.machineSelectorConfig = [];
|
|
38
|
-
|
|
39
|
-
mountOptions.propsData.value = value;
|
|
40
|
-
|
|
41
|
-
wrapper = mount(
|
|
42
|
-
Advanced,
|
|
43
|
-
mountOptions
|
|
44
|
-
);
|
|
45
|
-
|
|
46
|
-
const inputElem = wrapper.find('[data-testid="array-list-box0"]').element as HTMLElement;
|
|
47
|
-
|
|
48
|
-
expect(inputElem).toBeUndefined();
|
|
49
|
-
});
|
|
50
|
-
|
|
51
|
-
describe(`'protect-kernel-defaults'`, () => {
|
|
52
|
-
it(`should show value from machineGlobalConfig`, () => {
|
|
53
|
-
const value = clone(PROV_CLUSTER);
|
|
54
|
-
|
|
55
|
-
value.spec.rkeConfig.machineGlobalConfig['protect-kernel-defaults'] = true;
|
|
56
|
-
value.spec.rkeConfig.machineSelectorConfig = [{
|
|
57
|
-
config: {},
|
|
58
|
-
machineLabelSelector: {
|
|
59
|
-
matchExpressions: [{
|
|
60
|
-
key: 'foo',
|
|
61
|
-
operator: 'In',
|
|
62
|
-
values: ['bar'],
|
|
63
|
-
}],
|
|
64
|
-
matchLabels: { foo1: 'bar1' },
|
|
65
|
-
}
|
|
66
|
-
}];
|
|
67
|
-
|
|
68
|
-
mountOptions.propsData.mode = _VIEW;
|
|
69
|
-
mountOptions.propsData.value = value;
|
|
70
|
-
|
|
71
|
-
wrapper = mount(
|
|
72
|
-
Advanced,
|
|
73
|
-
mountOptions
|
|
74
|
-
);
|
|
75
|
-
|
|
76
|
-
const checkbox = wrapper.find('[data-testid="protect-kernel-defaults"]').find('[type="checkbox"]').element as HTMLInputElement;
|
|
77
|
-
|
|
78
|
-
expect(checkbox.value).toBe('true');
|
|
79
|
-
});
|
|
80
|
-
|
|
81
|
-
it(`should show value from machineSelectorConfig.config`, () => {
|
|
82
|
-
const value = clone(PROV_CLUSTER);
|
|
83
|
-
|
|
84
|
-
value.spec.rkeConfig.machineGlobalConfig['protect-kernel-defaults'] = false;
|
|
85
|
-
value.spec.rkeConfig.machineSelectorConfig = [{
|
|
86
|
-
config: {},
|
|
87
|
-
machineLabelSelector: {
|
|
88
|
-
config: { 'protect-kernel-defaults': true },
|
|
89
|
-
matchExpressions: [{
|
|
90
|
-
key: 'foo',
|
|
91
|
-
operator: 'In',
|
|
92
|
-
values: ['bar'],
|
|
93
|
-
}],
|
|
94
|
-
matchLabels: { foo1: 'bar1' },
|
|
95
|
-
}
|
|
96
|
-
}];
|
|
97
|
-
|
|
98
|
-
mountOptions.propsData.mode = _VIEW;
|
|
99
|
-
mountOptions.propsData.value = value;
|
|
100
|
-
|
|
101
|
-
wrapper = mount(
|
|
102
|
-
Advanced,
|
|
103
|
-
mountOptions
|
|
104
|
-
);
|
|
105
|
-
|
|
106
|
-
const checkbox = wrapper.find('[data-testid="protect-kernel-defaults"]').find('[type="checkbox"]').element as HTMLInputElement;
|
|
107
|
-
|
|
108
|
-
expect(checkbox.value).toBe('true');
|
|
109
|
-
});
|
|
110
|
-
});
|
|
111
|
-
});
|
|
112
|
-
});
|
|
@@ -1,473 +0,0 @@
|
|
|
1
|
-
import { mount } from '@vue/test-utils';
|
|
2
|
-
import Basics from '@shell/edit/provisioning.cattle.io.cluster/tabs/Basics';
|
|
3
|
-
import Checkbox from '@components/Form/Checkbox/Checkbox.vue';
|
|
4
|
-
|
|
5
|
-
const defaultStubs = {
|
|
6
|
-
Banner: true,
|
|
7
|
-
LabeledSelect: true,
|
|
8
|
-
YamlEditor: true,
|
|
9
|
-
Checkbox: true
|
|
10
|
-
};
|
|
11
|
-
|
|
12
|
-
const defaultCiliumStubs = {
|
|
13
|
-
Banner: true,
|
|
14
|
-
LabeledSelect: true,
|
|
15
|
-
YamlEditor: true,
|
|
16
|
-
};
|
|
17
|
-
|
|
18
|
-
const defaultComputed = {
|
|
19
|
-
showk8s21LegacyWarning() {
|
|
20
|
-
return false;
|
|
21
|
-
},
|
|
22
|
-
profileOptions() {
|
|
23
|
-
return [{ label: 'anything', value: 'anything' }];
|
|
24
|
-
}
|
|
25
|
-
};
|
|
26
|
-
|
|
27
|
-
const mockAgentArgs = { 'cloud-provider-name': { options: [], profile: { options: [{ anything: 'yes' }] } } };
|
|
28
|
-
const mockServerArgs = { disable: {}, cni: { options: [] } };
|
|
29
|
-
|
|
30
|
-
const rke2Versions =
|
|
31
|
-
[
|
|
32
|
-
{
|
|
33
|
-
id: 'v1.25.0+rke2r1', value: 'v1.25.0+rke2r1', serverArgs: mockServerArgs, agentArgs: mockAgentArgs, charts: {}
|
|
34
|
-
},
|
|
35
|
-
{
|
|
36
|
-
id: 'v1.24.0+rke2r1', value: 'v1.24.0+rke2r1', serverArgs: mockServerArgs, agentArgs: mockAgentArgs, charts: {}
|
|
37
|
-
},
|
|
38
|
-
{
|
|
39
|
-
id: 'v1.23.0+rke2r1', value: 'v1.23.0+rke2r1', serverArgs: mockServerArgs, agentArgs: mockAgentArgs, charts: {}
|
|
40
|
-
}
|
|
41
|
-
];
|
|
42
|
-
const k3sVersions = [
|
|
43
|
-
{
|
|
44
|
-
id: 'v1.25.0+k3s1', value: 'v1.25.0+k3s1', serverArgs: mockServerArgs, agentArgs: mockAgentArgs, charts: {}
|
|
45
|
-
},
|
|
46
|
-
{
|
|
47
|
-
id: 'v1.24.0+k3s1', value: 'v1.24.0+k3s1', serverArgs: mockServerArgs, agentArgs: mockAgentArgs, charts: {}
|
|
48
|
-
},
|
|
49
|
-
{
|
|
50
|
-
id: 'v1.23.0+k3s1', value: 'v1.23.0+k3s1', serverArgs: mockServerArgs, agentArgs: mockAgentArgs, charts: {}
|
|
51
|
-
}
|
|
52
|
-
];
|
|
53
|
-
const mockVersionOptions = [...rke2Versions, ...k3sVersions];
|
|
54
|
-
|
|
55
|
-
const defaultGetters = {
|
|
56
|
-
currentStore: () => 'current_store',
|
|
57
|
-
'management/schemaFor': jest.fn(),
|
|
58
|
-
'current_store/all': jest.fn(),
|
|
59
|
-
'i18n/t': jest.fn(),
|
|
60
|
-
'i18n/withFallback': jest.fn(),
|
|
61
|
-
'plugins/cloudProviderForDriver': jest.fn()
|
|
62
|
-
};
|
|
63
|
-
|
|
64
|
-
const defaultMocks = {
|
|
65
|
-
$route: {
|
|
66
|
-
name: 'anything',
|
|
67
|
-
query: { AS: 'yaml' },
|
|
68
|
-
},
|
|
69
|
-
};
|
|
70
|
-
|
|
71
|
-
const defaultSpec = {
|
|
72
|
-
rkeConfig: { etcd: { disableSnapshots: false }, machineGlobalConfig: { cni: 'calico' } },
|
|
73
|
-
chartValues: {},
|
|
74
|
-
};
|
|
75
|
-
|
|
76
|
-
const defaultCiliumSpec = {
|
|
77
|
-
rkeConfig: { etcd: { disableSnapshots: false }, machineGlobalConfig: { cni: 'cilium' } },
|
|
78
|
-
chartValues: {},
|
|
79
|
-
};
|
|
80
|
-
|
|
81
|
-
// ipv6
|
|
82
|
-
const legacyOnValue = { cilium: { ipv6: { enabled: true } } };
|
|
83
|
-
const legacyOffValue = { cilium: { ipv6: { enabled: false } } };
|
|
84
|
-
const newOnValue = { ipv6: { enabled: true } };
|
|
85
|
-
const newOffValue = { ipv6: { enabled: false } };
|
|
86
|
-
|
|
87
|
-
// bandwidth manager
|
|
88
|
-
const bmOnValue = { bandwidthManager: { enabled: true } };
|
|
89
|
-
const bmOffValue = { bandwidthManager: { enabled: false } };
|
|
90
|
-
|
|
91
|
-
function createBasicsTab(version : string, userChartValues: any) {
|
|
92
|
-
const k8s = mockVersionOptions.find((v) => v.id === version) || mockVersionOptions[0];
|
|
93
|
-
const label = 'whatever';
|
|
94
|
-
const wrapper = mount(Basics, {
|
|
95
|
-
propsData: {
|
|
96
|
-
mode: 'create',
|
|
97
|
-
value: {
|
|
98
|
-
spec: {
|
|
99
|
-
...defaultCiliumSpec,
|
|
100
|
-
defaultPodSecurityAdmissionConfigurationTemplateName: label,
|
|
101
|
-
kubernetesVersion: k8s.value
|
|
102
|
-
},
|
|
103
|
-
agentConfig: { 'cloud-provider-name': '' },
|
|
104
|
-
},
|
|
105
|
-
addonVersions: [],
|
|
106
|
-
provider: 'custom',
|
|
107
|
-
userChartValues: userChartValues || {},
|
|
108
|
-
cisOverride: false,
|
|
109
|
-
cisPsaChangeBanner: true,
|
|
110
|
-
allPsas: [],
|
|
111
|
-
selectedVersion: k8s,
|
|
112
|
-
versionOptions: mockVersionOptions,
|
|
113
|
-
isHarvesterDriver: false,
|
|
114
|
-
isHarvesterIncompatible: false,
|
|
115
|
-
showDeprecatedPatchVersions: false,
|
|
116
|
-
clusterIsAlreadyCreated: false,
|
|
117
|
-
isElementalCluster: false,
|
|
118
|
-
hasPsaTemplates: false,
|
|
119
|
-
isK3s: false,
|
|
120
|
-
haveArgInfo: false,
|
|
121
|
-
showCni: true,
|
|
122
|
-
showCloudProvider: false,
|
|
123
|
-
unsupportedCloudProvider: false,
|
|
124
|
-
cloudProviderOptions: [{ label: 'Default - RKE2 Embedded', value: '' }],
|
|
125
|
-
},
|
|
126
|
-
computed: defaultComputed,
|
|
127
|
-
mocks: {
|
|
128
|
-
...defaultMocks,
|
|
129
|
-
$store: { getters: defaultGetters },
|
|
130
|
-
},
|
|
131
|
-
stubs: defaultCiliumStubs
|
|
132
|
-
});
|
|
133
|
-
|
|
134
|
-
return wrapper;
|
|
135
|
-
}
|
|
136
|
-
|
|
137
|
-
describe('component: Basics', () => {
|
|
138
|
-
/**
|
|
139
|
-
* DISCLAIMER ***************************************************************************************
|
|
140
|
-
* Logs are prevented to avoid polluting the test output.
|
|
141
|
-
****************************************************************************************************
|
|
142
|
-
*/
|
|
143
|
-
// eslint-disable-next-line jest/no-hooks
|
|
144
|
-
beforeEach(() => {
|
|
145
|
-
jest.spyOn(console, 'log').mockImplementation(() => { });
|
|
146
|
-
});
|
|
147
|
-
|
|
148
|
-
it.each(mockVersionOptions)('should display PSA option', (k8s) => {
|
|
149
|
-
const label = 'whatever';
|
|
150
|
-
const wrapper = mount(Basics, {
|
|
151
|
-
propsData: {
|
|
152
|
-
mode: 'create',
|
|
153
|
-
value: {
|
|
154
|
-
spec: {
|
|
155
|
-
...defaultSpec,
|
|
156
|
-
defaultPodSecurityAdmissionConfigurationTemplateName: label,
|
|
157
|
-
kubernetesVersion: k8s.value
|
|
158
|
-
},
|
|
159
|
-
agentConfig: { 'cloud-provider-name': '' },
|
|
160
|
-
},
|
|
161
|
-
provider: 'whatever',
|
|
162
|
-
userChartValues: {},
|
|
163
|
-
cisOverride: false,
|
|
164
|
-
cisPsaChangeBanner: true,
|
|
165
|
-
allPsas: [],
|
|
166
|
-
selectedVersion: k8s,
|
|
167
|
-
versionOptions: mockVersionOptions,
|
|
168
|
-
isHarvesterDriver: false,
|
|
169
|
-
isHarvesterIncompatible: false,
|
|
170
|
-
showDeprecatedPatchVersions: false,
|
|
171
|
-
isElementalCluster: false,
|
|
172
|
-
hasPsaTemplates: false,
|
|
173
|
-
haveArgInfo: false,
|
|
174
|
-
showCni: true,
|
|
175
|
-
showCloudProvider: true,
|
|
176
|
-
unsupportedCloudProvider: false,
|
|
177
|
-
cloudProviderOptions: [{ label: 'Default - RKE2 Embedded', value: '' }],
|
|
178
|
-
},
|
|
179
|
-
computed: defaultComputed,
|
|
180
|
-
mocks: {
|
|
181
|
-
...defaultMocks,
|
|
182
|
-
$store: { getters: defaultGetters },
|
|
183
|
-
},
|
|
184
|
-
stubs: defaultStubs
|
|
185
|
-
});
|
|
186
|
-
|
|
187
|
-
const select = wrapper.find('[data-testid="rke2-custom-edit-psa"]');
|
|
188
|
-
|
|
189
|
-
expect((select.vm as unknown as any).options[0].label).toBe(`${ label } (Current)`);
|
|
190
|
-
});
|
|
191
|
-
|
|
192
|
-
it.each([
|
|
193
|
-
['v1.25.0+rke2r1', 'none'],
|
|
194
|
-
['v1.24.0+rke2r1', 'default'],
|
|
195
|
-
['v1.23.0+rke2r1', 'default'],
|
|
196
|
-
['v1.25.0+k3s1', 'none'],
|
|
197
|
-
['v1.24.0+k3s1', 'default'],
|
|
198
|
-
['v1.23.0+k3s1', 'default'],
|
|
199
|
-
])('should display for version %p PSA option label %p', (k8s, partialLabel) => {
|
|
200
|
-
const label = `cluster.rke2.defaultPodSecurityAdmissionConfigurationTemplateName.option.${ partialLabel }`;
|
|
201
|
-
const wrapper = mount(Basics, {
|
|
202
|
-
propsData: {
|
|
203
|
-
mode: 'create',
|
|
204
|
-
value: {
|
|
205
|
-
spec: {
|
|
206
|
-
...defaultSpec,
|
|
207
|
-
defaultPodSecurityAdmissionConfigurationTemplateName: label,
|
|
208
|
-
kubernetesVersion: k8s
|
|
209
|
-
},
|
|
210
|
-
agentConfig: { 'cloud-provider-name': '' },
|
|
211
|
-
},
|
|
212
|
-
provider: 'whatever',
|
|
213
|
-
userChartValues: {},
|
|
214
|
-
cisOverride: false,
|
|
215
|
-
cisPsaChangeBanner: true,
|
|
216
|
-
allPsas: [],
|
|
217
|
-
selectedVersion: mockVersionOptions[0],
|
|
218
|
-
versionOptions: mockVersionOptions,
|
|
219
|
-
isHarvesterDriver: false,
|
|
220
|
-
isHarvesterIncompatible: false,
|
|
221
|
-
showDeprecatedPatchVersions: false,
|
|
222
|
-
isElementalCluster: false,
|
|
223
|
-
hasPsaTemplates: false,
|
|
224
|
-
haveArgInfo: false,
|
|
225
|
-
showCni: true,
|
|
226
|
-
showCloudProvider: true,
|
|
227
|
-
unsupportedCloudProvider: false,
|
|
228
|
-
cloudProviderOptions: [{ label: 'Default - RKE2 Embedded', value: '' }],
|
|
229
|
-
},
|
|
230
|
-
computed: defaultComputed,
|
|
231
|
-
mocks: {
|
|
232
|
-
...defaultMocks,
|
|
233
|
-
$store: { getters: defaultGetters },
|
|
234
|
-
},
|
|
235
|
-
stubs: defaultStubs
|
|
236
|
-
});
|
|
237
|
-
|
|
238
|
-
const select = wrapper.find('[data-testid="rke2-custom-edit-psa"]');
|
|
239
|
-
|
|
240
|
-
expect((select.vm as unknown as any).options[0].label).toStrictEqual(`${ label } (Current)`);
|
|
241
|
-
});
|
|
242
|
-
|
|
243
|
-
it.each([
|
|
244
|
-
['anything', false, true],
|
|
245
|
-
['', false, false],
|
|
246
|
-
['', true, false],
|
|
247
|
-
])('given CIS value as %p and its override as %p, it should set PSA dropdown as disabled %p', (cis, override, disabled) => {
|
|
248
|
-
const label = 'whatever';
|
|
249
|
-
const k8s = 'v1.25.0+rke2r1';
|
|
250
|
-
const wrapper = mount(Basics, {
|
|
251
|
-
propsData: {
|
|
252
|
-
mode: 'create',
|
|
253
|
-
value: {
|
|
254
|
-
agentConfig: { profile: cis, 'cloud-provider-name': '' },
|
|
255
|
-
spec: {
|
|
256
|
-
...defaultSpec,
|
|
257
|
-
defaultPodSecurityAdmissionConfigurationTemplateName: label,
|
|
258
|
-
kubernetesVersion: k8s
|
|
259
|
-
}
|
|
260
|
-
},
|
|
261
|
-
provider: 'custom',
|
|
262
|
-
userChartValues: {},
|
|
263
|
-
cisPsaChangeBanner: true,
|
|
264
|
-
allPsas: [],
|
|
265
|
-
cisOverride: override,
|
|
266
|
-
selectedVersion: mockVersionOptions[0],
|
|
267
|
-
versionOptions: [{
|
|
268
|
-
value: k8s,
|
|
269
|
-
agentArgs: { profile: { options: [cis] } },
|
|
270
|
-
charts: {},
|
|
271
|
-
profile: { options: [cis] }
|
|
272
|
-
}],
|
|
273
|
-
isHarvesterDriver: false,
|
|
274
|
-
isHarvesterIncompatible: false,
|
|
275
|
-
showDeprecatedPatchVersions: false,
|
|
276
|
-
isElementalCluster: false,
|
|
277
|
-
hasPsaTemplates: true,
|
|
278
|
-
haveArgInfo: false,
|
|
279
|
-
showCni: true,
|
|
280
|
-
showCloudProvider: true,
|
|
281
|
-
unsupportedCloudProvider: false,
|
|
282
|
-
cloudProviderOptions: [{ label: 'Default - RKE2 Embedded', value: '' }],
|
|
283
|
-
},
|
|
284
|
-
computed: { ...defaultComputed },
|
|
285
|
-
mocks: {
|
|
286
|
-
...defaultMocks,
|
|
287
|
-
$store: { getters: defaultGetters },
|
|
288
|
-
},
|
|
289
|
-
stubs: defaultStubs
|
|
290
|
-
});
|
|
291
|
-
|
|
292
|
-
const select = wrapper.find('[data-testid="rke2-custom-edit-psa"]');
|
|
293
|
-
|
|
294
|
-
expect((select.vm as unknown as any).disabled).toBe(disabled);
|
|
295
|
-
});
|
|
296
|
-
|
|
297
|
-
describe('cilium CNI', () => {
|
|
298
|
-
it('should toggle ipv6 on/off with the legacy structure', async() => {
|
|
299
|
-
const wrapper = createBasicsTab('v1.23.0+rke2r1', {});
|
|
300
|
-
const ipv6Checkbox = wrapper.find('[data-testid="cluster-rke2-cni-ipv6-checkbox"]');
|
|
301
|
-
|
|
302
|
-
expect(ipv6Checkbox.exists()).toBe(true);
|
|
303
|
-
expect(ipv6Checkbox.isVisible()).toBe(true);
|
|
304
|
-
|
|
305
|
-
// Click the checkbox - should enable ipv6
|
|
306
|
-
await ipv6Checkbox.find('label').trigger('click');
|
|
307
|
-
await ipv6Checkbox.vm.$nextTick();
|
|
308
|
-
await wrapper.vm.$nextTick();
|
|
309
|
-
|
|
310
|
-
// Check and update user values with the emitted value
|
|
311
|
-
let latest = (wrapper.emitted()['cilium-values-changed'] || [])[0][0];
|
|
312
|
-
|
|
313
|
-
expect(JSON.stringify(latest)).toStrictEqual(JSON.stringify(legacyOnValue));
|
|
314
|
-
|
|
315
|
-
await wrapper.setProps({ userChartValues: { 'rke2-cilium': latest } });
|
|
316
|
-
|
|
317
|
-
// Click the checkbox to turn ipv6 off again
|
|
318
|
-
await ipv6Checkbox.find('label').trigger('click');
|
|
319
|
-
await ipv6Checkbox.vm.$nextTick();
|
|
320
|
-
await wrapper.vm.$nextTick();
|
|
321
|
-
|
|
322
|
-
// Update from the emitted value
|
|
323
|
-
latest = (wrapper.emitted()['cilium-values-changed'] || [])[1][0];
|
|
324
|
-
|
|
325
|
-
expect(JSON.stringify(latest)).toStrictEqual(JSON.stringify(legacyOffValue));
|
|
326
|
-
});
|
|
327
|
-
|
|
328
|
-
it('should toggle ipv6 on/off with the new structure', async() => {
|
|
329
|
-
const wrapper = createBasicsTab('v1.25.0+rke2r1', {});
|
|
330
|
-
const ipv6Checkbox = wrapper.find('[data-testid="cluster-rke2-cni-ipv6-checkbox"]');
|
|
331
|
-
|
|
332
|
-
expect(ipv6Checkbox.exists()).toBe(true);
|
|
333
|
-
expect(ipv6Checkbox.isVisible()).toBe(true);
|
|
334
|
-
|
|
335
|
-
// Click the checkbox - should enable ipv6
|
|
336
|
-
await ipv6Checkbox.find('label').trigger('click');
|
|
337
|
-
await ipv6Checkbox.vm.$nextTick();
|
|
338
|
-
await wrapper.vm.$nextTick();
|
|
339
|
-
|
|
340
|
-
// Check and update user values with the emitted value
|
|
341
|
-
let latest = (wrapper.emitted()['cilium-values-changed'] || [])[0][0];
|
|
342
|
-
|
|
343
|
-
expect(JSON.stringify(latest)).toStrictEqual(JSON.stringify(newOnValue));
|
|
344
|
-
|
|
345
|
-
await wrapper.setProps({ userChartValues: { 'rke2-cilium': latest } });
|
|
346
|
-
|
|
347
|
-
// Click the checkbox to turn ipv6 off again
|
|
348
|
-
await ipv6Checkbox.find('label').trigger('click');
|
|
349
|
-
await ipv6Checkbox.vm.$nextTick();
|
|
350
|
-
await wrapper.vm.$nextTick();
|
|
351
|
-
|
|
352
|
-
// Update from the emitted value
|
|
353
|
-
latest = (wrapper.emitted()['cilium-values-changed'] || [])[1][0];
|
|
354
|
-
|
|
355
|
-
expect(JSON.stringify(latest)).toStrictEqual(JSON.stringify(newOffValue));
|
|
356
|
-
});
|
|
357
|
-
|
|
358
|
-
it('should migrate when the k8s version is changed', async() => {
|
|
359
|
-
const userChartValues = { 'rke2-cilium': { ipv6: { enabled: true } } };
|
|
360
|
-
const wrapper = createBasicsTab('v1.25.0+rke2r1', userChartValues);
|
|
361
|
-
|
|
362
|
-
// Check that the checkbox is checked
|
|
363
|
-
const ipv6Checkbox = wrapper.find('[data-testid="cluster-rke2-cni-ipv6-checkbox"]') as Checkbox;
|
|
364
|
-
|
|
365
|
-
expect(ipv6Checkbox.exists()).toBe(true);
|
|
366
|
-
expect(ipv6Checkbox.isVisible()).toBe(true);
|
|
367
|
-
expect(ipv6Checkbox.vm.value).toBe(true);
|
|
368
|
-
|
|
369
|
-
// Change the kubernetes version that needs the legacy format
|
|
370
|
-
const k8s123 = mockVersionOptions.find((v) => v.id === 'v1.23.0+rke2r1');
|
|
371
|
-
|
|
372
|
-
await wrapper.setProps({ selectedVersion: k8s123 });
|
|
373
|
-
|
|
374
|
-
let latest = (wrapper.emitted()['cilium-values-changed'] || [])[0][0];
|
|
375
|
-
|
|
376
|
-
expect(JSON.stringify(latest)).toStrictEqual(JSON.stringify(legacyOnValue));
|
|
377
|
-
|
|
378
|
-
// Change back the version so that the new format should be used
|
|
379
|
-
const k8s125 = mockVersionOptions.find((v) => v.id === 'v1.25.0+rke2r1');
|
|
380
|
-
|
|
381
|
-
await wrapper.setProps({ selectedVersion: k8s125 });
|
|
382
|
-
|
|
383
|
-
latest = (wrapper.emitted()['cilium-values-changed'] || [])[1][0];
|
|
384
|
-
expect(JSON.stringify(latest)).toStrictEqual(JSON.stringify(newOnValue));
|
|
385
|
-
});
|
|
386
|
-
});
|
|
387
|
-
|
|
388
|
-
it('should toggle bandwidth manager support on/off', async() => {
|
|
389
|
-
const wrapper = createBasicsTab('v1.25.0+rke2r1', {});
|
|
390
|
-
const bmCheckbox = wrapper.find('[data-testid="cluster-rke2-cni-cilium-bandwidth-manager-checkbox"]');
|
|
391
|
-
|
|
392
|
-
expect(bmCheckbox.exists()).toBe(true);
|
|
393
|
-
expect(bmCheckbox.isVisible()).toBe(true);
|
|
394
|
-
|
|
395
|
-
// Click the checkbox - should enable bandwidth manager
|
|
396
|
-
await bmCheckbox.find('label').trigger('click');
|
|
397
|
-
await bmCheckbox.vm.$nextTick();
|
|
398
|
-
await wrapper.vm.$nextTick();
|
|
399
|
-
|
|
400
|
-
// Check and update user values with the emitted value
|
|
401
|
-
let latest = (wrapper.emitted()['cilium-values-changed'] || [])[0][0];
|
|
402
|
-
|
|
403
|
-
expect(JSON.stringify(latest)).toStrictEqual(JSON.stringify(bmOnValue));
|
|
404
|
-
|
|
405
|
-
await wrapper.setProps({ userChartValues: { 'rke2-cilium': latest } });
|
|
406
|
-
|
|
407
|
-
// Click the checkbox to turn ipv6 off again
|
|
408
|
-
await bmCheckbox.find('label').trigger('click');
|
|
409
|
-
await bmCheckbox.vm.$nextTick();
|
|
410
|
-
await wrapper.vm.$nextTick();
|
|
411
|
-
|
|
412
|
-
// Update from the emitted value
|
|
413
|
-
latest = (wrapper.emitted()['cilium-values-changed'] || [])[1][0];
|
|
414
|
-
|
|
415
|
-
expect(JSON.stringify(latest)).toStrictEqual(JSON.stringify(bmOffValue));
|
|
416
|
-
});
|
|
417
|
-
|
|
418
|
-
it('should support ipv6 and bandwidth manager', async() => {
|
|
419
|
-
const wrapper = createBasicsTab('v1.25.0+rke2r1', {});
|
|
420
|
-
const bmCheckbox = wrapper.find('[data-testid="cluster-rke2-cni-cilium-bandwidth-manager-checkbox"]');
|
|
421
|
-
const ipv6Checkbox = wrapper.find('[data-testid="cluster-rke2-cni-ipv6-checkbox"]');
|
|
422
|
-
|
|
423
|
-
// Click the checkbox - should enable bandwidth manager
|
|
424
|
-
await bmCheckbox.find('label').trigger('click');
|
|
425
|
-
await bmCheckbox.vm.$nextTick();
|
|
426
|
-
await wrapper.vm.$nextTick();
|
|
427
|
-
|
|
428
|
-
let latest = (wrapper.emitted()['cilium-values-changed'] || [])[0][0];
|
|
429
|
-
|
|
430
|
-
await wrapper.setProps({ userChartValues: { 'rke2-cilium': latest } });
|
|
431
|
-
|
|
432
|
-
// Click the checkbox - should enable ipv6
|
|
433
|
-
await ipv6Checkbox.find('label').trigger('click');
|
|
434
|
-
await ipv6Checkbox.vm.$nextTick();
|
|
435
|
-
await wrapper.vm.$nextTick();
|
|
436
|
-
|
|
437
|
-
// Check and update user values with the emitted value
|
|
438
|
-
latest = (wrapper.emitted()['cilium-values-changed'] || [])[1][0];
|
|
439
|
-
|
|
440
|
-
const combined = {
|
|
441
|
-
bandwidthManager: { enabled: true },
|
|
442
|
-
ipv6: { enabled: true }
|
|
443
|
-
};
|
|
444
|
-
|
|
445
|
-
expect(JSON.stringify(latest)).toStrictEqual(JSON.stringify(combined));
|
|
446
|
-
|
|
447
|
-
// Check that other properties are preserved
|
|
448
|
-
latest = {
|
|
449
|
-
...latest,
|
|
450
|
-
bandwidthManager: {
|
|
451
|
-
test: true,
|
|
452
|
-
enabled: false
|
|
453
|
-
},
|
|
454
|
-
ipv6: {
|
|
455
|
-
test: true,
|
|
456
|
-
enabled: false
|
|
457
|
-
}
|
|
458
|
-
};
|
|
459
|
-
|
|
460
|
-
await wrapper.setProps({ userChartValues: { 'rke2-cilium': latest } });
|
|
461
|
-
|
|
462
|
-
// Click the checkbox to turn bandwidth manager off again
|
|
463
|
-
await bmCheckbox.find('label').trigger('click');
|
|
464
|
-
await bmCheckbox.vm.$nextTick();
|
|
465
|
-
await wrapper.vm.$nextTick();
|
|
466
|
-
|
|
467
|
-
latest = (wrapper.emitted()['cilium-values-changed'] || [])[2][0];
|
|
468
|
-
|
|
469
|
-
const expected = '{"bandwidthManager":{"test":true,"enabled":true},"ipv6":{"test":true,"enabled":false}}';
|
|
470
|
-
|
|
471
|
-
expect(JSON.stringify(latest)).toStrictEqual(expected);
|
|
472
|
-
});
|
|
473
|
-
});
|
|
@@ -1,73 +0,0 @@
|
|
|
1
|
-
import { shallowMount, createLocalVue } from '@vue/test-utils';
|
|
2
|
-
import Vuex from 'vuex';
|
|
3
|
-
import ClusterCreate from '@shell/edit/provisioning.cattle.io.cluster/index.vue';
|
|
4
|
-
|
|
5
|
-
describe('component: Cluster: Create', () => {
|
|
6
|
-
it('should hide RKE1 and RKE2 toggle button if RKE1 ui feature flag is NOT set', () => {
|
|
7
|
-
const localVue = createLocalVue();
|
|
8
|
-
|
|
9
|
-
localVue.use(Vuex);
|
|
10
|
-
|
|
11
|
-
const store = new Vuex.Store({
|
|
12
|
-
modules: {
|
|
13
|
-
i18n: {
|
|
14
|
-
namespaced: true,
|
|
15
|
-
getters: {
|
|
16
|
-
t: jest.fn(),
|
|
17
|
-
withFallback: () => jest.fn(),
|
|
18
|
-
}
|
|
19
|
-
},
|
|
20
|
-
features: {
|
|
21
|
-
namespaced: true,
|
|
22
|
-
getters: {
|
|
23
|
-
get: () => jest.fn(),
|
|
24
|
-
withFallback: jest.fn(),
|
|
25
|
-
}
|
|
26
|
-
},
|
|
27
|
-
prefs: {
|
|
28
|
-
namespaced: true,
|
|
29
|
-
getters: { get: jest.fn() }
|
|
30
|
-
},
|
|
31
|
-
mapFeature: {
|
|
32
|
-
namespaced: true,
|
|
33
|
-
getters: { get: jest.fn() }
|
|
34
|
-
},
|
|
35
|
-
'type-map': {
|
|
36
|
-
namespaced: true,
|
|
37
|
-
getters: { activeProducts: () => [] }
|
|
38
|
-
},
|
|
39
|
-
catalog: {
|
|
40
|
-
namespaced: true,
|
|
41
|
-
getters: { charts: () => [] }
|
|
42
|
-
}
|
|
43
|
-
},
|
|
44
|
-
getters: {
|
|
45
|
-
defaultClusterId: jest.fn(),
|
|
46
|
-
clusterId: jest.fn()
|
|
47
|
-
}
|
|
48
|
-
});
|
|
49
|
-
|
|
50
|
-
const wrapper = shallowMount(ClusterCreate, {
|
|
51
|
-
computed: { rke1UiEnabled: () => false },
|
|
52
|
-
propsData: {
|
|
53
|
-
value: { metadata: {}, spec: { template: {} } },
|
|
54
|
-
realMode: '',
|
|
55
|
-
mode: 'edit',
|
|
56
|
-
componentTestid: 'cluster-manager-create',
|
|
57
|
-
},
|
|
58
|
-
mixins: [],
|
|
59
|
-
store,
|
|
60
|
-
localVue,
|
|
61
|
-
mocks: {
|
|
62
|
-
$route: { params: {}, query: {} },
|
|
63
|
-
$router: { applyQuery: jest.fn() },
|
|
64
|
-
$fetchState: { pending: false },
|
|
65
|
-
},
|
|
66
|
-
stubs: { CruResource: { template: '<div><slot name="subtypes"></slot></div>' } }
|
|
67
|
-
});
|
|
68
|
-
|
|
69
|
-
const element = wrapper.find('[data-testid="cluster-manager-create-rke-switch"]').element;
|
|
70
|
-
|
|
71
|
-
expect(element).not.toBeDefined();
|
|
72
|
-
});
|
|
73
|
-
});
|