summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThong Kuah <tkuah@gitlab.com>2019-02-15 12:43:44 +1300
committerThong Kuah <tkuah@gitlab.com>2019-02-15 12:43:44 +1300
commit13bb704d50cc885935bc7b0f850d47c1ace5cdd7 (patch)
treef062da3cd61f2cce2e7c74d81e796d0a278e8aba
parent4e5494081e95adf05ab9df47c284bd796ecc4b01 (diff)
downloadgitlab-ce-13bb704d50cc885935bc7b0f850d47c1ace5cdd7.tar.gz
Remove #ready? method in favor of #available?
Given https://github.com/helm/helm/issues/3338, I think that we should exclude applications that are :update_errored, :updating as well.
-rw-r--r--app/models/clusters/concerns/application_status.rb4
-rw-r--r--app/services/prometheus/adapter_service.rb2
-rw-r--r--spec/services/prometheus/adapter_service_spec.rb4
-rw-r--r--spec/support/shared_examples/models/cluster_application_status_shared_examples.rb26
4 files changed, 3 insertions, 33 deletions
diff --git a/app/models/clusters/concerns/application_status.rb b/app/models/clusters/concerns/application_status.rb
index 9ecd7229604..5c0164831bc 100644
--- a/app/models/clusters/concerns/application_status.rb
+++ b/app/models/clusters/concerns/application_status.rb
@@ -80,10 +80,6 @@ module Clusters
installed? || updated?
end
- def ready?
- installed? || updating? || updated? || update_errored?
- end
-
def update_in_progress?
updating?
end
diff --git a/app/services/prometheus/adapter_service.rb b/app/services/prometheus/adapter_service.rb
index a791845ba20..3be958e1613 100644
--- a/app/services/prometheus/adapter_service.rb
+++ b/app/services/prometheus/adapter_service.rb
@@ -30,7 +30,7 @@ module Prometheus
return unless deployment_platform.respond_to?(:cluster)
cluster = deployment_platform.cluster
- return unless cluster.application_prometheus&.ready?
+ return unless cluster.application_prometheus&.available?
cluster.application_prometheus
end
diff --git a/spec/services/prometheus/adapter_service_spec.rb b/spec/services/prometheus/adapter_service_spec.rb
index 5fe9668fd9d..505e2935e93 100644
--- a/spec/services/prometheus/adapter_service_spec.rb
+++ b/spec/services/prometheus/adapter_service_spec.rb
@@ -22,7 +22,7 @@ describe Prometheus::AdapterService do
context "prometheus service can't execute queries" do
let(:prometheus_service) { double(:prometheus_service, can_query?: false) }
- context 'with cluster with prometheus not yet installed' do
+ context 'with cluster with prometheus not available' do
let!(:prometheus) { create(:clusters_applications_prometheus, :installable, cluster: cluster) }
it 'returns nil' do
@@ -30,7 +30,7 @@ describe Prometheus::AdapterService do
end
end
- context 'with cluster with prometheus installed' do
+ context 'with cluster with prometheus available' do
let!(:prometheus) { create(:clusters_applications_prometheus, :installed, cluster: cluster) }
it 'returns application handling all environments' do
diff --git a/spec/support/shared_examples/models/cluster_application_status_shared_examples.rb b/spec/support/shared_examples/models/cluster_application_status_shared_examples.rb
index 18b279658bc..c96a65cb56a 100644
--- a/spec/support/shared_examples/models/cluster_application_status_shared_examples.rb
+++ b/spec/support/shared_examples/models/cluster_application_status_shared_examples.rb
@@ -138,32 +138,6 @@ shared_examples 'cluster application status specs' do |application_name|
end
end
- describe '#ready?' do
- using RSpec::Parameterized::TableSyntax
-
- where(:trait, :ready) do
- :not_installable | false
- :installable | false
- :scheduled | false
- :installing | false
- :installed | true
- :updating | true
- :updated | true
- :errored | false
- :update_errored | true
- end
-
- with_them do
- subject { build(application_name, trait) }
-
- if params[:ready]
- it { is_expected.to be_ready }
- else
- it { is_expected.not_to be_ready }
- end
- end
- end
-
describe '#available?' do
using RSpec::Parameterized::TableSyntax