diff options
Diffstat (limited to 'spec/frontend/clusters/components')
7 files changed, 71 insertions, 42 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/__snapshots__/remove_cluster_confirmation_spec.js.snap b/spec/frontend/clusters/components/__snapshots__/remove_cluster_confirmation_spec.js.snap index d4269bf14ba..93b757e008a 100644 --- a/spec/frontend/clusters/components/__snapshots__/remove_cluster_confirmation_spec.js.snap +++ b/spec/frontend/clusters/components/__snapshots__/remove_cluster_confirmation_spec.js.snap @@ -1,7 +1,9 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`Remove cluster confirmation modal renders splitbutton with modal included 1`] = ` -<div> +<div + class="gl-display-flex gl-justify-content-end" +> <div class="dropdown b-dropdown gl-dropdown btn-group" > 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..e0ccf36e868 100644 --- a/spec/frontend/clusters/components/applications_spec.js +++ b/spec/frontend/clusters/components/applications_spec.js @@ -14,10 +14,9 @@ describe('Applications', () => { beforeEach(() => { gon.features = gon.features || {}; - 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 +24,7 @@ describe('Applications', () => { propsData: { type, applications: { ...APPLICATIONS_MOCK_STATE, ...applications }, + ...props, }, }); }; @@ -40,10 +40,6 @@ describe('Applications', () => { createApp({ type: CLUSTER_TYPE.PROJECT }); }); - it('renders a row for Helm Tiller', () => { - expect(wrapper.find('.js-cluster-application-row-helm').exists()).toBe(true); - }); - it('renders a row for Ingress', () => { expect(wrapper.find('.js-cluster-application-row-ingress').exists()).toBe(true); }); @@ -79,6 +75,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', () => { @@ -86,10 +85,6 @@ describe('Applications', () => { createApp({ type: CLUSTER_TYPE.GROUP }); }); - it('renders a row for Helm Tiller', () => { - expect(wrapper.find('.js-cluster-application-row-helm').exists()).toBe(true); - }); - it('renders a row for Ingress', () => { expect(wrapper.find('.js-cluster-application-row-ingress').exists()).toBe(true); }); @@ -125,6 +120,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', () => { @@ -132,10 +131,6 @@ describe('Applications', () => { createApp({ type: CLUSTER_TYPE.INSTANCE }); }); - it('renders a row for Helm Tiller', () => { - expect(wrapper.find('.js-cluster-application-row-helm').exists()).toBe(true); - }); - it('renders a row for Ingress', () => { expect(wrapper.find('.js-cluster-application-row-ingress').exists()).toBe(true); }); @@ -171,18 +166,16 @@ 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', () => { - describe('when managedAppsLocalTiller enabled', () => { - beforeEach(() => { - gon.features.managedAppsLocalTiller = true; - }); - - it('does not render a row for Helm Tiller', () => { - createApp(); - expect(wrapper.find('.js-cluster-application-row-helm').exists()).toBe(false); - }); + it('does not render a row for Helm Tiller', () => { + createApp(); + expect(wrapper.find('.js-cluster-application-row-helm').exists()).toBe(false); }); }); @@ -240,7 +233,6 @@ describe('Applications', () => { externalHostname: 'localhost.localdomain', modsecurity_enabled: false, }, - helm: { title: 'Helm Tiller' }, cert_manager: { title: 'Cert-Manager' }, crossplane: { title: 'Crossplane', stack: '' }, runner: { title: 'GitLab Runner' }, @@ -249,6 +241,7 @@ describe('Applications', () => { knative: { title: 'Knative', hostname: '' }, elastic_stack: { title: 'Elastic Stack' }, fluentd: { title: 'Fluentd' }, + cilium: { title: 'GitLab Container Network Policies' }, }, }); @@ -365,7 +358,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: '' }, }, }); @@ -386,14 +383,6 @@ describe('Applications', () => { false, ); }); - - it('renders disabled install button', () => { - expect( - wrapper - .find('.js-cluster-application-row-jupyter .js-cluster-application-install-button') - .attributes('disabled'), - ).toEqual('disabled'); - }); }); }); @@ -513,7 +502,7 @@ describe('Applications', () => { describe('Elastic Stack application', () => { describe('with elastic stack installable', () => { - it('renders hostname active input', () => { + it('renders the install button enabled', () => { createApp(); expect( @@ -522,7 +511,7 @@ describe('Applications', () => { '.js-cluster-application-row-elastic_stack .js-cluster-application-install-button', ) .attributes('disabled'), - ).toEqual('disabled'); + ).toBeUndefined(); }); }); @@ -552,4 +541,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/components/fluentd_output_settings_spec.js b/spec/frontend/clusters/components/fluentd_output_settings_spec.js index f03f2535947..0bc4eb73bf9 100644 --- a/spec/frontend/clusters/components/fluentd_output_settings_spec.js +++ b/spec/frontend/clusters/components/fluentd_output_settings_spec.js @@ -1,7 +1,7 @@ import { shallowMount } from '@vue/test-utils'; +import { GlAlert, GlDeprecatedDropdown, GlFormCheckbox } from '@gitlab/ui'; import FluentdOutputSettings from '~/clusters/components/fluentd_output_settings.vue'; import { APPLICATION_STATUS, FLUENTD } from '~/clusters/constants'; -import { GlAlert, GlDropdown, GlFormCheckbox } from '@gitlab/ui'; import eventHub from '~/clusters/event_hub'; const { UPDATING } = APPLICATION_STATUS; @@ -36,7 +36,7 @@ describe('FluentdOutputSettings', () => { }; const findSaveButton = () => wrapper.find({ ref: 'saveBtn' }); const findCancelButton = () => wrapper.find({ ref: 'cancelBtn' }); - const findProtocolDropdown = () => wrapper.find(GlDropdown); + const findProtocolDropdown = () => wrapper.find(GlDeprecatedDropdown); const findCheckbox = name => wrapper.findAll(GlFormCheckbox).wrappers.find(x => x.text() === name); const findHost = () => wrapper.find('#fluentd-host'); diff --git a/spec/frontend/clusters/components/ingress_modsecurity_settings_spec.js b/spec/frontend/clusters/components/ingress_modsecurity_settings_spec.js index 683f2e5c35a..3a9a608b2e2 100644 --- a/spec/frontend/clusters/components/ingress_modsecurity_settings_spec.js +++ b/spec/frontend/clusters/components/ingress_modsecurity_settings_spec.js @@ -1,7 +1,7 @@ import { shallowMount } from '@vue/test-utils'; +import { GlAlert, GlToggle, GlDeprecatedDropdown } from '@gitlab/ui'; import IngressModsecuritySettings from '~/clusters/components/ingress_modsecurity_settings.vue'; import { APPLICATION_STATUS, INGRESS } from '~/clusters/constants'; -import { GlAlert, GlToggle, GlDropdown } from '@gitlab/ui'; import eventHub from '~/clusters/event_hub'; const { UPDATING } = APPLICATION_STATUS; @@ -31,7 +31,7 @@ describe('IngressModsecuritySettings', () => { const findSaveButton = () => wrapper.find('.btn-success'); const findCancelButton = () => wrapper.find('[variant="secondary"]'); const findModSecurityToggle = () => wrapper.find(GlToggle); - const findModSecurityDropdown = () => wrapper.find(GlDropdown); + const findModSecurityDropdown = () => wrapper.find(GlDeprecatedDropdown); describe('when ingress is installed', () => { beforeEach(() => { diff --git a/spec/frontend/clusters/components/knative_domain_editor_spec.js b/spec/frontend/clusters/components/knative_domain_editor_spec.js index 73d08661199..a07258dcc69 100644 --- a/spec/frontend/clusters/components/knative_domain_editor_spec.js +++ b/spec/frontend/clusters/components/knative_domain_editor_spec.js @@ -1,5 +1,5 @@ import { shallowMount } from '@vue/test-utils'; -import { GlDropdownItem } from '@gitlab/ui'; +import { GlDeprecatedDropdownItem } from '@gitlab/ui'; import KnativeDomainEditor from '~/clusters/components/knative_domain_editor.vue'; import LoadingButton from '~/vue_shared/components/loading_button.vue'; import { APPLICATION_STATUS } from '~/clusters/constants'; @@ -113,7 +113,7 @@ describe('KnativeDomainEditor', () => { createComponent({ knative: { ...knative, availableDomains: [newDomain] } }); jest.spyOn(wrapper.vm, 'selectDomain'); - wrapper.find(GlDropdownItem).vm.$emit('click'); + wrapper.find(GlDeprecatedDropdownItem).vm.$emit('click'); return wrapper.vm.$nextTick().then(() => { expect(wrapper.vm.selectDomain).toHaveBeenCalledWith(newDomain); |