diff options
Diffstat (limited to 'spec/frontend/clusters')
7 files changed, 2 insertions, 458 deletions
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 6047b404197..e5e336eb3d5 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 @@ -62,6 +62,7 @@ exports[`Remove cluster confirmation modal renders splitbutton with modal includ aria-hidden="true" class="gl-icon s16 gl-new-dropdown-item-check-icon gl-mt-3 gl-align-self-start" data-testid="dropdown-item-checkbox" + role="img" > <use href="#mobile-issue-close" @@ -117,6 +118,7 @@ exports[`Remove cluster confirmation modal renders splitbutton with modal includ aria-hidden="true" class="gl-icon s16 gl-new-dropdown-item-check-icon gl-visibility-hidden gl-mt-3 gl-align-self-start" data-testid="dropdown-item-checkbox" + role="img" > <use href="#mobile-issue-close" diff --git a/spec/frontend/clusters/components/applications_spec.js b/spec/frontend/clusters/components/applications_spec.js index db5915cb1eb..511f5fc1d89 100644 --- a/spec/frontend/clusters/components/applications_spec.js +++ b/spec/frontend/clusters/components/applications_spec.js @@ -2,8 +2,6 @@ import { shallowMount, mount } from '@vue/test-utils'; import ApplicationRow from '~/clusters/components/application_row.vue'; import Applications from '~/clusters/components/applications.vue'; import CrossplaneProviderStack from '~/clusters/components/crossplane_provider_stack.vue'; -import FluentdOutputSettings from '~/clusters/components/fluentd_output_settings.vue'; -import IngressModsecuritySettings from '~/clusters/components/ingress_modsecurity_settings.vue'; import KnativeDomainEditor from '~/clusters/components/knative_domain_editor.vue'; import { CLUSTER_TYPE, PROVIDER_TYPE } from '~/clusters/constants'; import eventHub from '~/clusters/event_hub'; @@ -72,9 +70,6 @@ describe('Applications', () => { expect(wrapper.find('.js-cluster-application-row-elastic_stack').exists()).toBe(true); }); - 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); }); @@ -117,10 +112,6 @@ describe('Applications', () => { expect(wrapper.find('.js-cluster-application-row-elastic_stack').exists()).toBe(true); }); - 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); }); @@ -163,10 +154,6 @@ describe('Applications', () => { expect(wrapper.find('.js-cluster-application-row-elastic_stack').exists()).toBe(true); }); - 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); }); @@ -185,24 +172,6 @@ describe('Applications', () => { expect(findByTestId('ingressCostWarning').element).toMatchSnapshot(); }); - describe('with nested component', () => { - const propsData = { - applications: { - ingress: { - title: 'Ingress', - status: 'installed', - }, - }, - }; - - beforeEach(() => createShallowComponent(propsData)); - - it('renders IngressModsecuritySettings', () => { - const modsecuritySettings = wrapper.find(IngressModsecuritySettings); - expect(modsecuritySettings.exists()).toBe(true); - }); - }); - describe('when installed', () => { describe('with ip address', () => { it('renders ip address with a clipboard button', () => { @@ -231,7 +200,6 @@ describe('Applications', () => { title: 'Ingress', status: 'installed', externalHostname: 'localhost.localdomain', - modsecurity_enabled: false, }, cert_manager: { title: 'Cert-Manager' }, crossplane: { title: 'Crossplane', stack: '' }, @@ -240,7 +208,6 @@ describe('Applications', () => { jupyter: { title: 'JupyterHub', hostname: '' }, knative: { title: 'Knative', hostname: '' }, elastic_stack: { title: 'Elastic Stack' }, - fluentd: { title: 'Fluentd' }, cilium: { title: 'GitLab Container Network Policies' }, }, }); @@ -534,14 +501,6 @@ describe('Applications', () => { }); }); - describe('Fluentd application', () => { - beforeEach(() => createShallowComponent()); - - it('renders the correct Component', () => { - expect(wrapper.find(FluentdOutputSettings).exists()).toBe(true); - }); - }); - describe('Cilium application', () => { it('shows the correct description', () => { createComponent({ propsData: { ciliumHelpPath: 'cilium-help-path' } }); diff --git a/spec/frontend/clusters/components/fluentd_output_settings_spec.js b/spec/frontend/clusters/components/fluentd_output_settings_spec.js deleted file mode 100644 index 2c6e5bbd46a..00000000000 --- a/spec/frontend/clusters/components/fluentd_output_settings_spec.js +++ /dev/null @@ -1,186 +0,0 @@ -import { GlAlert, GlDropdown, GlFormCheckbox } from '@gitlab/ui'; -import { shallowMount } from '@vue/test-utils'; -import FluentdOutputSettings from '~/clusters/components/fluentd_output_settings.vue'; -import { APPLICATION_STATUS, FLUENTD } from '~/clusters/constants'; -import eventHub from '~/clusters/event_hub'; - -const { UPDATING } = APPLICATION_STATUS; - -describe('FluentdOutputSettings', () => { - let wrapper; - - const defaultSettings = { - protocol: 'tcp', - host: '127.0.0.1', - port: 514, - wafLogEnabled: true, - ciliumLogEnabled: false, - }; - const defaultProps = { - status: 'installable', - updateFailed: false, - ...defaultSettings, - }; - - const createComponent = (props = {}) => { - wrapper = shallowMount(FluentdOutputSettings, { - propsData: { - ...defaultProps, - ...props, - }, - }); - }; - const updateComponentPropsFromEvent = () => { - const { isEditingSettings, ...props } = eventHub.$emit.mock.calls[0][1]; - wrapper.setProps(props); - }; - const findSaveButton = () => wrapper.find({ ref: 'saveBtn' }); - const findCancelButton = () => wrapper.find({ ref: 'cancelBtn' }); - const findProtocolDropdown = () => wrapper.find(GlDropdown); - const findCheckbox = (name) => - wrapper.findAll(GlFormCheckbox).wrappers.find((x) => x.text() === name); - const findHost = () => wrapper.find('#fluentd-host'); - const findPort = () => wrapper.find('#fluentd-port'); - const changeCheckbox = (checkbox) => { - const currentValue = checkbox.attributes('checked')?.toString() === 'true'; - checkbox.vm.$emit('input', !currentValue); - }; - const changeInput = ({ element }, val) => { - element.value = val; - element.dispatchEvent(new Event('input')); - }; - const changePort = (val) => changeInput(findPort(), val); - const changeHost = (val) => changeInput(findHost(), val); - const changeProtocol = (idx) => findProtocolDropdown().vm.$children[idx].$emit('click'); - const toApplicationSettings = ({ wafLogEnabled, ciliumLogEnabled, ...settings }) => ({ - ...settings, - waf_log_enabled: wafLogEnabled, - cilium_log_enabled: ciliumLogEnabled, - }); - - describe('when fluentd is installed', () => { - beforeEach(() => { - createComponent({ status: 'installed' }); - jest.spyOn(eventHub, '$emit'); - }); - - it('does not render save and cancel buttons', () => { - expect(findSaveButton().exists()).toBe(false); - expect(findCancelButton().exists()).toBe(false); - }); - - describe.each` - desc | changeFn | key | value - ${'when protocol dropdown is triggered'} | ${() => changeProtocol(1)} | ${'protocol'} | ${'udp'} - ${'when host is changed'} | ${() => changeHost('test-host')} | ${'host'} | ${'test-host'} - ${'when port is changed'} | ${() => changePort(123)} | ${'port'} | ${123} - ${'when wafLogEnabled changes'} | ${() => changeCheckbox(findCheckbox('Send Web Application Firewall Logs'))} | ${'wafLogEnabled'} | ${!defaultSettings.wafLogEnabled} - ${'when ciliumLogEnabled changes'} | ${() => changeCheckbox(findCheckbox('Send Container Network Policies Logs'))} | ${'ciliumLogEnabled'} | ${!defaultSettings.ciliumLogEnabled} - `('$desc', ({ changeFn, key, value }) => { - beforeEach(() => { - changeFn(); - }); - - it('triggers set event to be propagated with the current value', () => { - expect(eventHub.$emit).toHaveBeenCalledWith('setFluentdSettings', { - [key]: value, - isEditingSettings: true, - }); - }); - - describe('when value is updated from store', () => { - beforeEach(() => { - updateComponentPropsFromEvent(); - }); - - it('enables save and cancel buttons', () => { - expect(findSaveButton().exists()).toBe(true); - expect(findSaveButton().attributes().disabled).toBeUndefined(); - expect(findCancelButton().exists()).toBe(true); - expect(findCancelButton().attributes().disabled).toBeUndefined(); - }); - - describe('and the save changes button is clicked', () => { - beforeEach(() => { - eventHub.$emit.mockClear(); - findSaveButton().vm.$emit('click'); - }); - - it('triggers save event and pass current values', () => { - expect(eventHub.$emit).toHaveBeenCalledWith('updateApplication', { - id: FLUENTD, - params: toApplicationSettings({ - ...defaultSettings, - [key]: value, - }), - }); - }); - }); - - describe('and the cancel button is clicked', () => { - beforeEach(() => { - eventHub.$emit.mockClear(); - findCancelButton().vm.$emit('click'); - }); - - it('triggers reset event', () => { - expect(eventHub.$emit).toHaveBeenCalledWith('setFluentdSettings', { - ...defaultSettings, - isEditingSettings: false, - }); - }); - - describe('when value is updated from store', () => { - beforeEach(() => { - updateComponentPropsFromEvent(); - }); - - it('does not render save and cancel buttons', () => { - expect(findSaveButton().exists()).toBe(false); - expect(findCancelButton().exists()).toBe(false); - }); - }); - }); - }); - }); - - describe(`when fluentd status is ${UPDATING}`, () => { - beforeEach(() => { - createComponent({ installed: true, status: UPDATING }); - }); - - it('renders loading spinner in save button', () => { - expect(findSaveButton().props('loading')).toBe(true); - }); - - it('renders disabled save button', () => { - expect(findSaveButton().props('disabled')).toBe(true); - }); - - it('renders save button with "Saving" label', () => { - expect(findSaveButton().text()).toBe('Saving'); - }); - }); - - describe('when fluentd fails to update', () => { - beforeEach(() => { - createComponent({ updateFailed: true }); - }); - - it('displays a error message', () => { - expect(wrapper.find(GlAlert).exists()).toBe(true); - }); - }); - }); - - describe('when fluentd is not installed', () => { - beforeEach(() => { - createComponent(); - }); - - it('does not render the save button', () => { - expect(findSaveButton().exists()).toBe(false); - expect(findCancelButton().exists()).toBe(false); - }); - }); -}); diff --git a/spec/frontend/clusters/components/ingress_modsecurity_settings_spec.js b/spec/frontend/clusters/components/ingress_modsecurity_settings_spec.js deleted file mode 100644 index f83a350a27c..00000000000 --- a/spec/frontend/clusters/components/ingress_modsecurity_settings_spec.js +++ /dev/null @@ -1,192 +0,0 @@ -import { GlAlert, GlToggle, GlDropdown } from '@gitlab/ui'; -import { shallowMount } from '@vue/test-utils'; -import IngressModsecuritySettings from '~/clusters/components/ingress_modsecurity_settings.vue'; -import { APPLICATION_STATUS, INGRESS } from '~/clusters/constants'; -import eventHub from '~/clusters/event_hub'; - -const { UPDATING } = APPLICATION_STATUS; - -describe('IngressModsecuritySettings', () => { - let wrapper; - - const defaultProps = { - modsecurity_enabled: false, - status: 'installable', - installed: false, - modsecurity_mode: 'logging', - updateAvailable: false, - }; - - const createComponent = (props = defaultProps) => { - wrapper = shallowMount(IngressModsecuritySettings, { - propsData: { - ingress: { - ...defaultProps, - ...props, - }, - }, - }); - }; - - const findSaveButton = () => - wrapper.find('[data-qa-selector="save_ingress_modsecurity_settings"]'); - const findCancelButton = () => - wrapper.find('[data-qa-selector="cancel_ingress_modsecurity_settings"]'); - const findModSecurityToggle = () => wrapper.find(GlToggle); - const findModSecurityDropdown = () => wrapper.find(GlDropdown); - - describe('when ingress is installed', () => { - beforeEach(() => { - createComponent({ installed: true, status: 'installed' }); - jest.spyOn(eventHub, '$emit'); - }); - - it('does not render save and cancel buttons', () => { - expect(findSaveButton().exists()).toBe(false); - expect(findCancelButton().exists()).toBe(false); - }); - - describe('with toggle changed by the user', () => { - beforeEach(() => { - findModSecurityToggle().vm.$emit('change'); - wrapper.setProps({ - ingress: { - ...defaultProps, - installed: true, - status: 'installed', - modsecurity_enabled: true, - }, - }); - }); - - it('renders toggle with label', () => { - expect(findModSecurityToggle().props('label')).toBe( - IngressModsecuritySettings.i18n.modSecurityEnabled, - ); - }); - - it('renders save and cancel buttons', () => { - expect(findSaveButton().exists()).toBe(true); - expect(findCancelButton().exists()).toBe(true); - }); - - it('enables related toggle and buttons', () => { - expect(findSaveButton().attributes().disabled).toBeUndefined(); - expect(findCancelButton().attributes().disabled).toBeUndefined(); - }); - - describe('with dropdown changed by the user', () => { - beforeEach(() => { - findModSecurityDropdown().vm.$children[1].$emit('click'); - wrapper.setProps({ - ingress: { - ...defaultProps, - installed: true, - status: 'installed', - modsecurity_enabled: true, - modsecurity_mode: 'blocking', - }, - }); - }); - - it('renders both save and cancel buttons', () => { - expect(findSaveButton().exists()).toBe(true); - expect(findCancelButton().exists()).toBe(true); - }); - - describe('and the save changes button is clicked', () => { - beforeEach(() => { - findSaveButton().vm.$emit('click'); - }); - - it('triggers save event and pass current modsecurity value', () => { - expect(eventHub.$emit).toHaveBeenCalledWith('updateApplication', { - id: INGRESS, - params: { modsecurity_enabled: true, modsecurity_mode: 'blocking' }, - }); - }); - }); - }); - - describe('and the cancel button is clicked', () => { - beforeEach(() => { - findCancelButton().vm.$emit('click'); - }); - - it('triggers reset event and hides both cancel and save changes button', () => { - expect(eventHub.$emit).toHaveBeenCalledWith('resetIngressModSecurityChanges', INGRESS); - expect(findSaveButton().exists()).toBe(false); - expect(findCancelButton().exists()).toBe(false); - }); - }); - - describe('with a new version available', () => { - beforeEach(() => { - wrapper.setProps({ - ingress: { - ...defaultProps, - installed: true, - status: 'installed', - modsecurity_enabled: true, - updateAvailable: true, - }, - }); - }); - - it('disables related toggle and buttons', () => { - expect(findSaveButton().attributes().disabled).toBe('true'); - expect(findCancelButton().attributes().disabled).toBe('true'); - }); - }); - }); - - it('triggers set event to be propagated with the current modsecurity value', () => { - wrapper.setData({ modSecurityEnabled: true }); - return wrapper.vm.$nextTick().then(() => { - expect(eventHub.$emit).toHaveBeenCalledWith('setIngressModSecurityEnabled', { - id: INGRESS, - modSecurityEnabled: true, - }); - }); - }); - - describe(`when ingress status is ${UPDATING}`, () => { - beforeEach(() => { - createComponent({ installed: true, status: UPDATING }); - }); - - it('renders loading spinner in save button', () => { - expect(findSaveButton().props('loading')).toBe(true); - }); - - it('renders disabled save button', () => { - expect(findSaveButton().props('disabled')).toBe(true); - }); - - it('renders save button with "Saving" label', () => { - expect(findSaveButton().text()).toBe('Saving'); - }); - }); - - describe('when ingress fails to update', () => { - beforeEach(() => { - createComponent({ updateFailed: true }); - }); - - it('displays a error message', () => { - expect(wrapper.find(GlAlert).exists()).toBe(true); - }); - }); - }); - - describe('when ingress is not installed', () => { - beforeEach(() => { - createComponent(); - }); - - it('does not render the save button', () => { - expect(findSaveButton().exists()).toBe(false); - expect(findModSecurityToggle().props('value')).toBe(false); - }); - }); -}); diff --git a/spec/frontend/clusters/forms/components/integration_form_spec.js b/spec/frontend/clusters/forms/components/integration_form_spec.js index c5cec4c4fdb..b129baa2d83 100644 --- a/spec/frontend/clusters/forms/components/integration_form_spec.js +++ b/spec/frontend/clusters/forms/components/integration_form_spec.js @@ -15,7 +15,6 @@ describe('ClusterIntegrationForm', () => { editable: true, environmentScope: '*', baseDomain: 'testDomain', - applicationIngressExternalIp: null, }; const createWrapper = (storeValues = defaultStoreValues) => { @@ -72,18 +71,6 @@ describe('ClusterIntegrationForm', () => { expect(findSubmitButton().exists()).toBe(false); }); }); - - it('does not render external IP block if applicationIngressExternalIp was not passed', () => { - createWrapper({ ...defaultStoreValues }); - - expect(wrapper.find('.js-ingress-domain-help-text').exists()).toBe(false); - }); - - it('renders external IP block if applicationIngressExternalIp was passed', () => { - createWrapper({ ...defaultStoreValues, applicationIngressExternalIp: '127.0.0.1' }); - - expect(wrapper.find('.js-ingress-domain-help-text').exists()).toBe(true); - }); }); describe('reactivity', () => { diff --git a/spec/frontend/clusters/services/mock_data.js b/spec/frontend/clusters/services/mock_data.js index 4f8b27d623c..a75fcb0cb06 100644 --- a/spec/frontend/clusters/services/mock_data.js +++ b/spec/frontend/clusters/services/mock_data.js @@ -20,7 +20,6 @@ const CLUSTERS_MOCK_DATA = { external_ip: null, external_hostname: null, can_uninstall: false, - modsecurity_enabled: false, }, { name: 'runner', @@ -154,7 +153,6 @@ const APPLICATIONS_MOCK_STATE = { ingress: { title: 'Ingress', status: 'installable', - modsecurity_enabled: false, }, crossplane: { title: 'Crossplane', status: 'installable', stack: '' }, cert_manager: { title: 'Cert-Manager', status: 'installable' }, @@ -163,7 +161,6 @@ const APPLICATIONS_MOCK_STATE = { jupyter: { title: 'JupyterHub', status: 'installable', hostname: '' }, 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', diff --git a/spec/frontend/clusters/stores/clusters_store_spec.js b/spec/frontend/clusters/stores/clusters_store_spec.js index c80949531c8..cdba6fc6ab8 100644 --- a/spec/frontend/clusters/stores/clusters_store_spec.js +++ b/spec/frontend/clusters/stores/clusters_store_spec.js @@ -84,16 +84,12 @@ describe('Clusters Store', () => { externalHostname: null, installable: true, installed: false, - isEditingModSecurityEnabled: false, - isEditingModSecurityMode: false, installFailed: true, uninstallable: false, updateFailed: false, uninstallSuccessful: false, uninstallFailed: false, validationError: null, - modsecurity_enabled: false, - modsecurity_mode: undefined, }, runner: { title: 'GitLab Runner', @@ -126,25 +122,6 @@ describe('Clusters Store', () => { uninstallFailed: false, validationError: null, }, - fluentd: { - title: 'Fluentd', - status: null, - statusReason: null, - requestReason: null, - port: null, - ciliumLogEnabled: null, - host: null, - protocol: null, - installable: true, - installed: false, - isEditingSettings: false, - installFailed: false, - uninstallable: false, - uninstallSuccessful: false, - uninstallFailed: false, - validationError: null, - wafLogEnabled: null, - }, jupyter: { title: 'JupyterHub', status: mockResponseData.applications[4].status, |