2018-03-17 18:26:18 +05:30
|
|
|
import Vue from 'vue';
|
|
|
|
import applications from '~/clusters/components/applications.vue';
|
2018-03-27 19:54:05 +05:30
|
|
|
import mountComponent from 'spec/helpers/vue_mount_component_helper';
|
2018-03-17 18:26:18 +05:30
|
|
|
|
|
|
|
describe('Applications', () => {
|
|
|
|
let vm;
|
|
|
|
let Applications;
|
|
|
|
|
|
|
|
beforeEach(() => {
|
|
|
|
Applications = Vue.extend(applications);
|
|
|
|
});
|
|
|
|
|
|
|
|
afterEach(() => {
|
|
|
|
vm.$destroy();
|
|
|
|
});
|
|
|
|
|
2019-01-03 12:48:30 +05:30
|
|
|
describe('', () => {
|
2018-03-17 18:26:18 +05:30
|
|
|
beforeEach(() => {
|
|
|
|
vm = mountComponent(Applications, {
|
|
|
|
applications: {
|
|
|
|
helm: { title: 'Helm Tiller' },
|
|
|
|
ingress: { title: 'Ingress' },
|
|
|
|
runner: { title: 'GitLab Runner' },
|
|
|
|
prometheus: { title: 'Prometheus' },
|
2018-11-08 19:23:39 +05:30
|
|
|
jupyter: { title: 'JupyterHub' },
|
2018-12-13 13:39:08 +05:30
|
|
|
knative: { title: 'Knative' },
|
2018-03-17 18:26:18 +05:30
|
|
|
},
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
it('renders a row for Helm Tiller', () => {
|
2019-01-03 12:48:30 +05:30
|
|
|
expect(vm.$el.querySelector('.js-cluster-application-row-helm')).toBeDefined();
|
2018-03-17 18:26:18 +05:30
|
|
|
});
|
|
|
|
|
|
|
|
it('renders a row for Ingress', () => {
|
2019-01-03 12:48:30 +05:30
|
|
|
expect(vm.$el.querySelector('.js-cluster-application-row-ingress')).toBeDefined();
|
2018-03-17 18:26:18 +05:30
|
|
|
});
|
|
|
|
|
|
|
|
it('renders a row for Prometheus', () => {
|
2019-01-03 12:48:30 +05:30
|
|
|
expect(vm.$el.querySelector('.js-cluster-application-row-prometheus')).toBeDefined();
|
2018-03-17 18:26:18 +05:30
|
|
|
});
|
|
|
|
|
|
|
|
it('renders a row for GitLab Runner', () => {
|
2019-01-03 12:48:30 +05:30
|
|
|
expect(vm.$el.querySelector('.js-cluster-application-row-runner')).toBeDefined();
|
2018-03-17 18:26:18 +05:30
|
|
|
});
|
2018-11-08 19:23:39 +05:30
|
|
|
|
|
|
|
it('renders a row for Jupyter', () => {
|
2019-01-03 12:48:30 +05:30
|
|
|
expect(vm.$el.querySelector('.js-cluster-application-row-jupyter')).not.toBe(null);
|
2018-11-08 19:23:39 +05:30
|
|
|
});
|
2018-12-13 13:39:08 +05:30
|
|
|
|
|
|
|
it('renders a row for Knative', () => {
|
2019-01-03 12:48:30 +05:30
|
|
|
expect(vm.$el.querySelector('.js-cluster-application-row-knative')).not.toBe(null);
|
2018-12-13 13:39:08 +05:30
|
|
|
});
|
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: {
|
|
|
|
ingress: {
|
|
|
|
title: 'Ingress',
|
|
|
|
status: 'installed',
|
|
|
|
externalIp: '0.0.0.0',
|
|
|
|
},
|
|
|
|
helm: { title: 'Helm Tiller' },
|
|
|
|
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: '' },
|
2018-03-27 19:54:05 +05:30
|
|
|
},
|
|
|
|
});
|
|
|
|
|
2018-11-08 19:23:39 +05:30
|
|
|
expect(vm.$el.querySelector('.js-ip-address').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');
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
describe('without ip address', () => {
|
|
|
|
it('renders an input text with a question mark and an alert text', () => {
|
|
|
|
vm = mountComponent(Applications, {
|
|
|
|
applications: {
|
|
|
|
ingress: {
|
|
|
|
title: 'Ingress',
|
|
|
|
status: 'installed',
|
|
|
|
},
|
|
|
|
helm: { title: 'Helm Tiller' },
|
|
|
|
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: '' },
|
2018-03-27 19:54:05 +05:30
|
|
|
},
|
|
|
|
});
|
|
|
|
|
2018-11-08 19:23:39 +05:30
|
|
|
expect(vm.$el.querySelector('.js-ip-address').value).toEqual('?');
|
2018-03-27 19:54:05 +05:30
|
|
|
|
|
|
|
expect(vm.$el.querySelector('.js-no-ip-message')).not.toBe(null);
|
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
describe('before installing', () => {
|
|
|
|
it('does not render the IP address', () => {
|
|
|
|
vm = mountComponent(Applications, {
|
|
|
|
applications: {
|
|
|
|
helm: { title: 'Helm Tiller' },
|
|
|
|
ingress: { title: 'Ingress' },
|
|
|
|
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: '' },
|
2018-03-27 19:54:05 +05:30
|
|
|
},
|
|
|
|
});
|
|
|
|
|
|
|
|
expect(vm.$el.textContent).not.toContain('Ingress IP Address');
|
|
|
|
expect(vm.$el.querySelector('.js-ip-address')).toBe(null);
|
|
|
|
});
|
|
|
|
});
|
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: {
|
|
|
|
helm: { title: 'Helm Tiller', status: 'installed' },
|
|
|
|
ingress: { title: 'Ingress', status: 'installed', externalIp: '1.1.1.1' },
|
|
|
|
runner: { title: 'GitLab Runner' },
|
|
|
|
prometheus: { title: 'Prometheus' },
|
|
|
|
jupyter: { title: 'JupyterHub', hostname: '', status: 'installable' },
|
2018-12-13 13:39:08 +05:30
|
|
|
knative: { title: 'Knative', hostname: '', status: 'installable' },
|
2018-11-08 19:23:39 +05:30
|
|
|
},
|
|
|
|
});
|
|
|
|
|
|
|
|
expect(vm.$el.querySelector('.js-hostname').getAttribute('readonly')).toEqual(null);
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
describe('with ingress installed without external ip', () => {
|
|
|
|
it('does not render hostname input', () => {
|
|
|
|
vm = mountComponent(Applications, {
|
|
|
|
applications: {
|
|
|
|
helm: { title: 'Helm Tiller', status: 'installed' },
|
|
|
|
ingress: { title: 'Ingress', status: 'installed' },
|
|
|
|
runner: { title: 'GitLab Runner' },
|
|
|
|
prometheus: { title: 'Prometheus' },
|
|
|
|
jupyter: { title: 'JupyterHub', hostname: '', status: 'installable' },
|
2018-12-13 13:39:08 +05:30
|
|
|
knative: { title: 'Knative', hostname: '', status: 'installable' },
|
2018-11-08 19:23:39 +05:30
|
|
|
},
|
|
|
|
});
|
|
|
|
|
|
|
|
expect(vm.$el.querySelector('.js-hostname')).toBe(null);
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
describe('with ingress & jupyter installed', () => {
|
|
|
|
it('renders readonly input', () => {
|
|
|
|
vm = mountComponent(Applications, {
|
|
|
|
applications: {
|
|
|
|
helm: { title: 'Helm Tiller', status: 'installed' },
|
|
|
|
ingress: { title: 'Ingress', status: 'installed', externalIp: '1.1.1.1' },
|
|
|
|
runner: { title: 'GitLab Runner' },
|
|
|
|
prometheus: { title: 'Prometheus' },
|
|
|
|
jupyter: { title: 'JupyterHub', status: 'installed', hostname: '' },
|
2018-12-13 13:39:08 +05:30
|
|
|
knative: { title: 'Knative', status: 'installed', hostname: '' },
|
2018-11-08 19:23:39 +05:30
|
|
|
},
|
|
|
|
});
|
|
|
|
|
|
|
|
expect(vm.$el.querySelector('.js-hostname').getAttribute('readonly')).toEqual('readonly');
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
describe('without ingress installed', () => {
|
|
|
|
beforeEach(() => {
|
|
|
|
vm = mountComponent(Applications, {
|
|
|
|
applications: {
|
|
|
|
helm: { title: 'Helm Tiller' },
|
|
|
|
ingress: { title: 'Ingress' },
|
|
|
|
runner: { title: 'GitLab Runner' },
|
|
|
|
prometheus: { title: 'Prometheus' },
|
|
|
|
jupyter: { title: 'JupyterHub', status: 'not_installable' },
|
2018-12-13 13:39:08 +05:30
|
|
|
knative: { title: 'Knative' },
|
2018-11-08 19:23:39 +05:30
|
|
|
},
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
it('does not render input', () => {
|
|
|
|
expect(vm.$el.querySelector('.js-hostname')).toBe(null);
|
|
|
|
});
|
|
|
|
|
|
|
|
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
|
|
|
});
|
|
|
|
});
|