diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2021-06-16 21:25:58 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2021-06-16 21:25:58 +0300 |
commit | a5f4bba440d7f9ea47046a0a561d49adf0a1e6d4 (patch) | |
tree | fb69158581673816a8cd895f9d352dcb3c678b1e /spec/lib/gitlab/prometheus/adapter_spec.rb | |
parent | d16b2e8639e99961de6ddc93909f3bb5c1445ba1 (diff) |
Add latest changes from gitlab-org/gitlab@14-0-stable-eev14.0.0-rc42
Diffstat (limited to 'spec/lib/gitlab/prometheus/adapter_spec.rb')
-rw-r--r-- | spec/lib/gitlab/prometheus/adapter_spec.rb | 24 |
1 files changed, 6 insertions, 18 deletions
diff --git a/spec/lib/gitlab/prometheus/adapter_spec.rb b/spec/lib/gitlab/prometheus/adapter_spec.rb index 259202178a2..1eaed65c805 100644 --- a/spec/lib/gitlab/prometheus/adapter_spec.rb +++ b/spec/lib/gitlab/prometheus/adapter_spec.rb @@ -21,7 +21,7 @@ RSpec.describe Gitlab::Prometheus::Adapter do end context 'with cluster with prometheus available' do - let!(:prometheus) { create(:clusters_applications_prometheus, :installed, cluster: cluster) } + let!(:prometheus) { create(:clusters_integrations_prometheus, cluster: cluster) } it 'returns prometheus service' do expect(subject.prometheus_adapter).to eq(prometheus_service) @@ -32,16 +32,12 @@ RSpec.describe Gitlab::Prometheus::Adapter do context "prometheus service can't execute queries" do let(:prometheus_service) { double(:prometheus_service, can_query?: false) } - context 'with cluster with prometheus integration' do - let!(:prometheus_integration) { create(:clusters_integrations_prometheus, cluster: cluster) } - - it 'returns the integration' do - expect(subject.prometheus_adapter).to eq(prometheus_integration) - end + before do + allow(project).to receive(:find_or_initialize_service).with('prometheus').and_return prometheus_service end - context 'with cluster with prometheus not available' do - let!(:prometheus) { create(:clusters_applications_prometheus, :installable, cluster: cluster) } + context 'with cluster with prometheus disabled' do + let!(:prometheus) { create(:clusters_integrations_prometheus, enabled: false, cluster: cluster) } it 'returns nil' do expect(subject.prometheus_adapter).to be_nil @@ -49,19 +45,11 @@ RSpec.describe Gitlab::Prometheus::Adapter do end context 'with cluster with prometheus available' do - let!(:prometheus) { create(:clusters_applications_prometheus, :installed, cluster: cluster) } + let!(:prometheus) { create(:clusters_integrations_prometheus, cluster: cluster) } it 'returns application handling all environments' do expect(subject.prometheus_adapter).to eq(prometheus) end - - context 'with cluster with prometheus integration' do - let!(:prometheus_integration) { create(:clusters_integrations_prometheus, cluster: cluster) } - - it 'returns the application' do - expect(subject.prometheus_adapter).to eq(prometheus) - end - end end context 'with cluster without prometheus installed' do |