2020-06-23 00:09:42 +05:30
|
|
|
import { shallowMount, mount } from '@vue/test-utils';
|
|
|
|
import Applications from '~/clusters/components/applications.vue';
|
|
|
|
import { CLUSTER_TYPE, PROVIDER_TYPE } from '~/clusters/constants';
|
2019-07-07 11:18:12 +05:30
|
|
|
import { APPLICATIONS_MOCK_STATE } from '../services/mock_data';
|
2019-09-04 21:01:54 +05:30
|
|
|
import eventHub from '~/clusters/event_hub';
|
2020-06-23 00:09:42 +05:30
|
|
|
import ApplicationRow from '~/clusters/components/application_row.vue';
|
2019-09-04 21:01:54 +05:30
|
|
|
import KnativeDomainEditor from '~/clusters/components/knative_domain_editor.vue';
|
2019-12-26 22:10:19 +05:30
|
|
|
import CrossplaneProviderStack from '~/clusters/components/crossplane_provider_stack.vue';
|
2020-04-08 14:13:33 +05:30
|
|
|
import IngressModsecuritySettings from '~/clusters/components/ingress_modsecurity_settings.vue';
|
2020-05-24 23:13:21 +05:30
|
|
|
import FluentdOutputSettings from '~/clusters/components/fluentd_output_settings.vue';
|
2018-03-17 18:26:18 +05:30
|
|
|
|
|
|
|
describe('Applications', () => {
|
2020-06-23 00:09:42 +05:30
|
|
|
let wrapper;
|
2018-03-17 18:26:18 +05:30
|
|
|
|
|
|
|
beforeEach(() => {
|
2020-04-22 19:07:51 +05:30
|
|
|
gon.features = gon.features || {};
|
|
|
|
gon.features.managedAppsLocalTiller = false;
|
2018-03-17 18:26:18 +05:30
|
|
|
});
|
|
|
|
|
2020-06-23 00:09:42 +05:30
|
|
|
const createApp = ({ applications, type } = {}, isShallow) => {
|
|
|
|
const mountMethod = isShallow ? shallowMount : mount;
|
|
|
|
|
|
|
|
wrapper = mountMethod(Applications, {
|
|
|
|
stubs: { ApplicationRow },
|
|
|
|
propsData: {
|
|
|
|
type,
|
|
|
|
applications: { ...APPLICATIONS_MOCK_STATE, ...applications },
|
|
|
|
},
|
|
|
|
});
|
|
|
|
};
|
|
|
|
|
|
|
|
const createShallowApp = options => createApp(options, true);
|
|
|
|
const findByTestId = id => wrapper.find(`[data-testid="${id}"]`);
|
2018-03-17 18:26:18 +05:30
|
|
|
afterEach(() => {
|
2020-06-23 00:09:42 +05:30
|
|
|
wrapper.destroy();
|
2018-03-17 18:26:18 +05:30
|
|
|
});
|
|
|
|
|
2019-02-15 15:39:39 +05:30
|
|
|
describe('Project cluster applications', () => {
|
2018-03-17 18:26:18 +05:30
|
|
|
beforeEach(() => {
|
2020-06-23 00:09:42 +05:30
|
|
|
createApp({ type: CLUSTER_TYPE.PROJECT });
|
2018-03-17 18:26:18 +05:30
|
|
|
});
|
|
|
|
|
|
|
|
it('renders a row for Helm Tiller', () => {
|
2020-06-23 00:09:42 +05:30
|
|
|
expect(wrapper.find('.js-cluster-application-row-helm').exists()).toBe(true);
|
2018-03-17 18:26:18 +05:30
|
|
|
});
|
|
|
|
|
|
|
|
it('renders a row for Ingress', () => {
|
2020-06-23 00:09:42 +05:30
|
|
|
expect(wrapper.find('.js-cluster-application-row-ingress').exists()).toBe(true);
|
2019-02-15 15:39:39 +05:30
|
|
|
});
|
|
|
|
|
|
|
|
it('renders a row for Cert-Manager', () => {
|
2020-06-23 00:09:42 +05:30
|
|
|
expect(wrapper.find('.js-cluster-application-row-cert_manager').exists()).toBe(true);
|
2019-02-15 15:39:39 +05:30
|
|
|
});
|
|
|
|
|
2019-12-26 22:10:19 +05:30
|
|
|
it('renders a row for Crossplane', () => {
|
2020-06-23 00:09:42 +05:30
|
|
|
expect(wrapper.find('.js-cluster-application-row-crossplane').exists()).toBe(true);
|
2019-12-26 22:10:19 +05:30
|
|
|
});
|
|
|
|
|
2019-02-15 15:39:39 +05:30
|
|
|
it('renders a row for Prometheus', () => {
|
2020-06-23 00:09:42 +05:30
|
|
|
expect(wrapper.find('.js-cluster-application-row-prometheus').exists()).toBe(true);
|
2019-02-15 15:39:39 +05:30
|
|
|
});
|
|
|
|
|
|
|
|
it('renders a row for GitLab Runner', () => {
|
2020-06-23 00:09:42 +05:30
|
|
|
expect(wrapper.find('.js-cluster-application-row-runner').exists()).toBe(true);
|
2019-02-15 15:39:39 +05:30
|
|
|
});
|
|
|
|
|
|
|
|
it('renders a row for Jupyter', () => {
|
2020-06-23 00:09:42 +05:30
|
|
|
expect(wrapper.find('.js-cluster-application-row-jupyter').exists()).toBe(true);
|
2019-02-15 15:39:39 +05:30
|
|
|
});
|
|
|
|
|
|
|
|
it('renders a row for Knative', () => {
|
2020-06-23 00:09:42 +05:30
|
|
|
expect(wrapper.find('.js-cluster-application-row-knative').exists()).toBe(true);
|
2019-02-15 15:39:39 +05:30
|
|
|
});
|
2019-12-26 22:10:19 +05:30
|
|
|
|
|
|
|
it('renders a row for Elastic Stack', () => {
|
2020-06-23 00:09:42 +05:30
|
|
|
expect(wrapper.find('.js-cluster-application-row-elastic_stack').exists()).toBe(true);
|
2019-12-26 22:10:19 +05:30
|
|
|
});
|
2020-05-24 23:13:21 +05:30
|
|
|
|
|
|
|
it('renders a row for Fluentd', () => {
|
2020-06-23 00:09:42 +05:30
|
|
|
expect(wrapper.find('.js-cluster-application-row-fluentd').exists()).toBe(true);
|
2020-05-24 23:13:21 +05:30
|
|
|
});
|
2019-02-15 15:39:39 +05:30
|
|
|
});
|
|
|
|
|
|
|
|
describe('Group cluster applications', () => {
|
|
|
|
beforeEach(() => {
|
2020-06-23 00:09:42 +05:30
|
|
|
createApp({ type: CLUSTER_TYPE.GROUP });
|
2019-02-15 15:39:39 +05:30
|
|
|
});
|
|
|
|
|
|
|
|
it('renders a row for Helm Tiller', () => {
|
2020-06-23 00:09:42 +05:30
|
|
|
expect(wrapper.find('.js-cluster-application-row-helm').exists()).toBe(true);
|
2019-02-15 15:39:39 +05:30
|
|
|
});
|
|
|
|
|
|
|
|
it('renders a row for Ingress', () => {
|
2020-06-23 00:09:42 +05:30
|
|
|
expect(wrapper.find('.js-cluster-application-row-ingress').exists()).toBe(true);
|
2019-02-15 15:39:39 +05:30
|
|
|
});
|
|
|
|
|
|
|
|
it('renders a row for Cert-Manager', () => {
|
2020-06-23 00:09:42 +05:30
|
|
|
expect(wrapper.find('.js-cluster-application-row-cert_manager').exists()).toBe(true);
|
2018-03-17 18:26:18 +05:30
|
|
|
});
|
|
|
|
|
2019-12-26 22:10:19 +05:30
|
|
|
it('renders a row for Crossplane', () => {
|
2020-06-23 00:09:42 +05:30
|
|
|
expect(wrapper.find('.js-cluster-application-row-crossplane').exists()).toBe(true);
|
2019-12-26 22:10:19 +05:30
|
|
|
});
|
|
|
|
|
2018-03-17 18:26:18 +05:30
|
|
|
it('renders a row for Prometheus', () => {
|
2020-06-23 00:09:42 +05:30
|
|
|
expect(wrapper.find('.js-cluster-application-row-prometheus').exists()).toBe(true);
|
2018-03-17 18:26:18 +05:30
|
|
|
});
|
|
|
|
|
|
|
|
it('renders a row for GitLab Runner', () => {
|
2020-06-23 00:09:42 +05:30
|
|
|
expect(wrapper.find('.js-cluster-application-row-runner').exists()).toBe(true);
|
2018-03-17 18:26:18 +05:30
|
|
|
});
|
2018-11-08 19:23:39 +05:30
|
|
|
|
|
|
|
it('renders a row for Jupyter', () => {
|
2020-06-23 00:09:42 +05:30
|
|
|
expect(wrapper.find('.js-cluster-application-row-jupyter').exists()).toBe(true);
|
2018-11-08 19:23:39 +05:30
|
|
|
});
|
2018-12-13 13:39:08 +05:30
|
|
|
|
|
|
|
it('renders a row for Knative', () => {
|
2020-06-23 00:09:42 +05:30
|
|
|
expect(wrapper.find('.js-cluster-application-row-knative').exists()).toBe(true);
|
2019-12-04 20:38:33 +05:30
|
|
|
});
|
2019-12-26 22:10:19 +05:30
|
|
|
|
|
|
|
it('renders a row for Elastic Stack', () => {
|
2020-06-23 00:09:42 +05:30
|
|
|
expect(wrapper.find('.js-cluster-application-row-elastic_stack').exists()).toBe(true);
|
2019-12-26 22:10:19 +05:30
|
|
|
});
|
2020-05-24 23:13:21 +05:30
|
|
|
|
|
|
|
it('renders a row for Fluentd', () => {
|
2020-06-23 00:09:42 +05:30
|
|
|
expect(wrapper.find('.js-cluster-application-row-fluentd').exists()).toBe(true);
|
2020-05-24 23:13:21 +05:30
|
|
|
});
|
2019-12-04 20:38:33 +05:30
|
|
|
});
|
|
|
|
|
|
|
|
describe('Instance cluster applications', () => {
|
|
|
|
beforeEach(() => {
|
2020-06-23 00:09:42 +05:30
|
|
|
createApp({ type: CLUSTER_TYPE.INSTANCE });
|
2019-12-04 20:38:33 +05:30
|
|
|
});
|
|
|
|
|
|
|
|
it('renders a row for Helm Tiller', () => {
|
2020-06-23 00:09:42 +05:30
|
|
|
expect(wrapper.find('.js-cluster-application-row-helm').exists()).toBe(true);
|
2019-12-04 20:38:33 +05:30
|
|
|
});
|
|
|
|
|
|
|
|
it('renders a row for Ingress', () => {
|
2020-06-23 00:09:42 +05:30
|
|
|
expect(wrapper.find('.js-cluster-application-row-ingress').exists()).toBe(true);
|
2019-12-04 20:38:33 +05:30
|
|
|
});
|
|
|
|
|
|
|
|
it('renders a row for Cert-Manager', () => {
|
2020-06-23 00:09:42 +05:30
|
|
|
expect(wrapper.find('.js-cluster-application-row-cert_manager').exists()).toBe(true);
|
2019-12-04 20:38:33 +05:30
|
|
|
});
|
|
|
|
|
2019-12-26 22:10:19 +05:30
|
|
|
it('renders a row for Crossplane', () => {
|
2020-06-23 00:09:42 +05:30
|
|
|
expect(wrapper.find('.js-cluster-application-row-crossplane').exists()).toBe(true);
|
2019-12-26 22:10:19 +05:30
|
|
|
});
|
|
|
|
|
2019-12-04 20:38:33 +05:30
|
|
|
it('renders a row for Prometheus', () => {
|
2020-06-23 00:09:42 +05:30
|
|
|
expect(wrapper.find('.js-cluster-application-row-prometheus').exists()).toBe(true);
|
2019-12-04 20:38:33 +05:30
|
|
|
});
|
|
|
|
|
|
|
|
it('renders a row for GitLab Runner', () => {
|
2020-06-23 00:09:42 +05:30
|
|
|
expect(wrapper.find('.js-cluster-application-row-runner').exists()).toBe(true);
|
2019-12-04 20:38:33 +05:30
|
|
|
});
|
|
|
|
|
|
|
|
it('renders a row for Jupyter', () => {
|
2020-06-23 00:09:42 +05:30
|
|
|
expect(wrapper.find('.js-cluster-application-row-jupyter').exists()).toBe(true);
|
2019-12-04 20:38:33 +05:30
|
|
|
});
|
|
|
|
|
|
|
|
it('renders a row for Knative', () => {
|
2020-06-23 00:09:42 +05:30
|
|
|
expect(wrapper.find('.js-cluster-application-row-knative').exists()).toBe(true);
|
2018-12-13 13:39:08 +05:30
|
|
|
});
|
2019-12-26 22:10:19 +05:30
|
|
|
|
|
|
|
it('renders a row for Elastic Stack', () => {
|
2020-06-23 00:09:42 +05:30
|
|
|
expect(wrapper.find('.js-cluster-application-row-elastic_stack').exists()).toBe(true);
|
2019-12-26 22:10:19 +05:30
|
|
|
});
|
2020-05-24 23:13:21 +05:30
|
|
|
|
|
|
|
it('renders a row for Fluentd', () => {
|
2020-06-23 00:09:42 +05:30
|
|
|
expect(wrapper.find('.js-cluster-application-row-fluentd').exists()).toBe(true);
|
2020-05-24 23:13:21 +05:30
|
|
|
});
|
2018-03-27 19:54:05 +05:30
|
|
|
});
|
|
|
|
|
2020-04-22 19:07:51 +05:30
|
|
|
describe('Helm application', () => {
|
|
|
|
describe('when managedAppsLocalTiller enabled', () => {
|
|
|
|
beforeEach(() => {
|
|
|
|
gon.features.managedAppsLocalTiller = true;
|
|
|
|
});
|
|
|
|
|
|
|
|
it('does not render a row for Helm Tiller', () => {
|
2020-06-23 00:09:42 +05:30
|
|
|
createApp();
|
|
|
|
expect(wrapper.find('.js-cluster-application-row-helm').exists()).toBe(false);
|
2020-04-22 19:07:51 +05:30
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
2018-03-27 19:54:05 +05:30
|
|
|
describe('Ingress application', () => {
|
2020-06-23 00:09:42 +05:30
|
|
|
it('shows the correct warning message', () => {
|
|
|
|
createApp();
|
|
|
|
expect(findByTestId('ingressCostWarning').element).toMatchSnapshot();
|
|
|
|
});
|
|
|
|
|
2020-04-08 14:13:33 +05:30
|
|
|
describe('with nested component', () => {
|
|
|
|
const propsData = {
|
|
|
|
applications: {
|
|
|
|
ingress: {
|
|
|
|
title: 'Ingress',
|
|
|
|
status: 'installed',
|
|
|
|
},
|
|
|
|
},
|
|
|
|
};
|
|
|
|
|
2020-06-23 00:09:42 +05:30
|
|
|
beforeEach(() => createShallowApp(propsData));
|
|
|
|
|
2020-04-08 14:13:33 +05:30
|
|
|
it('renders IngressModsecuritySettings', () => {
|
|
|
|
const modsecuritySettings = wrapper.find(IngressModsecuritySettings);
|
|
|
|
expect(modsecuritySettings.exists()).toBe(true);
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
2018-03-27 19:54:05 +05:30
|
|
|
describe('when installed', () => {
|
|
|
|
describe('with ip address', () => {
|
|
|
|
it('renders ip address with a clipboard button', () => {
|
2020-06-23 00:09:42 +05:30
|
|
|
createApp({
|
2018-03-27 19:54:05 +05:30
|
|
|
applications: {
|
|
|
|
ingress: {
|
|
|
|
title: 'Ingress',
|
|
|
|
status: 'installed',
|
|
|
|
externalIp: '0.0.0.0',
|
|
|
|
},
|
|
|
|
},
|
|
|
|
});
|
|
|
|
|
2020-06-23 00:09:42 +05:30
|
|
|
expect(wrapper.find('.js-endpoint').element.value).toEqual('0.0.0.0');
|
|
|
|
expect(wrapper.find('.js-clipboard-btn').attributes('data-clipboard-text')).toEqual(
|
|
|
|
'0.0.0.0',
|
|
|
|
);
|
2018-03-27 19:54:05 +05:30
|
|
|
});
|
|
|
|
});
|
|
|
|
|
2019-07-07 11:18:12 +05:30
|
|
|
describe('with hostname', () => {
|
|
|
|
it('renders hostname with a clipboard button', () => {
|
2020-06-23 00:09:42 +05:30
|
|
|
createApp({
|
2018-03-27 19:54:05 +05:30
|
|
|
applications: {
|
|
|
|
ingress: {
|
|
|
|
title: 'Ingress',
|
|
|
|
status: 'installed',
|
2019-07-07 11:18:12 +05:30
|
|
|
externalHostname: 'localhost.localdomain',
|
2020-03-13 15:44:24 +05:30
|
|
|
modsecurity_enabled: false,
|
2018-03-27 19:54:05 +05:30
|
|
|
},
|
|
|
|
helm: { title: 'Helm Tiller' },
|
2019-02-15 15:39:39 +05:30
|
|
|
cert_manager: { title: 'Cert-Manager' },
|
2019-12-26 22:10:19 +05:30
|
|
|
crossplane: { title: 'Crossplane', stack: '' },
|
2018-03-27 19:54:05 +05:30
|
|
|
runner: { title: 'GitLab Runner' },
|
|
|
|
prometheus: { title: 'Prometheus' },
|
2018-11-08 19:23:39 +05:30
|
|
|
jupyter: { title: 'JupyterHub', hostname: '' },
|
2018-12-13 13:39:08 +05:30
|
|
|
knative: { title: 'Knative', hostname: '' },
|
2020-03-13 15:44:24 +05:30
|
|
|
elastic_stack: { title: 'Elastic Stack' },
|
2020-05-24 23:13:21 +05:30
|
|
|
fluentd: { title: 'Fluentd' },
|
2018-03-27 19:54:05 +05:30
|
|
|
},
|
|
|
|
});
|
|
|
|
|
2020-06-23 00:09:42 +05:30
|
|
|
expect(wrapper.find('.js-endpoint').element.value).toEqual('localhost.localdomain');
|
2019-07-07 11:18:12 +05:30
|
|
|
|
2020-06-23 00:09:42 +05:30
|
|
|
expect(wrapper.find('.js-clipboard-btn').attributes('data-clipboard-text')).toEqual(
|
|
|
|
'localhost.localdomain',
|
|
|
|
);
|
2019-07-07 11:18:12 +05:30
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
describe('without ip address', () => {
|
|
|
|
it('renders an input text with a loading icon and an alert text', () => {
|
2020-06-23 00:09:42 +05:30
|
|
|
createApp({
|
2019-07-07 11:18:12 +05:30
|
|
|
applications: {
|
|
|
|
ingress: {
|
|
|
|
title: 'Ingress',
|
|
|
|
status: 'installed',
|
|
|
|
},
|
|
|
|
},
|
|
|
|
});
|
2018-03-27 19:54:05 +05:30
|
|
|
|
2020-06-23 00:09:42 +05:30
|
|
|
expect(wrapper.find('.js-ingress-ip-loading-icon').exists()).toBe(true);
|
|
|
|
expect(wrapper.find('.js-no-endpoint-message').exists()).toBe(true);
|
2018-03-27 19:54:05 +05:30
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
describe('before installing', () => {
|
|
|
|
it('does not render the IP address', () => {
|
2020-06-23 00:09:42 +05:30
|
|
|
createApp();
|
2018-03-27 19:54:05 +05:30
|
|
|
|
2020-06-23 00:09:42 +05:30
|
|
|
expect(wrapper.text()).not.toContain('Ingress IP Address');
|
|
|
|
expect(wrapper.find('.js-endpoint').exists()).toBe(false);
|
2018-03-27 19:54:05 +05:30
|
|
|
});
|
|
|
|
});
|
2020-06-23 00:09:42 +05:30
|
|
|
});
|
2018-11-08 19:23:39 +05:30
|
|
|
|
2020-06-23 00:09:42 +05:30
|
|
|
describe('Cert-Manager application', () => {
|
|
|
|
it('shows the correct description', () => {
|
|
|
|
createApp();
|
|
|
|
expect(findByTestId('certManagerDescription').element).toMatchSnapshot();
|
|
|
|
});
|
2019-02-15 15:39:39 +05:30
|
|
|
|
2020-06-23 00:09:42 +05:30
|
|
|
describe('when not installed', () => {
|
|
|
|
it('renders email & allows editing', () => {
|
|
|
|
createApp({
|
|
|
|
applications: {
|
|
|
|
cert_manager: {
|
|
|
|
title: 'Cert-Manager',
|
|
|
|
email: 'before@example.com',
|
|
|
|
status: 'installable',
|
|
|
|
},
|
|
|
|
},
|
2019-02-15 15:39:39 +05:30
|
|
|
});
|
2020-06-23 00:09:42 +05:30
|
|
|
|
|
|
|
expect(wrapper.find('.js-email').element.value).toEqual('before@example.com');
|
|
|
|
expect(wrapper.find('.js-email').attributes('readonly')).toBe(undefined);
|
2019-02-15 15:39:39 +05:30
|
|
|
});
|
2020-06-23 00:09:42 +05:30
|
|
|
});
|
2019-02-15 15:39:39 +05:30
|
|
|
|
2020-06-23 00:09:42 +05:30
|
|
|
describe('when installed', () => {
|
|
|
|
it('renders email in readonly', () => {
|
|
|
|
createApp({
|
|
|
|
applications: {
|
|
|
|
cert_manager: {
|
|
|
|
title: 'Cert-Manager',
|
|
|
|
email: 'after@example.com',
|
|
|
|
status: 'installed',
|
2019-02-15 15:39:39 +05:30
|
|
|
},
|
2020-06-23 00:09:42 +05:30
|
|
|
},
|
2019-02-15 15:39:39 +05:30
|
|
|
});
|
2020-06-23 00:09:42 +05:30
|
|
|
|
|
|
|
expect(wrapper.find('.js-email').element.value).toEqual('after@example.com');
|
|
|
|
expect(wrapper.find('.js-email').attributes('readonly')).toEqual('readonly');
|
2019-02-15 15:39:39 +05:30
|
|
|
});
|
|
|
|
});
|
2020-06-23 00:09:42 +05:30
|
|
|
});
|
2019-02-15 15:39:39 +05:30
|
|
|
|
2020-06-23 00:09:42 +05:30
|
|
|
describe('Jupyter application', () => {
|
|
|
|
describe('with ingress installed with ip & jupyter installable', () => {
|
|
|
|
it('renders hostname active input', () => {
|
|
|
|
createApp({
|
|
|
|
applications: {
|
|
|
|
ingress: {
|
|
|
|
title: 'Ingress',
|
|
|
|
status: 'installed',
|
|
|
|
externalIp: '1.1.1.1',
|
2018-11-08 19:23:39 +05:30
|
|
|
},
|
2020-06-23 00:09:42 +05:30
|
|
|
},
|
2018-11-08 19:23:39 +05:30
|
|
|
});
|
|
|
|
|
2020-06-23 00:09:42 +05:30
|
|
|
expect(
|
|
|
|
wrapper.find('.js-cluster-application-row-jupyter .js-hostname').attributes('readonly'),
|
|
|
|
).toEqual(undefined);
|
|
|
|
});
|
|
|
|
});
|
2018-11-08 19:23:39 +05:30
|
|
|
|
2020-06-23 00:09:42 +05:30
|
|
|
describe('with ingress installed without external ip', () => {
|
|
|
|
it('does not render hostname input', () => {
|
|
|
|
createApp({
|
|
|
|
applications: {
|
|
|
|
ingress: { title: 'Ingress', status: 'installed' },
|
|
|
|
},
|
2018-11-08 19:23:39 +05:30
|
|
|
});
|
|
|
|
|
2020-06-23 00:09:42 +05:30
|
|
|
expect(wrapper.find('.js-cluster-application-row-jupyter .js-hostname').exists()).toBe(
|
|
|
|
false,
|
|
|
|
);
|
|
|
|
});
|
|
|
|
});
|
2018-11-08 19:23:39 +05:30
|
|
|
|
2020-06-23 00:09:42 +05:30
|
|
|
describe('with ingress & jupyter installed', () => {
|
|
|
|
it('renders readonly input', () => {
|
|
|
|
createApp({
|
|
|
|
applications: {
|
|
|
|
ingress: { title: 'Ingress', status: 'installed', externalIp: '1.1.1.1' },
|
|
|
|
jupyter: { title: 'JupyterHub', status: 'installed', hostname: '' },
|
|
|
|
},
|
2018-11-08 19:23:39 +05:30
|
|
|
});
|
2020-06-23 00:09:42 +05:30
|
|
|
|
|
|
|
expect(
|
|
|
|
wrapper.find('.js-cluster-application-row-jupyter .js-hostname').attributes('readonly'),
|
|
|
|
).toEqual('readonly');
|
2018-11-08 19:23:39 +05:30
|
|
|
});
|
2020-06-23 00:09:42 +05:30
|
|
|
});
|
2018-11-08 19:23:39 +05:30
|
|
|
|
2020-06-23 00:09:42 +05:30
|
|
|
describe('without ingress installed', () => {
|
|
|
|
beforeEach(() => {
|
|
|
|
createApp();
|
|
|
|
});
|
2018-11-08 19:23:39 +05:30
|
|
|
|
2020-06-23 00:09:42 +05:30
|
|
|
it('does not render input', () => {
|
|
|
|
expect(wrapper.find('.js-cluster-application-row-jupyter .js-hostname').exists()).toBe(
|
|
|
|
false,
|
|
|
|
);
|
|
|
|
});
|
2018-11-08 19:23:39 +05:30
|
|
|
|
2020-06-23 00:09:42 +05:30
|
|
|
it('renders disabled install button', () => {
|
|
|
|
expect(
|
|
|
|
wrapper
|
|
|
|
.find('.js-cluster-application-row-jupyter .js-cluster-application-install-button')
|
|
|
|
.attributes('disabled'),
|
|
|
|
).toEqual('disabled');
|
2018-11-08 19:23:39 +05:30
|
|
|
});
|
|
|
|
});
|
2018-03-17 18:26:18 +05:30
|
|
|
});
|
2019-07-07 11:18:12 +05:30
|
|
|
|
2020-06-23 00:09:42 +05:30
|
|
|
describe('Prometheus application', () => {
|
|
|
|
it('shows the correct description', () => {
|
|
|
|
createApp();
|
|
|
|
expect(findByTestId('prometheusDescription').element).toMatchSnapshot();
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
2019-07-07 11:18:12 +05:30
|
|
|
describe('Knative application', () => {
|
2020-04-22 19:07:51 +05:30
|
|
|
const availableDomain = {
|
|
|
|
id: 4,
|
|
|
|
domain: 'newhostname.com',
|
|
|
|
};
|
2019-09-04 21:01:54 +05:30
|
|
|
const propsData = {
|
|
|
|
applications: {
|
|
|
|
knative: {
|
|
|
|
title: 'Knative',
|
|
|
|
hostname: 'example.com',
|
|
|
|
status: 'installed',
|
|
|
|
externalIp: '1.1.1.1',
|
|
|
|
installed: true,
|
2020-04-22 19:07:51 +05:30
|
|
|
availableDomains: [availableDomain],
|
|
|
|
pagesDomain: null,
|
2019-09-04 21:01:54 +05:30
|
|
|
},
|
|
|
|
},
|
|
|
|
};
|
|
|
|
let knativeDomainEditor;
|
2019-07-07 11:18:12 +05:30
|
|
|
|
2019-09-04 21:01:54 +05:30
|
|
|
beforeEach(() => {
|
2020-06-23 00:09:42 +05:30
|
|
|
createShallowApp(propsData);
|
2019-09-04 21:01:54 +05:30
|
|
|
jest.spyOn(eventHub, '$emit');
|
2019-07-07 11:18:12 +05:30
|
|
|
|
2019-09-04 21:01:54 +05:30
|
|
|
knativeDomainEditor = wrapper.find(KnativeDomainEditor);
|
|
|
|
});
|
2019-07-07 11:18:12 +05:30
|
|
|
|
2020-06-23 00:09:42 +05:30
|
|
|
it('shows the correct description', async () => {
|
|
|
|
createApp();
|
|
|
|
wrapper.setProps({
|
|
|
|
providerType: PROVIDER_TYPE.GCP,
|
|
|
|
preInstalledKnative: true,
|
|
|
|
});
|
|
|
|
|
|
|
|
await wrapper.vm.$nextTick();
|
|
|
|
|
|
|
|
expect(findByTestId('installedVia').element).toMatchSnapshot();
|
2019-09-04 21:01:54 +05:30
|
|
|
});
|
2019-07-07 11:18:12 +05:30
|
|
|
|
2019-09-04 21:01:54 +05:30
|
|
|
it('emits saveKnativeDomain event when knative domain editor emits save event', () => {
|
2020-04-22 19:07:51 +05:30
|
|
|
propsData.applications.knative.hostname = availableDomain.domain;
|
|
|
|
propsData.applications.knative.pagesDomain = availableDomain;
|
|
|
|
knativeDomainEditor.vm.$emit('save');
|
2019-07-07 11:18:12 +05:30
|
|
|
|
2019-09-04 21:01:54 +05:30
|
|
|
expect(eventHub.$emit).toHaveBeenCalledWith('saveKnativeDomain', {
|
|
|
|
id: 'knative',
|
2020-04-22 19:07:51 +05:30
|
|
|
params: {
|
|
|
|
hostname: availableDomain.domain,
|
|
|
|
pages_domain_id: availableDomain.id,
|
|
|
|
},
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
it('emits saveKnativeDomain event when knative domain editor emits save event with custom domain', () => {
|
|
|
|
const newHostName = 'someothernewhostname.com';
|
|
|
|
propsData.applications.knative.hostname = newHostName;
|
|
|
|
propsData.applications.knative.pagesDomain = null;
|
|
|
|
knativeDomainEditor.vm.$emit('save');
|
|
|
|
|
|
|
|
expect(eventHub.$emit).toHaveBeenCalledWith('saveKnativeDomain', {
|
|
|
|
id: 'knative',
|
|
|
|
params: {
|
|
|
|
hostname: newHostName,
|
|
|
|
pages_domain_id: undefined,
|
|
|
|
},
|
2019-07-07 11:18:12 +05:30
|
|
|
});
|
2019-09-04 21:01:54 +05:30
|
|
|
});
|
2019-07-07 11:18:12 +05:30
|
|
|
|
2019-09-04 21:01:54 +05:30
|
|
|
it('emits setKnativeHostname event when knative domain editor emits change event', () => {
|
2020-04-22 19:07:51 +05:30
|
|
|
wrapper.find(KnativeDomainEditor).vm.$emit('set', {
|
|
|
|
domain: availableDomain.domain,
|
|
|
|
domainId: availableDomain.id,
|
|
|
|
});
|
2019-07-07 11:18:12 +05:30
|
|
|
|
2020-04-22 19:07:51 +05:30
|
|
|
expect(eventHub.$emit).toHaveBeenCalledWith('setKnativeDomain', {
|
2019-09-04 21:01:54 +05:30
|
|
|
id: 'knative',
|
2020-04-22 19:07:51 +05:30
|
|
|
domain: availableDomain.domain,
|
|
|
|
domainId: availableDomain.id,
|
2019-07-07 11:18:12 +05:30
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|
2019-12-26 22:10:19 +05:30
|
|
|
|
|
|
|
describe('Crossplane application', () => {
|
|
|
|
const propsData = {
|
|
|
|
applications: {
|
|
|
|
crossplane: {
|
|
|
|
title: 'Crossplane',
|
|
|
|
stack: {
|
|
|
|
code: '',
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
};
|
|
|
|
|
2020-06-23 00:09:42 +05:30
|
|
|
beforeEach(() => createShallowApp(propsData));
|
|
|
|
|
2019-12-26 22:10:19 +05:30
|
|
|
it('renders the correct Component', () => {
|
|
|
|
const crossplane = wrapper.find(CrossplaneProviderStack);
|
|
|
|
expect(crossplane.exists()).toBe(true);
|
|
|
|
});
|
2020-06-23 00:09:42 +05:30
|
|
|
|
|
|
|
it('shows the correct description', () => {
|
|
|
|
createApp();
|
|
|
|
expect(findByTestId('crossplaneDescription').element).toMatchSnapshot();
|
|
|
|
});
|
2019-12-26 22:10:19 +05:30
|
|
|
});
|
|
|
|
|
|
|
|
describe('Elastic Stack application', () => {
|
2020-03-13 15:44:24 +05:30
|
|
|
describe('with elastic stack installable', () => {
|
2019-12-26 22:10:19 +05:30
|
|
|
it('renders hostname active input', () => {
|
2020-06-23 00:09:42 +05:30
|
|
|
createApp();
|
2019-12-26 22:10:19 +05:30
|
|
|
|
|
|
|
expect(
|
2020-06-23 00:09:42 +05:30
|
|
|
wrapper
|
|
|
|
.find(
|
2020-03-13 15:44:24 +05:30
|
|
|
'.js-cluster-application-row-elastic_stack .js-cluster-application-install-button',
|
|
|
|
)
|
2020-06-23 00:09:42 +05:30
|
|
|
.attributes('disabled'),
|
2020-03-13 15:44:24 +05:30
|
|
|
).toEqual('disabled');
|
2019-12-26 22:10:19 +05:30
|
|
|
});
|
|
|
|
});
|
|
|
|
|
2020-03-13 15:44:24 +05:30
|
|
|
describe('elastic stack installed', () => {
|
|
|
|
it('renders uninstall button', () => {
|
2020-06-23 00:09:42 +05:30
|
|
|
createApp({
|
2019-12-26 22:10:19 +05:30
|
|
|
applications: {
|
2020-03-13 15:44:24 +05:30
|
|
|
elastic_stack: { title: 'Elastic Stack', status: 'installed' },
|
2019-12-26 22:10:19 +05:30
|
|
|
},
|
|
|
|
});
|
|
|
|
|
|
|
|
expect(
|
2020-06-23 00:09:42 +05:30
|
|
|
wrapper
|
|
|
|
.find(
|
2019-12-26 22:10:19 +05:30
|
|
|
'.js-cluster-application-row-elastic_stack .js-cluster-application-install-button',
|
|
|
|
)
|
2020-06-23 00:09:42 +05:30
|
|
|
.attributes('disabled'),
|
2019-12-26 22:10:19 +05:30
|
|
|
).toEqual('disabled');
|
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|
2020-05-24 23:13:21 +05:30
|
|
|
|
|
|
|
describe('Fluentd application', () => {
|
2020-06-23 00:09:42 +05:30
|
|
|
beforeEach(() => createShallowApp());
|
2020-05-24 23:13:21 +05:30
|
|
|
|
|
|
|
it('renders the correct Component', () => {
|
2020-06-23 00:09:42 +05:30
|
|
|
expect(wrapper.find(FluentdOutputSettings).exists()).toBe(true);
|
2020-05-24 23:13:21 +05:30
|
|
|
});
|
|
|
|
});
|
2018-03-17 18:26:18 +05:30
|
|
|
});
|