summaryrefslogtreecommitdiff
path: root/spec/models/clusters/applications
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2020-01-21 14:21:10 +0000
committerGitLab Bot <gitlab-bot@gitlab.com>2020-01-21 14:21:10 +0000
commitcb0d23c455b73486fd1015f8ca9479b5b7e3585d (patch)
treed7dc129a407fd74266d2dc561bebf24665197c2f /spec/models/clusters/applications
parentc3e911be175c0aabfea1eb030f9e0ef23f5f3887 (diff)
downloadgitlab-ce-cb0d23c455b73486fd1015f8ca9479b5b7e3585d.tar.gz
Add latest changes from gitlab-org/gitlab@12-7-stable-ee
Diffstat (limited to 'spec/models/clusters/applications')
-rw-r--r--spec/models/clusters/applications/elastic_stack_spec.rb56
-rw-r--r--spec/models/clusters/applications/helm_spec.rb1
-rw-r--r--spec/models/clusters/applications/ingress_spec.rb10
-rw-r--r--spec/models/clusters/applications/jupyter_spec.rb5
-rw-r--r--spec/models/clusters/applications/knative_spec.rb1
-rw-r--r--spec/models/clusters/applications/prometheus_spec.rb13
6 files changed, 22 insertions, 64 deletions
diff --git a/spec/models/clusters/applications/elastic_stack_spec.rb b/spec/models/clusters/applications/elastic_stack_spec.rb
index d0e0dd5ad57..d336dc752c8 100644
--- a/spec/models/clusters/applications/elastic_stack_spec.rb
+++ b/spec/models/clusters/applications/elastic_stack_spec.rb
@@ -10,45 +10,8 @@ describe Clusters::Applications::ElasticStack do
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) }
+ let!(:elastic_stack) { create(:clusters_applications_elastic_stack) }
subject { elastic_stack.install_command }
@@ -80,8 +43,7 @@ describe Clusters::Applications::ElasticStack do
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) }
+ let!(:elastic_stack) { create(:clusters_applications_elastic_stack) }
subject { elastic_stack.uninstall_command }
@@ -100,19 +62,6 @@ describe Clusters::Applications::ElasticStack do
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
-
describe '#elasticsearch_client' do
context 'cluster is nil' do
it 'returns nil' do
@@ -123,6 +72,7 @@ describe Clusters::Applications::ElasticStack do
context "cluster doesn't have kubeclient" do
let(:cluster) { create(:cluster) }
+
subject { create(:clusters_applications_elastic_stack, cluster: cluster) }
it 'returns nil' do
diff --git a/spec/models/clusters/applications/helm_spec.rb b/spec/models/clusters/applications/helm_spec.rb
index 64f58155a66..87454e1d3e2 100644
--- a/spec/models/clusters/applications/helm_spec.rb
+++ b/spec/models/clusters/applications/helm_spec.rb
@@ -52,6 +52,7 @@ describe Clusters::Applications::Helm do
describe '#issue_client_cert' do
let(:application) { create(:clusters_applications_helm) }
+
subject { application.issue_client_cert }
it 'returns a new cert' do
diff --git a/spec/models/clusters/applications/ingress_spec.rb b/spec/models/clusters/applications/ingress_spec.rb
index d7ad7867e1a..c1158698601 100644
--- a/spec/models/clusters/applications/ingress_spec.rb
+++ b/spec/models/clusters/applications/ingress_spec.rb
@@ -142,11 +142,11 @@ describe Clusters::Applications::Ingress do
let(:project) { build(:project) }
let(:cluster) { build(:cluster, projects: [project]) }
- context 'when ingress_modsecurity is enabled' do
+ context 'when modsecurity_enabled is enabled' do
before do
- stub_feature_flags(ingress_modsecurity: true)
-
allow(subject).to receive(:cluster).and_return(cluster)
+
+ allow(subject).to receive(:modsecurity_enabled).and_return(true)
end
it 'includes modsecurity module enablement' do
@@ -173,10 +173,8 @@ describe Clusters::Applications::Ingress do
end
end
- context 'when ingress_modsecurity is disabled' do
+ context 'when modsecurity_enabled is disabled' do
before do
- stub_feature_flags(ingress_modsecurity: false)
-
allow(subject).to receive(:cluster).and_return(cluster)
end
diff --git a/spec/models/clusters/applications/jupyter_spec.rb b/spec/models/clusters/applications/jupyter_spec.rb
index 0ec9333d6a7..3bc5088d1ab 100644
--- a/spec/models/clusters/applications/jupyter_spec.rb
+++ b/spec/models/clusters/applications/jupyter_spec.rb
@@ -57,7 +57,8 @@ describe Clusters::Applications::Jupyter do
it 'is initialized with 4 arguments' do
expect(subject.name).to eq('jupyter')
expect(subject.chart).to eq('jupyter/jupyterhub')
- expect(subject.version).to eq('0.9-174bbd5')
+ expect(subject.version).to eq('0.9.0-beta.2')
+
expect(subject).to be_rbac
expect(subject.repository).to eq('https://jupyterhub.github.io/helm-chart/')
expect(subject.files).to eq(jupyter.files)
@@ -75,7 +76,7 @@ describe Clusters::Applications::Jupyter do
let(:jupyter) { create(:clusters_applications_jupyter, :errored, version: '0.0.1') }
it 'is initialized with the locked version' do
- expect(subject.version).to eq('0.9-174bbd5')
+ expect(subject.version).to eq('0.9.0-beta.2')
end
end
end
diff --git a/spec/models/clusters/applications/knative_spec.rb b/spec/models/clusters/applications/knative_spec.rb
index c1057af5f80..68ac3f0d483 100644
--- a/spec/models/clusters/applications/knative_spec.rb
+++ b/spec/models/clusters/applications/knative_spec.rb
@@ -131,6 +131,7 @@ describe Clusters::Applications::Knative do
describe '#update_command' do
let!(:current_installed_version) { knative.version = '0.1.0' }
+
subject { knative.update_command }
it 'is initialized with current version' do
diff --git a/spec/models/clusters/applications/prometheus_spec.rb b/spec/models/clusters/applications/prometheus_spec.rb
index d588ce3bc38..cf33d2b4273 100644
--- a/spec/models/clusters/applications/prometheus_spec.rb
+++ b/spec/models/clusters/applications/prometheus_spec.rb
@@ -66,6 +66,7 @@ describe Clusters::Applications::Prometheus do
context "cluster doesn't have kubeclient" do
let(:cluster) { create(:cluster) }
+
subject { create(:clusters_applications_prometheus, cluster: cluster) }
it 'returns nil' do
@@ -116,6 +117,12 @@ describe Clusters::Applications::Prometheus do
let(:exception) { Errno::ECONNRESET }
end
end
+
+ context 'when the network is unreachable' do
+ it_behaves_like 'exception caught for prometheus client' do
+ let(:exception) { Errno::ENETUNREACH }
+ end
+ end
end
end
@@ -129,7 +136,7 @@ describe Clusters::Applications::Prometheus do
it 'is initialized with 3 arguments' do
expect(subject.name).to eq('prometheus')
expect(subject.chart).to eq('stable/prometheus')
- expect(subject.version).to eq('6.7.3')
+ expect(subject.version).to eq('9.5.2')
expect(subject).to be_rbac
expect(subject.files).to eq(prometheus.files)
end
@@ -146,7 +153,7 @@ describe Clusters::Applications::Prometheus do
let(:prometheus) { create(:clusters_applications_prometheus, :errored, version: '2.0.0') }
it 'is initialized with the locked version' do
- expect(subject.version).to eq('6.7.3')
+ expect(subject.version).to eq('9.5.2')
end
end
@@ -217,7 +224,7 @@ describe Clusters::Applications::Prometheus do
it 'is initialized with 3 arguments' do
expect(patch_command.name).to eq('prometheus')
expect(patch_command.chart).to eq('stable/prometheus')
- expect(patch_command.version).to eq('6.7.3')
+ expect(patch_command.version).to eq('9.5.2')
expect(patch_command.files).to eq(prometheus.files)
end
end