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
diff options
context:
space:
mode:
Diffstat (limited to 'spec/lib/gitlab/prometheus/adapter_spec.rb')
-rw-r--r--spec/lib/gitlab/prometheus/adapter_spec.rb24
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