Commit a6f882f3 authored by Stan Hu's avatar Stan Hu

Merge branch 'move_ready_to_application_concern' into 'master'

Remove application `#ready?`

See merge request gitlab-org/gitlab-ce!25128
parents ab9f8785 13bb704d
...@@ -6,7 +6,6 @@ module Clusters ...@@ -6,7 +6,6 @@ module Clusters
include PrometheusAdapter include PrometheusAdapter
VERSION = '6.7.3' VERSION = '6.7.3'
READY_STATUS = [:installed, :updating, :updated, :update_errored].freeze
self.table_name = 'clusters_applications_prometheus' self.table_name = 'clusters_applications_prometheus'
...@@ -25,10 +24,6 @@ module Clusters ...@@ -25,10 +24,6 @@ module Clusters
end end
end end
def ready?
READY_STATUS.include?(status_name)
end
def chart def chart
'stable/prometheus' 'stable/prometheus'
end end
......
...@@ -30,7 +30,7 @@ module Prometheus ...@@ -30,7 +30,7 @@ module Prometheus
return unless deployment_platform.respond_to?(:cluster) return unless deployment_platform.respond_to?(:cluster)
cluster = deployment_platform.cluster cluster = deployment_platform.cluster
return unless cluster.application_prometheus&.ready? return unless cluster.application_prometheus&.available?
cluster.application_prometheus cluster.application_prometheus
end end
......
...@@ -27,65 +27,6 @@ describe Clusters::Applications::Prometheus do ...@@ -27,65 +27,6 @@ describe Clusters::Applications::Prometheus do
end end
end end
describe '#ready' do
let(:project) { create(:project) }
let(:cluster) { create(:cluster, projects: [project]) }
it 'returns true when installed' do
application = build(:clusters_applications_prometheus, :installed, cluster: cluster)
expect(application).to be_ready
end
it 'returns false when not_installable' do
application = build(:clusters_applications_prometheus, :not_installable, cluster: cluster)
expect(application).not_to be_ready
end
it 'returns false when installable' do
application = build(:clusters_applications_prometheus, :installable, cluster: cluster)
expect(application).not_to be_ready
end
it 'returns false when scheduled' do
application = build(:clusters_applications_prometheus, :scheduled, cluster: cluster)
expect(application).not_to be_ready
end
it 'returns false when installing' do
application = build(:clusters_applications_prometheus, :installing, cluster: cluster)
expect(application).not_to be_ready
end
it 'returns false when errored' do
application = build(:clusters_applications_prometheus, :errored, cluster: cluster)
expect(application).not_to be_ready
end
it 'returns true when updating' do
application = build(:clusters_applications_prometheus, :updating, cluster: cluster)
expect(application).to be_ready
end
it 'returns true when updated' do
application = build(:clusters_applications_prometheus, :updated, cluster: cluster)
expect(application).to be_ready
end
it 'returns true when errored' do
application = build(:clusters_applications_prometheus, :update_errored, cluster: cluster)
expect(application).to be_ready
end
end
describe '#prometheus_client' do describe '#prometheus_client' do
context 'cluster is nil' do context 'cluster is nil' do
it 'returns nil' do it 'returns nil' do
......
...@@ -22,7 +22,15 @@ describe Prometheus::AdapterService do ...@@ -22,7 +22,15 @@ describe Prometheus::AdapterService do
context "prometheus service can't execute queries" do context "prometheus service can't execute queries" do
let(:prometheus_service) { double(:prometheus_service, can_query?: false) } let(:prometheus_service) { double(:prometheus_service, can_query?: false) }
context 'with cluster with prometheus installed' do context 'with cluster with prometheus not available' do
let!(:prometheus) { create(:clusters_applications_prometheus, :installable, cluster: cluster) }
it 'returns nil' do
expect(subject.prometheus_adapter).to be_nil
end
end
context 'with cluster with prometheus available' do
let!(:prometheus) { create(:clusters_applications_prometheus, :installed, cluster: cluster) } let!(:prometheus) { create(:clusters_applications_prometheus, :installed, cluster: cluster) }
it 'returns application handling all environments' do it 'returns application handling all environments' do
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment