summaryrefslogtreecommitdiff
path: root/spec
diff options
context:
space:
mode:
authorChris Baumbauer <cab@cabnetworks.net>2018-12-20 19:38:50 -0800
committerChris Baumbauer <cab@cabnetworks.net>2019-01-03 13:10:40 -0800
commitda873584afaaa87ee993df8114f4097bde25be8b (patch)
tree7b46e5c55b065c789c1354db6fc12344c91d173c /spec
parent0e20c8eb8b71eaa71fbfd5dedf6ccd6492531e14 (diff)
downloadgitlab-ce-da873584afaaa87ee993df8114f4097bde25be8b.tar.gz
Add Knative metrics to Prometheus
Diffstat (limited to 'spec')
-rw-r--r--spec/models/clusters/applications/knative_spec.rb17
-rw-r--r--spec/models/clusters/applications/prometheus_spec.rb15
-rw-r--r--spec/models/clusters/cluster_spec.rb1
3 files changed, 33 insertions, 0 deletions
diff --git a/spec/models/clusters/applications/knative_spec.rb b/spec/models/clusters/applications/knative_spec.rb
index 809880f5969..8fc755d2a26 100644
--- a/spec/models/clusters/applications/knative_spec.rb
+++ b/spec/models/clusters/applications/knative_spec.rb
@@ -108,6 +108,23 @@ describe Clusters::Applications::Knative do
expect(subject.version).to eq('0.2.2')
expect(subject.files).to eq(knative.files)
end
+
+ it 'should not install metrics for prometheus' do
+ expect(subject.postinstall).to be_nil
+ end
+
+ context 'with prometheus installed' do
+ let(:prometheus) { create(:clusters_applications_prometheus, :installed) }
+ let(:knative) { create(:clusters_applications_knative, cluster: prometheus.cluster) }
+
+ subject { knative.install_command }
+
+ it 'should install metrics' do
+ expect(subject.postinstall).not_to be_nil
+ expect(subject.postinstall.length).to be(1)
+ expect(subject.postinstall[0]).to eql("kubectl apply -f #{Clusters::Applications::Knative::METRICS_CONFIG}")
+ end
+ end
end
describe '#files' do
diff --git a/spec/models/clusters/applications/prometheus_spec.rb b/spec/models/clusters/applications/prometheus_spec.rb
index 893ed3e3f64..27143f29350 100644
--- a/spec/models/clusters/applications/prometheus_spec.rb
+++ b/spec/models/clusters/applications/prometheus_spec.rb
@@ -165,6 +165,10 @@ describe Clusters::Applications::Prometheus do
expect(subject.files).to eq(prometheus.files)
end
+ it 'should not install knative metrics' do
+ expect(subject.postinstall).to be_nil
+ end
+
context 'on a rbac enabled cluster' do
before do
prometheus.cluster.platform_kubernetes.rbac!
@@ -180,6 +184,17 @@ describe Clusters::Applications::Prometheus do
expect(subject.version).to eq('6.7.3')
end
end
+
+ context 'with knative installed' do
+ let(:knative) { create(:clusters_applications_knative, :installed ) }
+ let(:prometheus) { create(:clusters_applications_prometheus, cluster: knative.cluster) }
+
+ subject { prometheus.install_command }
+
+ it 'should install metrics' do
+ expect(subject.postinstall).to include("kubectl apply -f #{Clusters::Applications::Knative::METRICS_CONFIG}")
+ end
+ end
end
describe '#files' do
diff --git a/spec/models/clusters/cluster_spec.rb b/spec/models/clusters/cluster_spec.rb
index 840f74c9890..f447e64b029 100644
--- a/spec/models/clusters/cluster_spec.rb
+++ b/spec/models/clusters/cluster_spec.rb
@@ -29,6 +29,7 @@ describe Clusters::Cluster do
it { is_expected.to delegate_method(:available?).to(:application_helm).with_prefix }
it { is_expected.to delegate_method(:available?).to(:application_ingress).with_prefix }
it { is_expected.to delegate_method(:available?).to(:application_prometheus).with_prefix }
+ it { is_expected.to delegate_method(:available?).to(:application_knative).with_prefix }
it { is_expected.to respond_to :project }