2018-03-17 18:26:18 +05:30
|
|
|
import Vue from 'vue';
|
2020-01-01 13:55:28 +05:30
|
|
|
import mountComponent from 'helpers/vue_mount_component_helper';
|
|
|
|
import { shallowMount } from '@vue/test-utils';
|
2018-03-17 18:26:18 +05:30
|
|
|
import applications from '~/clusters/components/applications.vue';
|
2019-02-15 15:39:39 +05:30
|
|
|
import { CLUSTER_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';
|
|
|
|
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';
|
2018-03-17 18:26:18 +05:30
|
|
|
|
|
|
|
describe('Applications', () => {
|
|
|
|
let vm;
|
|
|
|
let Applications;
|
|
|
|
|
|
|
|
beforeEach(() => {
|
|
|
|
Applications = Vue.extend(applications);
|
2019-12-26 22:10:19 +05:30
|
|
|
|
|
|
|
gon.features = gon.features || {};
|
|
|
|
gon.features.enableClusterApplicationElasticStack = true;
|
|
|
|
gon.features.enableClusterApplicationCrossplane = true;
|
2018-03-17 18:26:18 +05:30
|
|
|
});
|
|
|
|
|
|
|
|
afterEach(() => {
|
|
|
|
vm.$destroy();
|
|
|
|
});
|
|
|
|
|
2019-02-15 15:39:39 +05:30
|
|
|
describe('Project cluster applications', () => {
|
2018-03-17 18:26:18 +05:30
|
|
|
beforeEach(() => {
|
|
|
|
vm = mountComponent(Applications, {
|
2019-07-07 11:18:12 +05:30
|
|
|
applications: APPLICATIONS_MOCK_STATE,
|
2019-02-15 15:39:39 +05:30
|
|
|
type: CLUSTER_TYPE.PROJECT,
|
2018-03-17 18:26:18 +05:30
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
it('renders a row for Helm Tiller', () => {
|
2019-02-15 15:39:39 +05:30
|
|
|
expect(vm.$el.querySelector('.js-cluster-application-row-helm')).not.toBeNull();
|
2018-03-17 18:26:18 +05:30
|
|
|
});
|
|
|
|
|
|
|
|
it('renders a row for Ingress', () => {
|
2019-02-15 15:39:39 +05:30
|
|
|
expect(vm.$el.querySelector('.js-cluster-application-row-ingress')).not.toBeNull();
|
|
|
|
});
|
|
|
|
|
|
|
|
it('renders a row for Cert-Manager', () => {
|
|
|
|
expect(vm.$el.querySelector('.js-cluster-application-row-cert_manager')).not.toBeNull();
|
|
|
|
});
|
|
|
|
|
2019-12-26 22:10:19 +05:30
|
|
|
it('renders a row for Crossplane', () => {
|
|
|
|
expect(vm.$el.querySelector('.js-cluster-application-row-crossplane')).not.toBeNull();
|
|
|
|
});
|
|
|
|
|
2019-02-15 15:39:39 +05:30
|
|
|
it('renders a row for Prometheus', () => {
|
|
|
|
expect(vm.$el.querySelector('.js-cluster-application-row-prometheus')).not.toBeNull();
|
|
|
|
});
|
|
|
|
|
|
|
|
it('renders a row for GitLab Runner', () => {
|
|
|
|
expect(vm.$el.querySelector('.js-cluster-application-row-runner')).not.toBeNull();
|
|
|
|
});
|
|
|
|
|
|
|
|
it('renders a row for Jupyter', () => {
|
|
|
|
expect(vm.$el.querySelector('.js-cluster-application-row-jupyter')).not.toBeNull();
|
|
|
|
});
|
|
|
|
|
|
|
|
it('renders a row for Knative', () => {
|
|
|
|
expect(vm.$el.querySelector('.js-cluster-application-row-knative')).not.toBeNull();
|
|
|
|
});
|
2019-12-26 22:10:19 +05:30
|
|
|
|
|
|
|
it('renders a row for Elastic Stack', () => {
|
|
|
|
expect(vm.$el.querySelector('.js-cluster-application-row-elastic_stack')).not.toBeNull();
|
|
|
|
});
|
2019-02-15 15:39:39 +05:30
|
|
|
});
|
|
|
|
|
|
|
|
describe('Group cluster applications', () => {
|
|
|
|
beforeEach(() => {
|
|
|
|
vm = mountComponent(Applications, {
|
|
|
|
type: CLUSTER_TYPE.GROUP,
|
2019-07-07 11:18:12 +05:30
|
|
|
applications: APPLICATIONS_MOCK_STATE,
|
2019-02-15 15:39:39 +05:30
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
it('renders a row for Helm Tiller', () => {
|
|
|
|
expect(vm.$el.querySelector('.js-cluster-application-row-helm')).not.toBeNull();
|
|
|
|
});
|
|
|
|
|
|
|
|
it('renders a row for Ingress', () => {
|
|
|
|
expect(vm.$el.querySelector('.js-cluster-application-row-ingress')).not.toBeNull();
|
|
|
|
});
|
|
|
|
|
|
|
|
it('renders a row for Cert-Manager', () => {
|
|
|
|
expect(vm.$el.querySelector('.js-cluster-application-row-cert_manager')).not.toBeNull();
|
2018-03-17 18:26:18 +05:30
|
|
|
});
|
|
|
|
|
2019-12-26 22:10:19 +05:30
|
|
|
it('renders a row for Crossplane', () => {
|
|
|
|
expect(vm.$el.querySelector('.js-cluster-application-row-crossplane')).not.toBeNull();
|
|
|
|
});
|
|
|
|
|
2018-03-17 18:26:18 +05:30
|
|
|
it('renders a row for Prometheus', () => {
|
2019-07-31 22:56:46 +05:30
|
|
|
expect(vm.$el.querySelector('.js-cluster-application-row-prometheus')).not.toBeNull();
|
2018-03-17 18:26:18 +05:30
|
|
|
});
|
|
|
|
|
|
|
|
it('renders a row for GitLab Runner', () => {
|
2019-07-07 11:18:12 +05:30
|
|
|
expect(vm.$el.querySelector('.js-cluster-application-row-runner')).not.toBeNull();
|
2018-03-17 18:26:18 +05:30
|
|
|
});
|
2018-11-08 19:23:39 +05:30
|
|
|
|
|
|
|
it('renders a row for Jupyter', () => {
|
2019-12-04 20:38:33 +05:30
|
|
|
expect(vm.$el.querySelector('.js-cluster-application-row-jupyter')).not.toBeNull();
|
2018-11-08 19:23:39 +05:30
|
|
|
});
|
2018-12-13 13:39:08 +05:30
|
|
|
|
|
|
|
it('renders a row for Knative', () => {
|
2019-12-04 20:38:33 +05:30
|
|
|
expect(vm.$el.querySelector('.js-cluster-application-row-knative')).not.toBeNull();
|
|
|
|
});
|
2019-12-26 22:10:19 +05:30
|
|
|
|
|
|
|
it('renders a row for Elastic Stack', () => {
|
|
|
|
expect(vm.$el.querySelector('.js-cluster-application-row-elastic_stack')).not.toBeNull();
|
|
|
|
});
|
2019-12-04 20:38:33 +05:30
|
|
|
});
|
|
|
|
|
|
|
|
describe('Instance cluster applications', () => {
|
|
|
|
beforeEach(() => {
|
|
|
|
vm = mountComponent(Applications, {
|
|
|
|
type: CLUSTER_TYPE.INSTANCE,
|
|
|
|
applications: APPLICATIONS_MOCK_STATE,
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
it('renders a row for Helm Tiller', () => {
|
|
|
|
expect(vm.$el.querySelector('.js-cluster-application-row-helm')).not.toBeNull();
|
|
|
|
});
|
|
|
|
|
|
|
|
it('renders a row for Ingress', () => {
|
|
|
|
expect(vm.$el.querySelector('.js-cluster-application-row-ingress')).not.toBeNull();
|
|
|
|
});
|
|
|
|
|
|
|
|
it('renders a row for Cert-Manager', () => {
|
|
|
|
expect(vm.$el.querySelector('.js-cluster-application-row-cert_manager')).not.toBeNull();
|
|
|
|
});
|
|
|
|
|
2019-12-26 22:10:19 +05:30
|
|
|
it('renders a row for Crossplane', () => {
|
|
|
|
expect(vm.$el.querySelector('.js-cluster-application-row-crossplane')).not.toBeNull();
|
|
|
|
});
|
|
|
|
|
2019-12-04 20:38:33 +05:30
|
|
|
it('renders a row for Prometheus', () => {
|
|
|
|
expect(vm.$el.querySelector('.js-cluster-application-row-prometheus')).not.toBeNull();
|
|
|
|
});
|
|
|
|
|
|
|
|
it('renders a row for GitLab Runner', () => {
|
|
|
|
expect(vm.$el.querySelector('.js-cluster-application-row-runner')).not.toBeNull();
|
|
|
|
});
|
|
|
|
|
|
|
|
it('renders a row for Jupyter', () => {
|
|
|
|
expect(vm.$el.querySelector('.js-cluster-application-row-jupyter')).not.toBeNull();
|
|
|
|
});
|
|
|
|
|
|
|
|
it('renders a row for Knative', () => {
|
|
|
|
expect(vm.$el.querySelector('.js-cluster-application-row-knative')).not.toBeNull();
|
2018-12-13 13:39:08 +05:30
|
|
|
});
|
2019-12-26 22:10:19 +05:30
|
|
|
|
|
|
|
it('renders a row for Elastic Stack', () => {
|
|
|
|
expect(vm.$el.querySelector('.js-cluster-application-row-elastic_stack')).not.toBeNull();
|
|
|
|
});
|
2018-03-27 19:54:05 +05:30
|
|
|
});
|
|
|
|
|
|
|
|
describe('Ingress application', () => {
|
|
|
|
describe('when installed', () => {
|
|
|
|
describe('with ip address', () => {
|
|
|
|
it('renders ip address with a clipboard button', () => {
|
|
|
|
vm = mountComponent(Applications, {
|
|
|
|
applications: {
|
2019-07-07 11:18:12 +05:30
|
|
|
...APPLICATIONS_MOCK_STATE,
|
2018-03-27 19:54:05 +05:30
|
|
|
ingress: {
|
|
|
|
title: 'Ingress',
|
|
|
|
status: 'installed',
|
|
|
|
externalIp: '0.0.0.0',
|
|
|
|
},
|
|
|
|
},
|
|
|
|
});
|
|
|
|
|
2019-07-07 11:18:12 +05:30
|
|
|
expect(vm.$el.querySelector('.js-endpoint').value).toEqual('0.0.0.0');
|
2018-03-27 19:54:05 +05:30
|
|
|
|
|
|
|
expect(
|
|
|
|
vm.$el.querySelector('.js-clipboard-btn').getAttribute('data-clipboard-text'),
|
|
|
|
).toEqual('0.0.0.0');
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
2019-07-07 11:18:12 +05:30
|
|
|
describe('with hostname', () => {
|
|
|
|
it('renders hostname with a clipboard button', () => {
|
2018-03-27 19:54:05 +05:30
|
|
|
vm = mountComponent(Applications, {
|
|
|
|
applications: {
|
|
|
|
ingress: {
|
|
|
|
title: 'Ingress',
|
|
|
|
status: 'installed',
|
2019-07-07 11:18:12 +05:30
|
|
|
externalHostname: 'localhost.localdomain',
|
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: '' },
|
2019-12-26 22:10:19 +05:30
|
|
|
elastic_stack: { title: 'Elastic Stack', kibana_hostname: '' },
|
2018-03-27 19:54:05 +05:30
|
|
|
},
|
|
|
|
});
|
|
|
|
|
2019-07-07 11:18:12 +05:30
|
|
|
expect(vm.$el.querySelector('.js-endpoint').value).toEqual('localhost.localdomain');
|
|
|
|
|
|
|
|
expect(
|
|
|
|
vm.$el.querySelector('.js-clipboard-btn').getAttribute('data-clipboard-text'),
|
|
|
|
).toEqual('localhost.localdomain');
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
describe('without ip address', () => {
|
|
|
|
it('renders an input text with a loading icon and an alert text', () => {
|
|
|
|
vm = mountComponent(Applications, {
|
|
|
|
applications: {
|
|
|
|
...APPLICATIONS_MOCK_STATE,
|
|
|
|
ingress: {
|
|
|
|
title: 'Ingress',
|
|
|
|
status: 'installed',
|
|
|
|
},
|
|
|
|
},
|
|
|
|
});
|
2018-03-27 19:54:05 +05:30
|
|
|
|
2019-07-07 11:18:12 +05:30
|
|
|
expect(vm.$el.querySelector('.js-ingress-ip-loading-icon')).not.toBe(null);
|
|
|
|
expect(vm.$el.querySelector('.js-no-endpoint-message')).not.toBe(null);
|
2018-03-27 19:54:05 +05:30
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
describe('before installing', () => {
|
|
|
|
it('does not render the IP address', () => {
|
|
|
|
vm = mountComponent(Applications, {
|
2019-07-07 11:18:12 +05:30
|
|
|
applications: APPLICATIONS_MOCK_STATE,
|
2018-03-27 19:54:05 +05:30
|
|
|
});
|
|
|
|
|
|
|
|
expect(vm.$el.textContent).not.toContain('Ingress IP Address');
|
2019-07-07 11:18:12 +05:30
|
|
|
expect(vm.$el.querySelector('.js-endpoint')).toBe(null);
|
2018-03-27 19:54:05 +05:30
|
|
|
});
|
|
|
|
});
|
2018-11-08 19:23:39 +05:30
|
|
|
|
2019-02-15 15:39:39 +05:30
|
|
|
describe('Cert-Manager application', () => {
|
|
|
|
describe('when not installed', () => {
|
|
|
|
it('renders email & allows editing', () => {
|
|
|
|
vm = mountComponent(Applications, {
|
|
|
|
applications: {
|
2019-07-07 11:18:12 +05:30
|
|
|
...APPLICATIONS_MOCK_STATE,
|
2019-02-15 15:39:39 +05:30
|
|
|
cert_manager: {
|
|
|
|
title: 'Cert-Manager',
|
|
|
|
email: 'before@example.com',
|
|
|
|
status: 'installable',
|
|
|
|
},
|
|
|
|
},
|
|
|
|
});
|
|
|
|
|
|
|
|
expect(vm.$el.querySelector('.js-email').value).toEqual('before@example.com');
|
|
|
|
expect(vm.$el.querySelector('.js-email').getAttribute('readonly')).toBe(null);
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
describe('when installed', () => {
|
|
|
|
it('renders email in readonly', () => {
|
|
|
|
vm = mountComponent(Applications, {
|
|
|
|
applications: {
|
2019-07-07 11:18:12 +05:30
|
|
|
...APPLICATIONS_MOCK_STATE,
|
2019-02-15 15:39:39 +05:30
|
|
|
cert_manager: {
|
|
|
|
title: 'Cert-Manager',
|
|
|
|
email: 'after@example.com',
|
|
|
|
status: 'installed',
|
|
|
|
},
|
|
|
|
},
|
|
|
|
});
|
|
|
|
|
|
|
|
expect(vm.$el.querySelector('.js-email').value).toEqual('after@example.com');
|
|
|
|
expect(vm.$el.querySelector('.js-email').getAttribute('readonly')).toEqual('readonly');
|
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
2018-11-08 19:23:39 +05:30
|
|
|
describe('Jupyter application', () => {
|
|
|
|
describe('with ingress installed with ip & jupyter installable', () => {
|
|
|
|
it('renders hostname active input', () => {
|
|
|
|
vm = mountComponent(Applications, {
|
|
|
|
applications: {
|
2019-07-07 11:18:12 +05:30
|
|
|
...APPLICATIONS_MOCK_STATE,
|
|
|
|
ingress: {
|
|
|
|
title: 'Ingress',
|
|
|
|
status: 'installed',
|
|
|
|
externalIp: '1.1.1.1',
|
|
|
|
},
|
2018-11-08 19:23:39 +05:30
|
|
|
},
|
|
|
|
});
|
|
|
|
|
2019-12-26 22:10:19 +05:30
|
|
|
expect(
|
|
|
|
vm.$el
|
|
|
|
.querySelector('.js-cluster-application-row-jupyter .js-hostname')
|
|
|
|
.getAttribute('readonly'),
|
|
|
|
).toEqual(null);
|
2018-11-08 19:23:39 +05:30
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
describe('with ingress installed without external ip', () => {
|
|
|
|
it('does not render hostname input', () => {
|
|
|
|
vm = mountComponent(Applications, {
|
|
|
|
applications: {
|
2019-07-07 11:18:12 +05:30
|
|
|
...APPLICATIONS_MOCK_STATE,
|
2018-11-08 19:23:39 +05:30
|
|
|
ingress: { title: 'Ingress', status: 'installed' },
|
|
|
|
},
|
|
|
|
});
|
|
|
|
|
2019-12-26 22:10:19 +05:30
|
|
|
expect(vm.$el.querySelector('.js-cluster-application-row-jupyter .js-hostname')).toBe(
|
|
|
|
null,
|
|
|
|
);
|
2018-11-08 19:23:39 +05:30
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
describe('with ingress & jupyter installed', () => {
|
|
|
|
it('renders readonly input', () => {
|
|
|
|
vm = mountComponent(Applications, {
|
|
|
|
applications: {
|
2019-07-07 11:18:12 +05:30
|
|
|
...APPLICATIONS_MOCK_STATE,
|
2018-11-08 19:23:39 +05:30
|
|
|
ingress: { title: 'Ingress', status: 'installed', externalIp: '1.1.1.1' },
|
|
|
|
jupyter: { title: 'JupyterHub', status: 'installed', hostname: '' },
|
|
|
|
},
|
|
|
|
});
|
|
|
|
|
2019-12-26 22:10:19 +05:30
|
|
|
expect(
|
|
|
|
vm.$el
|
|
|
|
.querySelector('.js-cluster-application-row-jupyter .js-hostname')
|
|
|
|
.getAttribute('readonly'),
|
|
|
|
).toEqual('readonly');
|
2018-11-08 19:23:39 +05:30
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
describe('without ingress installed', () => {
|
|
|
|
beforeEach(() => {
|
|
|
|
vm = mountComponent(Applications, {
|
2019-07-07 11:18:12 +05:30
|
|
|
applications: APPLICATIONS_MOCK_STATE,
|
2018-11-08 19:23:39 +05:30
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
it('does not render input', () => {
|
2019-12-26 22:10:19 +05:30
|
|
|
expect(vm.$el.querySelector('.js-cluster-application-row-jupyter .js-hostname')).toBe(
|
|
|
|
null,
|
|
|
|
);
|
2018-11-08 19:23:39 +05:30
|
|
|
});
|
|
|
|
|
|
|
|
it('renders disabled install button', () => {
|
|
|
|
expect(
|
|
|
|
vm.$el
|
|
|
|
.querySelector(
|
|
|
|
'.js-cluster-application-row-jupyter .js-cluster-application-install-button',
|
|
|
|
)
|
|
|
|
.getAttribute('disabled'),
|
|
|
|
).toEqual('disabled');
|
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|
2018-03-17 18:26:18 +05:30
|
|
|
});
|
2019-07-07 11:18:12 +05:30
|
|
|
|
|
|
|
describe('Knative application', () => {
|
2019-09-04 21:01:54 +05:30
|
|
|
const propsData = {
|
|
|
|
applications: {
|
|
|
|
...APPLICATIONS_MOCK_STATE,
|
|
|
|
knative: {
|
|
|
|
title: 'Knative',
|
|
|
|
hostname: 'example.com',
|
|
|
|
status: 'installed',
|
|
|
|
externalIp: '1.1.1.1',
|
|
|
|
installed: true,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
};
|
|
|
|
const newHostname = 'newhostname.com';
|
|
|
|
let wrapper;
|
|
|
|
let knativeDomainEditor;
|
2019-07-07 11:18:12 +05:30
|
|
|
|
2019-09-04 21:01:54 +05:30
|
|
|
beforeEach(() => {
|
|
|
|
wrapper = shallowMount(Applications, { propsData });
|
|
|
|
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
|
|
|
|
2019-09-04 21:01:54 +05:30
|
|
|
afterEach(() => {
|
|
|
|
wrapper.destroy();
|
|
|
|
});
|
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', () => {
|
|
|
|
knativeDomainEditor.vm.$emit('save', newHostname);
|
2019-07-07 11:18:12 +05:30
|
|
|
|
2019-09-04 21:01:54 +05:30
|
|
|
expect(eventHub.$emit).toHaveBeenCalledWith('saveKnativeDomain', {
|
|
|
|
id: 'knative',
|
|
|
|
params: { hostname: newHostname },
|
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', () => {
|
|
|
|
wrapper.find(KnativeDomainEditor).vm.$emit('set', newHostname);
|
2019-07-07 11:18:12 +05:30
|
|
|
|
2019-09-04 21:01:54 +05:30
|
|
|
expect(eventHub.$emit).toHaveBeenCalledWith('setKnativeHostname', {
|
|
|
|
id: 'knative',
|
|
|
|
hostname: newHostname,
|
2019-07-07 11:18:12 +05:30
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|
2019-12-26 22:10:19 +05:30
|
|
|
|
|
|
|
describe('Crossplane application', () => {
|
|
|
|
const propsData = {
|
|
|
|
applications: {
|
|
|
|
...APPLICATIONS_MOCK_STATE,
|
|
|
|
crossplane: {
|
|
|
|
title: 'Crossplane',
|
|
|
|
stack: {
|
|
|
|
code: '',
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
};
|
|
|
|
|
|
|
|
let wrapper;
|
|
|
|
beforeEach(() => {
|
|
|
|
wrapper = shallowMount(Applications, { propsData });
|
|
|
|
});
|
|
|
|
afterEach(() => {
|
|
|
|
wrapper.destroy();
|
|
|
|
});
|
|
|
|
it('renders the correct Component', () => {
|
|
|
|
const crossplane = wrapper.find(CrossplaneProviderStack);
|
|
|
|
expect(crossplane.exists()).toBe(true);
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
describe('Elastic Stack application', () => {
|
|
|
|
describe('with ingress installed with ip & elastic stack installable', () => {
|
|
|
|
it('renders hostname active input', () => {
|
|
|
|
vm = mountComponent(Applications, {
|
|
|
|
applications: {
|
|
|
|
...APPLICATIONS_MOCK_STATE,
|
|
|
|
ingress: {
|
|
|
|
title: 'Ingress',
|
|
|
|
status: 'installed',
|
|
|
|
externalIp: '1.1.1.1',
|
|
|
|
},
|
|
|
|
},
|
|
|
|
});
|
|
|
|
|
|
|
|
expect(
|
|
|
|
vm.$el
|
|
|
|
.querySelector('.js-cluster-application-row-elastic_stack .js-hostname')
|
|
|
|
.getAttribute('readonly'),
|
|
|
|
).toEqual(null);
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
describe('with ingress installed without external ip', () => {
|
|
|
|
it('does not render hostname input', () => {
|
|
|
|
vm = mountComponent(Applications, {
|
|
|
|
applications: {
|
|
|
|
...APPLICATIONS_MOCK_STATE,
|
|
|
|
ingress: { title: 'Ingress', status: 'installed' },
|
|
|
|
},
|
|
|
|
});
|
|
|
|
|
|
|
|
expect(vm.$el.querySelector('.js-cluster-application-row-elastic_stack .js-hostname')).toBe(
|
|
|
|
null,
|
|
|
|
);
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
describe('with ingress & elastic stack installed', () => {
|
|
|
|
it('renders readonly input', () => {
|
|
|
|
vm = mountComponent(Applications, {
|
|
|
|
applications: {
|
|
|
|
...APPLICATIONS_MOCK_STATE,
|
|
|
|
ingress: { title: 'Ingress', status: 'installed', externalIp: '1.1.1.1' },
|
|
|
|
elastic_stack: { title: 'Elastic Stack', status: 'installed', kibana_hostname: '' },
|
|
|
|
},
|
|
|
|
});
|
|
|
|
|
|
|
|
expect(
|
|
|
|
vm.$el
|
|
|
|
.querySelector('.js-cluster-application-row-elastic_stack .js-hostname')
|
|
|
|
.getAttribute('readonly'),
|
|
|
|
).toEqual('readonly');
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
describe('without ingress installed', () => {
|
|
|
|
beforeEach(() => {
|
|
|
|
vm = mountComponent(Applications, {
|
|
|
|
applications: APPLICATIONS_MOCK_STATE,
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
it('does not render input', () => {
|
|
|
|
expect(vm.$el.querySelector('.js-cluster-application-row-elastic_stack .js-hostname')).toBe(
|
|
|
|
null,
|
|
|
|
);
|
|
|
|
});
|
|
|
|
|
|
|
|
it('renders disabled install button', () => {
|
|
|
|
expect(
|
|
|
|
vm.$el
|
|
|
|
.querySelector(
|
|
|
|
'.js-cluster-application-row-elastic_stack .js-cluster-application-install-button',
|
|
|
|
)
|
|
|
|
.getAttribute('disabled'),
|
|
|
|
).toEqual('disabled');
|
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|
2018-03-17 18:26:18 +05:30
|
|
|
});
|