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:
authorTiago Botelho <tiagonbotelho@hotmail.com>2018-06-25 12:57:29 +0300
committerTiago Botelho <tiagonbotelho@hotmail.com>2018-07-25 11:39:39 +0300
commiteb7c08c7a644fa07b274b83624005ac53acf7faf (patch)
tree08102d7589a06e1aa550d1703a79f845b9333610 /spec/models/clusters
parent4063141223f9b89248e3c33df5711201f75d3718 (diff)
Backports relevant changes made in https://gitlab.com/gitlab-org/gitlab-ee/merge_requests/5163 to CE
Diffstat (limited to 'spec/models/clusters')
-rw-r--r--spec/models/clusters/applications/prometheus_spec.rb57
1 files changed, 50 insertions, 7 deletions
diff --git a/spec/models/clusters/applications/prometheus_spec.rb b/spec/models/clusters/applications/prometheus_spec.rb
index efd57040005..784b60fef8d 100644
--- a/spec/models/clusters/applications/prometheus_spec.rb
+++ b/spec/models/clusters/applications/prometheus_spec.rb
@@ -34,6 +34,47 @@ describe Clusters::Applications::Prometheus do
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.ready?).to be true
+ end
+
+ it 'returns false when not_installable' do
+ application = build(:clusters_applications_prometheus, :not_installable, cluster: cluster)
+
+ expect(application.ready?).to be false
+ end
+
+ it 'returns false when installable' do
+ application = build(:clusters_applications_prometheus, :installable, cluster: cluster)
+
+ expect(application.ready?).to be false
+ end
+
+ it 'returns false when scheduled' do
+ application = build(:clusters_applications_prometheus, :scheduled, cluster: cluster)
+
+ expect(application.ready?).to be false
+ end
+
+ it 'returns false when installing' do
+ application = build(:clusters_applications_prometheus, :installing, cluster: cluster)
+
+ expect(application.ready?).to be false
+ end
+
+ it 'returns false when errored' do
+ application = build(:clusters_applications_prometheus, :errored, cluster: cluster)
+
+ expect(application.ready?).to be false
+ end
+ end
+
describe '#prometheus_client' do
context 'cluster is nil' do
it 'returns nil' do
@@ -102,15 +143,17 @@ describe Clusters::Applications::Prometheus do
let(:kubeclient) { double('kubernetes client') }
let(:prometheus) { create(:clusters_applications_prometheus) }
- subject { prometheus.install_command }
-
- it { is_expected.to be_an_instance_of(Gitlab::Kubernetes::Helm::InstallCommand) }
+ it 'returns an instance of Gitlab::Kubernetes::Helm::InstallCommand' do
+ expect(prometheus.install_command).to be_an_instance_of(Gitlab::Kubernetes::Helm::InstallCommand)
+ end
it 'should be initialized with 3 arguments' do
- expect(subject.name).to eq('prometheus')
- expect(subject.chart).to eq('stable/prometheus')
- expect(subject.version).to eq('6.7.3')
- expect(subject.values).to eq(prometheus.values)
+ command = prometheus.install_command
+
+ expect(command.name).to eq('prometheus')
+ expect(command.chart).to eq('stable/prometheus')
+ expect(command.version).to eq('6.7.3')
+ expect(command.values).to eq(prometheus.values)
end
end