Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2019-10-22 18:06:06 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2019-10-22 18:06:06 +0300
commit6653aab95dfdfd260e8814e7499cc2345f451f99 (patch)
tree695acdeb5be70a87a26e39a592dd302f29d1c1fc /spec/frontend/clusters
parentb1bcdba89bc241e2cede910f26cf3f5fff8d7901 (diff)
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/frontend/clusters')
-rw-r--r--spec/frontend/clusters/components/applications_spec.js116
-rw-r--r--spec/frontend/clusters/services/mock_data.js13
-rw-r--r--spec/frontend/clusters/stores/clusters_store_spec.js23
3 files changed, 148 insertions, 4 deletions
diff --git a/spec/frontend/clusters/components/applications_spec.js b/spec/frontend/clusters/components/applications_spec.js
index fbcab078993..a9435cef774 100644
--- a/spec/frontend/clusters/components/applications_spec.js
+++ b/spec/frontend/clusters/components/applications_spec.js
@@ -13,6 +13,9 @@ describe('Applications', () => {
beforeEach(() => {
Applications = Vue.extend(applications);
+
+ gon.features = gon.features || {};
+ gon.features.enableClusterApplicationElasticStack = true;
});
afterEach(() => {
@@ -54,6 +57,10 @@ describe('Applications', () => {
it('renders a row for Knative', () => {
expect(vm.$el.querySelector('.js-cluster-application-row-knative')).not.toBeNull();
});
+
+ it('renders a row for Elastic Stack', () => {
+ expect(vm.$el.querySelector('.js-cluster-application-row-elastic_stack')).not.toBeNull();
+ });
});
describe('Group cluster applications', () => {
@@ -91,6 +98,10 @@ describe('Applications', () => {
it('renders a row for Knative', () => {
expect(vm.$el.querySelector('.js-cluster-application-row-knative')).not.toBeNull();
});
+
+ it('renders a row for Elastic Stack', () => {
+ expect(vm.$el.querySelector('.js-cluster-application-row-elastic_stack')).not.toBeNull();
+ });
});
describe('Instance cluster applications', () => {
@@ -128,6 +139,10 @@ describe('Applications', () => {
it('renders a row for Knative', () => {
expect(vm.$el.querySelector('.js-cluster-application-row-knative')).not.toBeNull();
});
+
+ it('renders a row for Elastic Stack', () => {
+ expect(vm.$el.querySelector('.js-cluster-application-row-elastic_stack')).not.toBeNull();
+ });
});
describe('Ingress application', () => {
@@ -168,6 +183,7 @@ describe('Applications', () => {
prometheus: { title: 'Prometheus' },
jupyter: { title: 'JupyterHub', hostname: '' },
knative: { title: 'Knative', hostname: '' },
+ elastic_stack: { title: 'Elastic Stack', kibana_hostname: '' },
},
});
@@ -260,7 +276,11 @@ describe('Applications', () => {
},
});
- expect(vm.$el.querySelector('.js-hostname').getAttribute('readonly')).toEqual(null);
+ expect(
+ vm.$el
+ .querySelector('.js-cluster-application-row-jupyter .js-hostname')
+ .getAttribute('readonly'),
+ ).toEqual(null);
});
});
@@ -273,7 +293,9 @@ describe('Applications', () => {
},
});
- expect(vm.$el.querySelector('.js-hostname')).toBe(null);
+ expect(vm.$el.querySelector('.js-cluster-application-row-jupyter .js-hostname')).toBe(
+ null,
+ );
});
});
@@ -287,7 +309,11 @@ describe('Applications', () => {
},
});
- expect(vm.$el.querySelector('.js-hostname').getAttribute('readonly')).toEqual('readonly');
+ expect(
+ vm.$el
+ .querySelector('.js-cluster-application-row-jupyter .js-hostname')
+ .getAttribute('readonly'),
+ ).toEqual('readonly');
});
});
@@ -299,7 +325,9 @@ describe('Applications', () => {
});
it('does not render input', () => {
- expect(vm.$el.querySelector('.js-hostname')).toBe(null);
+ expect(vm.$el.querySelector('.js-cluster-application-row-jupyter .js-hostname')).toBe(
+ null,
+ );
});
it('renders disabled install button', () => {
@@ -361,4 +389,84 @@ describe('Applications', () => {
});
});
});
+
+ 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');
+ });
+ });
+ });
});
diff --git a/spec/frontend/clusters/services/mock_data.js b/spec/frontend/clusters/services/mock_data.js
index 41ad398e924..e6feb89eecb 100644
--- a/spec/frontend/clusters/services/mock_data.js
+++ b/spec/frontend/clusters/services/mock_data.js
@@ -52,6 +52,12 @@ const CLUSTERS_MOCK_DATA = {
email: 'test@example.com',
can_uninstall: false,
},
+ {
+ name: 'elastic_stack',
+ status: APPLICATION_STATUS.INSTALLING,
+ status_reason: 'Cannot connect',
+ can_uninstall: false,
+ },
],
},
},
@@ -98,6 +104,11 @@ const CLUSTERS_MOCK_DATA = {
status_reason: 'Cannot connect',
email: 'test@example.com',
},
+ {
+ name: 'elastic_stack',
+ status: APPLICATION_STATUS.ERROR,
+ status_reason: 'Cannot connect',
+ },
],
},
},
@@ -110,6 +121,7 @@ const CLUSTERS_MOCK_DATA = {
'/gitlab-org/gitlab-shell/clusters/1/applications/prometheus': {},
'/gitlab-org/gitlab-shell/clusters/1/applications/jupyter': {},
'/gitlab-org/gitlab-shell/clusters/1/applications/knative': {},
+ '/gitlab-org/gitlab-shell/clusters/1/applications/elastic_stack': {},
},
};
@@ -131,6 +143,7 @@ const APPLICATIONS_MOCK_STATE = {
prometheus: { title: 'Prometheus' },
jupyter: { title: 'JupyterHub', status: 'installable', hostname: '' },
knative: { title: 'Knative ', status: 'installable', hostname: '' },
+ elastic_stack: { title: 'Elastic Stack', status: 'installable', kibana_hostname: '' },
};
export { CLUSTERS_MOCK_DATA, DEFAULT_APPLICATION_STATE, APPLICATIONS_MOCK_STATE };
diff --git a/spec/frontend/clusters/stores/clusters_store_spec.js b/spec/frontend/clusters/stores/clusters_store_spec.js
index 5ee06eb44c9..0e18a05f6c2 100644
--- a/spec/frontend/clusters/stores/clusters_store_spec.js
+++ b/spec/frontend/clusters/stores/clusters_store_spec.js
@@ -153,6 +153,18 @@ describe('Clusters Store', () => {
uninstallSuccessful: false,
uninstallFailed: false,
},
+ elastic_stack: {
+ title: 'Elastic Stack',
+ status: mockResponseData.applications[7].status,
+ installFailed: false,
+ statusReason: mockResponseData.applications[7].status_reason,
+ requestReason: null,
+ kibana_hostname: '',
+ installed: false,
+ uninstallable: false,
+ uninstallSuccessful: false,
+ uninstallFailed: false,
+ },
},
environments: [],
fetchingEnvironments: false,
@@ -183,5 +195,16 @@ describe('Clusters Store', () => {
`jupyter.${store.state.applications.ingress.externalIp}.nip.io`,
);
});
+
+ it('sets default hostname for elastic stack when ingress has a ip address', () => {
+ const mockResponseData =
+ CLUSTERS_MOCK_DATA.GET['/gitlab-org/gitlab-shell/clusters/2/status.json'].data;
+
+ store.updateStateFromServer(mockResponseData);
+
+ expect(store.state.applications.elastic_stack.kibana_hostname).toEqual(
+ `kibana.${store.state.applications.ingress.externalIp}.nip.io`,
+ );
+ });
});
});