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
path: root/spec
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
parentb1bcdba89bc241e2cede910f26cf3f5fff8d7901 (diff)
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec')
-rw-r--r--spec/factories/clusters/applications/helm.rb4
-rw-r--r--spec/features/clusters/installing_applications_shared_examples.rb31
-rw-r--r--spec/fixtures/api/schemas/cluster_status.json1
-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
-rw-r--r--spec/lib/gitlab/kubernetes/helm/install_command_spec.rb27
-rw-r--r--spec/lib/gitlab/usage_data_spec.rb3
-rw-r--r--spec/models/clusters/applications/elastic_stack_spec.rb113
-rw-r--r--spec/models/clusters/applications/ingress_spec.rb8
-rw-r--r--spec/models/clusters/cluster_spec.rb3
-rw-r--r--spec/models/issue_spec.rb13
-rw-r--r--spec/services/clusters/applications/create_service_spec.rb28
-rw-r--r--spec/support/shared_examples/models/cluster_application_helm_cert_examples.rb4
14 files changed, 350 insertions, 37 deletions
diff --git a/spec/factories/clusters/applications/helm.rb b/spec/factories/clusters/applications/helm.rb
index c7ec7c11743..09689b33a8c 100644
--- a/spec/factories/clusters/applications/helm.rb
+++ b/spec/factories/clusters/applications/helm.rb
@@ -79,6 +79,10 @@ FactoryBot.define do
cluster factory: %i(cluster with_installed_helm provided_by_gcp)
end
+ factory :clusters_applications_elastic_stack, class: Clusters::Applications::ElasticStack do
+ cluster factory: %i(cluster with_installed_helm provided_by_gcp)
+ end
+
factory :clusters_applications_prometheus, class: Clusters::Applications::Prometheus do
cluster factory: %i(cluster with_installed_helm provided_by_gcp)
end
diff --git a/spec/features/clusters/installing_applications_shared_examples.rb b/spec/features/clusters/installing_applications_shared_examples.rb
index cb8fd8c607c..988cd228c1c 100644
--- a/spec/features/clusters/installing_applications_shared_examples.rb
+++ b/spec/features/clusters/installing_applications_shared_examples.rb
@@ -178,6 +178,37 @@ shared_examples "installing applications on a cluster" do
end
end
+ context 'when user installs Elastic Stack' do
+ before do
+ allow(ClusterInstallAppWorker).to receive(:perform_async)
+ allow(ClusterWaitForIngressIpAddressWorker).to receive(:perform_in)
+ allow(ClusterWaitForIngressIpAddressWorker).to receive(:perform_async)
+
+ create(:clusters_applications_helm, :installed, cluster: cluster)
+ create(:clusters_applications_ingress, :installed, external_ip: '127.0.0.1', cluster: cluster)
+
+ page.within('.js-cluster-application-row-elastic_stack') do
+ click_button 'Install'
+ end
+ end
+
+ it 'shows status transition' do
+ page.within('.js-cluster-application-row-elastic_stack') do
+ expect(page).to have_css('.js-cluster-application-install-button', exact_text: 'Installing')
+
+ Clusters::Cluster.last.application_elastic_stack.make_installing!
+
+ expect(page).to have_css('.js-cluster-application-install-button', exact_text: 'Installing')
+
+ Clusters::Cluster.last.application_elastic_stack.make_installed!
+
+ expect(page).to have_css('.js-cluster-application-uninstall-button', exact_text: 'Uninstall')
+ end
+
+ expect(page).to have_content('Elastic Stack was successfully installed on your Kubernetes cluster')
+ end
+ end
+
context 'when user installs Ingress' do
before do
allow(ClusterInstallAppWorker).to receive(:perform_async)
diff --git a/spec/fixtures/api/schemas/cluster_status.json b/spec/fixtures/api/schemas/cluster_status.json
index 695175689b9..f3503f60e0c 100644
--- a/spec/fixtures/api/schemas/cluster_status.json
+++ b/spec/fixtures/api/schemas/cluster_status.json
@@ -35,6 +35,7 @@
"external_ip": { "type": ["string", "null"] },
"external_hostname": { "type": ["string", "null"] },
"hostname": { "type": ["string", "null"] },
+ "kibana_hostname": { "type": ["string", "null"] },
"email": { "type": ["string", "null"] },
"update_available": { "type": ["boolean", "null"] },
"can_uninstall": { "type": "boolean" }
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`,
+ );
+ });
});
});
diff --git a/spec/lib/gitlab/kubernetes/helm/install_command_spec.rb b/spec/lib/gitlab/kubernetes/helm/install_command_spec.rb
index 9eb3322f1a6..e5a361bdab3 100644
--- a/spec/lib/gitlab/kubernetes/helm/install_command_spec.rb
+++ b/spec/lib/gitlab/kubernetes/helm/install_command_spec.rb
@@ -86,33 +86,6 @@ describe Gitlab::Kubernetes::Helm::InstallCommand do
end
end
- context 'when there is no repository' do
- let(:repository) { nil }
-
- it_behaves_like 'helm commands' do
- let(:commands) do
- <<~EOS
- helm init --upgrade
- for i in $(seq 1 30); do helm version #{tls_flags} && s=0 && break || s=$?; sleep 1s; echo \"Retrying ($i)...\"; done; (exit $s)
- #{helm_install_command}
- EOS
- end
-
- let(:helm_install_command) do
- <<~EOS.squish
- helm upgrade app-name chart-name
- --install
- --reset-values
- #{tls_flags}
- --version 1.2.3
- --set rbac.create\\=false,rbac.enabled\\=false
- --namespace gitlab-managed-apps
- -f /data/helm/app-name/config/values.yaml
- EOS
- end
- end
- end
-
context 'when there is a pre-install script' do
let(:preinstall) { ['/bin/date', '/bin/true'] }
diff --git a/spec/lib/gitlab/usage_data_spec.rb b/spec/lib/gitlab/usage_data_spec.rb
index f2e864472c5..8ecab12ca28 100644
--- a/spec/lib/gitlab/usage_data_spec.rb
+++ b/spec/lib/gitlab/usage_data_spec.rb
@@ -32,6 +32,7 @@ describe Gitlab::UsageData do
create(:clusters_applications_prometheus, :installed, cluster: gcp_cluster)
create(:clusters_applications_runner, :installed, cluster: gcp_cluster)
create(:clusters_applications_knative, :installed, cluster: gcp_cluster)
+ create(:clusters_applications_elastic_stack, :installed, cluster: gcp_cluster)
ProjectFeature.first.update_attribute('repository_access_level', 0)
end
@@ -120,6 +121,7 @@ describe Gitlab::UsageData do
clusters_applications_prometheus
clusters_applications_runner
clusters_applications_knative
+ clusters_applications_elastic_stack
in_review_folder
groups
issues
@@ -190,6 +192,7 @@ describe Gitlab::UsageData do
expect(count_data[:clusters_applications_prometheus]).to eq(1)
expect(count_data[:clusters_applications_runner]).to eq(1)
expect(count_data[:clusters_applications_knative]).to eq(1)
+ expect(count_data[:clusters_applications_elastic_stack]).to eq(1)
end
it 'works when queries time out' do
diff --git a/spec/models/clusters/applications/elastic_stack_spec.rb b/spec/models/clusters/applications/elastic_stack_spec.rb
new file mode 100644
index 00000000000..2b4697ee176
--- /dev/null
+++ b/spec/models/clusters/applications/elastic_stack_spec.rb
@@ -0,0 +1,113 @@
+# frozen_string_literal: true
+
+require 'spec_helper'
+
+describe Clusters::Applications::ElasticStack do
+ include_examples 'cluster application core specs', :clusters_applications_elastic_stack
+ include_examples 'cluster application status specs', :clusters_applications_elastic_stack
+ include_examples 'cluster application version specs', :clusters_applications_elastic_stack
+ include_examples 'cluster application helm specs', :clusters_applications_elastic_stack
+
+ describe '#can_uninstall?' do
+ let(:ingress) { create(:clusters_applications_ingress, :installed, external_hostname: 'localhost.localdomain') }
+ let(:elastic_stack) { create(:clusters_applications_elastic_stack, cluster: ingress.cluster) }
+
+ subject { elastic_stack.can_uninstall? }
+
+ it { is_expected.to be_truthy }
+ end
+
+ describe '#set_initial_status' do
+ before do
+ elastic_stack.set_initial_status
+ end
+
+ context 'when ingress is not installed' do
+ let(:cluster) { create(:cluster, :provided_by_gcp) }
+ let(:elastic_stack) { create(:clusters_applications_elastic_stack, cluster: cluster) }
+
+ it { expect(elastic_stack).to be_not_installable }
+ end
+
+ context 'when ingress is installed and external_ip is assigned' do
+ let(:ingress) { create(:clusters_applications_ingress, :installed, external_ip: '127.0.0.1') }
+ let(:elastic_stack) { create(:clusters_applications_elastic_stack, cluster: ingress.cluster) }
+
+ it { expect(elastic_stack).to be_installable }
+ end
+
+ context 'when ingress is installed and external_hostname is assigned' do
+ let(:ingress) { create(:clusters_applications_ingress, :installed, external_hostname: 'localhost.localdomain') }
+ let(:elastic_stack) { create(:clusters_applications_elastic_stack, cluster: ingress.cluster) }
+
+ it { expect(elastic_stack).to be_installable }
+ end
+ end
+
+ describe '#install_command' do
+ let!(:ingress) { create(:clusters_applications_ingress, :installed, external_ip: '127.0.0.1') }
+ let!(:elastic_stack) { create(:clusters_applications_elastic_stack, cluster: ingress.cluster) }
+
+ subject { elastic_stack.install_command }
+
+ it { is_expected.to be_an_instance_of(Gitlab::Kubernetes::Helm::InstallCommand) }
+
+ it 'is initialized with elastic stack arguments' do
+ expect(subject.name).to eq('elastic-stack')
+ expect(subject.chart).to eq('stable/elastic-stack')
+ expect(subject.version).to eq('1.8.0')
+ expect(subject).to be_rbac
+ expect(subject.files).to eq(elastic_stack.files)
+ end
+
+ context 'on a non rbac enabled cluster' do
+ before do
+ elastic_stack.cluster.platform_kubernetes.abac!
+ end
+
+ it { is_expected.not_to be_rbac }
+ end
+
+ context 'application failed to install previously' do
+ let(:elastic_stack) { create(:clusters_applications_elastic_stack, :errored, version: '0.0.1') }
+
+ it 'is initialized with the locked version' do
+ expect(subject.version).to eq('1.8.0')
+ end
+ end
+ end
+
+ describe '#uninstall_command' do
+ let!(:ingress) { create(:clusters_applications_ingress, :installed, external_ip: '127.0.0.1') }
+ let!(:elastic_stack) { create(:clusters_applications_elastic_stack, cluster: ingress.cluster) }
+
+ subject { elastic_stack.uninstall_command }
+
+ it { is_expected.to be_an_instance_of(Gitlab::Kubernetes::Helm::DeleteCommand) }
+
+ it 'is initialized with elastic stack arguments' do
+ expect(subject.name).to eq('elastic-stack')
+ expect(subject).to be_rbac
+ expect(subject.files).to eq(elastic_stack.files)
+ end
+
+ it 'specifies a post delete command to remove custom resource definitions' do
+ expect(subject.postdelete).to eq([
+ 'kubectl delete pvc --selector release\\=elastic-stack'
+ ])
+ end
+ end
+
+ describe '#files' do
+ let!(:ingress) { create(:clusters_applications_ingress, :installed, external_ip: '127.0.0.1') }
+ let!(:elastic_stack) { create(:clusters_applications_elastic_stack, cluster: ingress.cluster) }
+
+ let(:values) { subject[:'values.yaml'] }
+
+ subject { elastic_stack.files }
+
+ it 'includes elastic stack specific keys in the values.yaml file' do
+ expect(values).to include('ELASTICSEARCH_HOSTS')
+ end
+ end
+end
diff --git a/spec/models/clusters/applications/ingress_spec.rb b/spec/models/clusters/applications/ingress_spec.rb
index be0c6df7ad6..9806b49d7a6 100644
--- a/spec/models/clusters/applications/ingress_spec.rb
+++ b/spec/models/clusters/applications/ingress_spec.rb
@@ -21,7 +21,7 @@ describe Clusters::Applications::Ingress do
describe '#can_uninstall?' do
subject { ingress.can_uninstall? }
- it 'returns true if application_jupyter_nil_or_installable? AND external_ip_or_hostname? are true' do
+ it 'returns true if external ip is set and no application exists' do
ingress.external_ip = 'IP'
is_expected.to be_truthy
@@ -33,6 +33,12 @@ describe Clusters::Applications::Ingress do
is_expected.to be_falsey
end
+ it 'returns false if application_elastic_stack_nil_or_installable? is false' do
+ create(:clusters_applications_elastic_stack, :installed, cluster: ingress.cluster)
+
+ is_expected.to be_falsey
+ end
+
it 'returns false if external_ip_or_hostname? is false' do
is_expected.to be_falsey
end
diff --git a/spec/models/clusters/cluster_spec.rb b/spec/models/clusters/cluster_spec.rb
index 48e3b4d6bae..c2c57379461 100644
--- a/spec/models/clusters/cluster_spec.rb
+++ b/spec/models/clusters/cluster_spec.rb
@@ -508,9 +508,10 @@ describe Clusters::Cluster, :use_clean_rails_memory_store_caching do
let!(:runner) { create(:clusters_applications_runner, cluster: cluster) }
let!(:jupyter) { create(:clusters_applications_jupyter, cluster: cluster) }
let!(:knative) { create(:clusters_applications_knative, cluster: cluster) }
+ let!(:elastic_stack) { create(:clusters_applications_elastic_stack, cluster: cluster) }
it 'returns a list of created applications' do
- is_expected.to contain_exactly(helm, ingress, cert_manager, prometheus, runner, jupyter, knative)
+ is_expected.to contain_exactly(helm, ingress, cert_manager, prometheus, runner, jupyter, knative, elastic_stack)
end
end
end
diff --git a/spec/models/issue_spec.rb b/spec/models/issue_spec.rb
index 18a1a30eee5..0f78cb4d9b1 100644
--- a/spec/models/issue_spec.rb
+++ b/spec/models/issue_spec.rb
@@ -423,6 +423,19 @@ describe Issue do
issue = create(:issue, title: 'testing-issue', confidential: true)
expect(issue.to_branch_name).to match /confidential-issue\z/
end
+
+ context 'issue title longer than 100 characters' do
+ let(:issue) { create(:issue, iid: 999, title: 'Lorem ipsum dolor sit amet consectetur adipiscing elit Mauris sit amet ipsum id lacus custom fringilla convallis') }
+
+ it "truncates branch name to at most 100 characters" do
+ expect(issue.to_branch_name.length).to be <= 100
+ end
+
+ it "truncates dangling parts of the branch name" do
+ # 100 characters would've got us "999-lorem...lacus-custom-fri".
+ expect(issue.to_branch_name).to eq("999-lorem-ipsum-dolor-sit-amet-consectetur-adipiscing-elit-mauris-sit-amet-ipsum-id-lacus-custom")
+ end
+ end
end
describe '#can_be_worked_on?' do
diff --git a/spec/services/clusters/applications/create_service_spec.rb b/spec/services/clusters/applications/create_service_spec.rb
index 8dd573c3698..bdacb9ce071 100644
--- a/spec/services/clusters/applications/create_service_spec.rb
+++ b/spec/services/clusters/applications/create_service_spec.rb
@@ -132,6 +132,34 @@ describe Clusters::Applications::CreateService do
expect(subject.hostname).to eq('example.com')
end
end
+
+ context 'elastic stack application' do
+ let(:params) do
+ {
+ application: 'elastic_stack',
+ kibana_hostname: 'example.com'
+ }
+ end
+
+ before do
+ create(:clusters_applications_ingress, :installed, external_ip: "127.0.0.0", cluster: cluster)
+ expect_any_instance_of(Clusters::Applications::ElasticStack)
+ .to receive(:make_scheduled!)
+ .and_call_original
+ end
+
+ it 'creates the application' do
+ expect do
+ subject
+
+ cluster.reload
+ end.to change(cluster, :application_elastic_stack)
+ end
+
+ it 'sets the kibana_hostname' do
+ expect(subject.kibana_hostname).to eq('example.com')
+ end
+ end
end
context 'invalid application' do
diff --git a/spec/support/shared_examples/models/cluster_application_helm_cert_examples.rb b/spec/support/shared_examples/models/cluster_application_helm_cert_examples.rb
index 7ddb3b11c85..1c8c19acc74 100644
--- a/spec/support/shared_examples/models/cluster_application_helm_cert_examples.rb
+++ b/spec/support/shared_examples/models/cluster_application_helm_cert_examples.rb
@@ -8,10 +8,6 @@ shared_examples 'cluster application helm specs' do |application_name|
it { is_expected.to be_an_instance_of(Gitlab::Kubernetes::Helm::DeleteCommand) }
- it 'has the application name' do
- expect(subject.name).to eq(application.name)
- end
-
it 'has files' do
expect(subject.files).to eq(application.files)
end