diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-07-29 12:09:33 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-07-29 12:09:33 +0300 |
commit | b4dc6516ae8662e23e6fd8331656a91f9e853417 (patch) | |
tree | dc661c605af627ea9306dc592433c40b9cc0e832 /spec/frontend/clusters | |
parent | 3fa28959b9c657503c98caa0e535d39f51ad2c31 (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/frontend/clusters')
6 files changed, 112 insertions, 4 deletions
diff --git a/spec/frontend/clusters/components/__snapshots__/applications_spec.js.snap b/spec/frontend/clusters/components/__snapshots__/applications_spec.js.snap index 92237590550..3328ec724fd 100644 --- a/spec/frontend/clusters/components/__snapshots__/applications_spec.js.snap +++ b/spec/frontend/clusters/components/__snapshots__/applications_spec.js.snap @@ -17,6 +17,22 @@ exports[`Applications Cert-Manager application shows the correct description 1`] </p> `; +exports[`Applications Cilium application shows the correct description 1`] = ` +<p + data-testid="ciliumDescription" +> + Protect your clusters with GitLab Container Network Policies by enforcing how pods communicate with each other and other network endpoints. + <a + class="gl-link" + href="cilium-help-path" + rel="noopener" + target="_blank" + > + Learn more about configuring Network Policies here. + </a> +</p> +`; + exports[`Applications Crossplane application shows the correct description 1`] = ` <p data-testid="crossplaneDescription" diff --git a/spec/frontend/clusters/components/application_row_spec.js b/spec/frontend/clusters/components/application_row_spec.js index 94bdd7b7778..b97d4dbf355 100644 --- a/spec/frontend/clusters/components/application_row_spec.js +++ b/spec/frontend/clusters/components/application_row_spec.js @@ -83,6 +83,12 @@ describe('Application Row', () => { checkButtonState('Installing', true, true); }); + it('has disabled "Install" when APPLICATION_STATUS.UNINSTALLED', () => { + mountComponent({ status: APPLICATION_STATUS.UNINSTALLED }); + + checkButtonState('Install', false, true); + }); + it('has disabled "Installed" when application is installed and not uninstallable', () => { mountComponent({ status: APPLICATION_STATUS.INSTALLED, @@ -112,6 +118,15 @@ describe('Application Row', () => { checkButtonState('Install', false, false); }); + it('has disabled "Install" when installation disabled', () => { + mountComponent({ + status: APPLICATION_STATUS.INSTALLABLE, + installable: false, + }); + + checkButtonState('Install', false, true); + }); + it('has enabled "Install" when REQUEST_FAILURE (so you can try installing again)', () => { mountComponent({ status: APPLICATION_STATUS.INSTALLABLE }); diff --git a/spec/frontend/clusters/components/applications_spec.js b/spec/frontend/clusters/components/applications_spec.js index 7fc771201c1..4faf6814186 100644 --- a/spec/frontend/clusters/components/applications_spec.js +++ b/spec/frontend/clusters/components/applications_spec.js @@ -17,7 +17,7 @@ describe('Applications', () => { gon.features.managedAppsLocalTiller = false; }); - const createApp = ({ applications, type } = {}, isShallow) => { + const createApp = ({ applications, type, props } = {}, isShallow) => { const mountMethod = isShallow ? shallowMount : mount; wrapper = mountMethod(Applications, { @@ -25,6 +25,7 @@ describe('Applications', () => { propsData: { type, applications: { ...APPLICATIONS_MOCK_STATE, ...applications }, + ...props, }, }); }; @@ -79,6 +80,9 @@ describe('Applications', () => { it('renders a row for Fluentd', () => { expect(wrapper.find('.js-cluster-application-row-fluentd').exists()).toBe(true); }); + it('renders a row for Cilium', () => { + expect(wrapper.find('.js-cluster-application-row-cilium').exists()).toBe(true); + }); }); describe('Group cluster applications', () => { @@ -125,6 +129,10 @@ describe('Applications', () => { it('renders a row for Fluentd', () => { expect(wrapper.find('.js-cluster-application-row-fluentd').exists()).toBe(true); }); + + it('renders a row for Cilium', () => { + expect(wrapper.find('.js-cluster-application-row-cilium').exists()).toBe(true); + }); }); describe('Instance cluster applications', () => { @@ -171,6 +179,10 @@ describe('Applications', () => { it('renders a row for Fluentd', () => { expect(wrapper.find('.js-cluster-application-row-fluentd').exists()).toBe(true); }); + + it('renders a row for Cilium', () => { + expect(wrapper.find('.js-cluster-application-row-cilium').exists()).toBe(true); + }); }); describe('Helm application', () => { @@ -249,6 +261,7 @@ describe('Applications', () => { knative: { title: 'Knative', hostname: '' }, elastic_stack: { title: 'Elastic Stack' }, fluentd: { title: 'Fluentd' }, + cilium: { title: 'GitLab Container Network Policies' }, }, }); @@ -365,7 +378,11 @@ describe('Applications', () => { it('renders readonly input', () => { createApp({ applications: { - ingress: { title: 'Ingress', status: 'installed', externalIp: '1.1.1.1' }, + ingress: { + title: 'Ingress', + status: 'installed', + externalIp: '1.1.1.1', + }, jupyter: { title: 'JupyterHub', status: 'installed', hostname: '' }, }, }); @@ -552,4 +569,11 @@ describe('Applications', () => { expect(wrapper.find(FluentdOutputSettings).exists()).toBe(true); }); }); + + describe('Cilium application', () => { + it('shows the correct description', () => { + createApp({ props: { ciliumHelpPath: 'cilium-help-path' } }); + expect(findByTestId('ciliumDescription').element).toMatchSnapshot(); + }); + }); }); diff --git a/spec/frontend/clusters/services/application_state_machine_spec.js b/spec/frontend/clusters/services/application_state_machine_spec.js index b27cd2c80fd..7eee54949fa 100644 --- a/spec/frontend/clusters/services/application_state_machine_spec.js +++ b/spec/frontend/clusters/services/application_state_machine_spec.js @@ -19,6 +19,7 @@ const { UPDATE_ERRORED, UNINSTALLING, UNINSTALL_ERRORED, + UNINSTALLED, } = APPLICATION_STATUS; const NO_EFFECTS = 'no effects'; @@ -40,6 +41,7 @@ describe('applicationStateMachine', () => { ${INSTALLED} | ${UPDATE_ERRORED} | ${{ updateFailed: true }} ${UNINSTALLING} | ${UNINSTALLING} | ${NO_EFFECTS} ${INSTALLED} | ${UNINSTALL_ERRORED} | ${{ uninstallFailed: true }} + ${UNINSTALLED} | ${UNINSTALLED} | ${NO_EFFECTS} `(`transitions to $expectedState on $event event and applies $effects`, data => { const { expectedState, event, effects } = data; const currentAppState = { @@ -74,8 +76,9 @@ describe('applicationStateMachine', () => { it.each` expectedState | event | effects ${INSTALLING} | ${INSTALL_EVENT} | ${{ installFailed: false }} - ${INSTALLED} | ${INSTALLED} | ${NO_EFFECTS} + ${INSTALLED} | ${INSTALLED} | ${{ installFailed: false }} ${NOT_INSTALLABLE} | ${NOT_INSTALLABLE} | ${NO_EFFECTS} + ${UNINSTALLED} | ${UNINSTALLED} | ${{ installFailed: false }} `(`transitions to $expectedState on $event event and applies $effects`, data => { const { expectedState, event, effects } = data; const currentAppState = { @@ -113,6 +116,8 @@ describe('applicationStateMachine', () => { ${UPDATING} | ${UPDATE_EVENT} | ${{ updateFailed: false, updateSuccessful: false }} ${UNINSTALLING} | ${UNINSTALL_EVENT} | ${{ uninstallFailed: false, uninstallSuccessful: false }} ${NOT_INSTALLABLE} | ${NOT_INSTALLABLE} | ${NO_EFFECTS} + ${UNINSTALLED} | ${UNINSTALLED} | ${NO_EFFECTS} + ${INSTALLABLE} | ${ERROR} | ${{ installFailed: true }} `(`transitions to $expectedState on $event event and applies $effects`, data => { const { expectedState, event, effects } = data; const currentAppState = { @@ -162,6 +167,23 @@ describe('applicationStateMachine', () => { }); }); + describe(`current state is ${UNINSTALLED}`, () => { + it.each` + expectedState | event | effects + ${INSTALLED} | ${INSTALLED} | ${NO_EFFECTS} + ${INSTALLABLE} | ${ERROR} | ${{ installFailed: true }} + `(`transitions to $expectedState on $event event and applies $effects`, data => { + const { expectedState, event, effects } = data; + const currentAppState = { + status: UNINSTALLED, + }; + + expect(transitionApplicationState(currentAppState, event)).toEqual({ + status: expectedState, + ...noEffectsToEmptyObject(effects), + }); + }); + }); describe('current state is undefined', () => { it('returns the current state without having any effects', () => { const currentAppState = {}; diff --git a/spec/frontend/clusters/services/mock_data.js b/spec/frontend/clusters/services/mock_data.js index c5ec3f6e6a8..4f8b27d623c 100644 --- a/spec/frontend/clusters/services/mock_data.js +++ b/spec/frontend/clusters/services/mock_data.js @@ -151,7 +151,11 @@ const DEFAULT_APPLICATION_STATE = { const APPLICATIONS_MOCK_STATE = { helm: { title: 'Helm Tiller', status: 'installable' }, - ingress: { title: 'Ingress', status: 'installable', modsecurity_enabled: false }, + ingress: { + title: 'Ingress', + status: 'installable', + modsecurity_enabled: false, + }, crossplane: { title: 'Crossplane', status: 'installable', stack: '' }, cert_manager: { title: 'Cert-Manager', status: 'installable' }, runner: { title: 'GitLab Runner' }, @@ -160,6 +164,10 @@ const APPLICATIONS_MOCK_STATE = { knative: { title: 'Knative ', status: 'installable', hostname: '' }, elastic_stack: { title: 'Elastic Stack', status: 'installable' }, fluentd: { title: 'Fluentd', status: 'installable' }, + cilium: { + title: 'GitLab Container Network Policies', + status: 'not_installable', + }, }; export { CLUSTERS_MOCK_DATA, DEFAULT_APPLICATION_STATE, APPLICATIONS_MOCK_STATE }; diff --git a/spec/frontend/clusters/stores/clusters_store_spec.js b/spec/frontend/clusters/stores/clusters_store_spec.js index 36e99c37be5..ed862818c7b 100644 --- a/spec/frontend/clusters/stores/clusters_store_spec.js +++ b/spec/frontend/clusters/stores/clusters_store_spec.js @@ -66,6 +66,7 @@ describe('Clusters Store', () => { status: mockResponseData.applications[0].status, statusReason: mockResponseData.applications[0].status_reason, requestReason: null, + installable: true, installed: false, installFailed: false, uninstallable: false, @@ -80,6 +81,7 @@ describe('Clusters Store', () => { requestReason: null, externalIp: null, externalHostname: null, + installable: true, installed: false, isEditingModSecurityEnabled: false, isEditingModSecurityMode: false, @@ -100,6 +102,7 @@ describe('Clusters Store', () => { version: mockResponseData.applications[2].version, updateAvailable: mockResponseData.applications[2].update_available, chartRepo: 'https://gitlab.com/gitlab-org/charts/gitlab-runner', + installable: true, installed: false, installFailed: false, updateFailed: false, @@ -114,6 +117,7 @@ describe('Clusters Store', () => { status: APPLICATION_STATUS.INSTALLABLE, statusReason: mockResponseData.applications[3].status_reason, requestReason: null, + installable: true, installed: false, installFailed: true, uninstallable: false, @@ -130,6 +134,7 @@ describe('Clusters Store', () => { ciliumLogEnabled: null, host: null, protocol: null, + installable: true, installed: false, isEditingSettings: false, installFailed: false, @@ -145,6 +150,7 @@ describe('Clusters Store', () => { statusReason: mockResponseData.applications[4].status_reason, requestReason: null, hostname: '', + installable: true, installed: false, installFailed: false, uninstallable: false, @@ -161,6 +167,7 @@ describe('Clusters Store', () => { isEditingDomain: false, externalIp: null, externalHostname: null, + installable: true, installed: false, installFailed: false, uninstallable: false, @@ -177,6 +184,7 @@ describe('Clusters Store', () => { statusReason: mockResponseData.applications[6].status_reason, requestReason: null, email: mockResponseData.applications[6].email, + installable: true, installed: false, uninstallable: false, uninstallSuccessful: false, @@ -189,6 +197,7 @@ describe('Clusters Store', () => { installFailed: true, statusReason: mockResponseData.applications[7].status_reason, requestReason: null, + installable: true, installed: false, uninstallable: false, uninstallSuccessful: false, @@ -201,12 +210,26 @@ describe('Clusters Store', () => { installFailed: true, statusReason: mockResponseData.applications[8].status_reason, requestReason: null, + installable: true, installed: false, uninstallable: false, uninstallSuccessful: false, uninstallFailed: false, validationError: null, }, + cilium: { + title: 'GitLab Container Network Policies', + status: null, + statusReason: null, + requestReason: null, + installable: false, + installed: false, + installFailed: false, + uninstallable: false, + uninstallSuccessful: false, + uninstallFailed: false, + validationError: null, + }, }, environments: [], fetchingEnvironments: false, |