diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2021-06-11 09:10:03 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2021-06-11 09:10:03 +0300 |
commit | 7adadf7e5b83c46f7e83051146624719e9b6bf0d (patch) | |
tree | 3439c6c97d3345ce9ce4e972e39c57eef5dc2d64 /spec/frontend/clusters | |
parent | fb8d6a526f0ef2da9fb247e15f9ff19279dba3d6 (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/frontend/clusters')
4 files changed, 0 insertions, 223 deletions
diff --git a/spec/frontend/clusters/components/applications_spec.js b/spec/frontend/clusters/components/applications_spec.js index e371ad998d2..511f5fc1d89 100644 --- a/spec/frontend/clusters/components/applications_spec.js +++ b/spec/frontend/clusters/components/applications_spec.js @@ -2,7 +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 KnativeDomainEditor from '~/clusters/components/knative_domain_editor.vue'; import { CLUSTER_TYPE, PROVIDER_TYPE } from '~/clusters/constants'; import eventHub from '~/clusters/event_hub'; @@ -71,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); }); @@ -116,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); }); @@ -162,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); }); @@ -220,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' }, }, }); @@ -514,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 fdb67a0426a..00000000000 --- a/spec/frontend/clusters/components/fluentd_output_settings_spec.js +++ /dev/null @@ -1,183 +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, - 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 = ({ ciliumLogEnabled, ...settings }) => ({ - ...settings, - 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 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/services/mock_data.js b/spec/frontend/clusters/services/mock_data.js index 6ab94d6d95b..a75fcb0cb06 100644 --- a/spec/frontend/clusters/services/mock_data.js +++ b/spec/frontend/clusters/services/mock_data.js @@ -161,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 8fa373349b8..cdba6fc6ab8 100644 --- a/spec/frontend/clusters/stores/clusters_store_spec.js +++ b/spec/frontend/clusters/stores/clusters_store_spec.js @@ -122,24 +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, - }, jupyter: { title: 'JupyterHub', status: mockResponseData.applications[4].status, |