diff options
author | Chris Baumbauer <cab@cabnetworks.net> | 2018-12-20 19:38:50 -0800 |
---|---|---|
committer | Chris Baumbauer <cab@cabnetworks.net> | 2019-01-03 13:10:40 -0800 |
commit | da873584afaaa87ee993df8114f4097bde25be8b (patch) | |
tree | 7b46e5c55b065c789c1354db6fc12344c91d173c /spec | |
parent | 0e20c8eb8b71eaa71fbfd5dedf6ccd6492531e14 (diff) | |
download | gitlab-ce-da873584afaaa87ee993df8114f4097bde25be8b.tar.gz |
Add Knative metrics to Prometheus
Diffstat (limited to 'spec')
-rw-r--r-- | spec/models/clusters/applications/knative_spec.rb | 17 | ||||
-rw-r--r-- | spec/models/clusters/applications/prometheus_spec.rb | 15 | ||||
-rw-r--r-- | spec/models/clusters/cluster_spec.rb | 1 |
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 } |