diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2019-10-22 03:06:05 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2019-10-22 03:06:05 +0300 |
commit | 8dfb94309c3e84937189f73a4149d654e20332e9 (patch) | |
tree | 1543a7b74b2e5c683a39fd93b09afc578f758c2b /spec/models/environment_spec.rb | |
parent | 170f0bdcdef9c9b226abfe0a50d6687c65e8d613 (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/models/environment_spec.rb')
-rw-r--r-- | spec/models/environment_spec.rb | 45 |
1 files changed, 45 insertions, 0 deletions
diff --git a/spec/models/environment_spec.rb b/spec/models/environment_spec.rb index 786f3b832c4..85a8f35393b 100644 --- a/spec/models/environment_spec.rb +++ b/spec/models/environment_spec.rb @@ -727,6 +727,51 @@ describe Environment, :use_clean_rails_memory_store_caching do end end + describe '#prometheus_status' do + context 'when a cluster is present' do + context 'when a deployment platform is present' do + let(:cluster) { create(:cluster, :provided_by_user, :project) } + let(:environment) { create(:environment, project: cluster.project) } + + subject { environment.prometheus_status } + + context 'when the prometheus application status is :updating' do + let!(:prometheus) { create(:clusters_applications_prometheus, :updating, cluster: cluster) } + + it { is_expected.to eq(:updating) } + end + + context 'when the prometheus application state is :updated' do + let!(:prometheus) { create(:clusters_applications_prometheus, :updated, cluster: cluster) } + + it { is_expected.to eq(:updated) } + end + + context 'when the prometheus application is not installed' do + it { is_expected.to be_nil } + end + end + + context 'when a deployment platform is not present' do + let(:cluster) { create(:cluster, :project) } + let(:environment) { create(:environment, project: cluster.project) } + + subject { environment.prometheus_status } + + it { is_expected.to be_nil } + end + end + + context 'when a cluster is not present' do + let(:project) { create(:project, :stubbed_repository) } + let(:environment) { create(:environment, project: project) } + + subject { environment.prometheus_status } + + it { is_expected.to be_nil } + end + end + describe '#additional_metrics' do let(:project) { create(:prometheus_project) } let(:metric_params) { [] } |