diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-06-18 11:18:50 +0000 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-06-18 11:18:50 +0000 |
commit | 8c7f4e9d5f36cff46365a7f8c4b9c21578c1e781 (patch) | |
tree | a77e7fe7a93de11213032ed4ab1f33a3db51b738 /spec/services/prometheus/create_default_alerts_service_spec.rb | |
parent | 00b35af3db1abfe813a778f643dad221aad51fca (diff) | |
download | gitlab-ce-8c7f4e9d5f36cff46365a7f8c4b9c21578c1e781.tar.gz |
Add latest changes from gitlab-org/gitlab@13-1-stable-ee
Diffstat (limited to 'spec/services/prometheus/create_default_alerts_service_spec.rb')
-rw-r--r-- | spec/services/prometheus/create_default_alerts_service_spec.rb | 19 |
1 files changed, 18 insertions, 1 deletions
diff --git a/spec/services/prometheus/create_default_alerts_service_spec.rb b/spec/services/prometheus/create_default_alerts_service_spec.rb index 3382844c99a..a28c38491de 100644 --- a/spec/services/prometheus/create_default_alerts_service_spec.rb +++ b/spec/services/prometheus/create_default_alerts_service_spec.rb @@ -3,7 +3,7 @@ require 'spec_helper' describe Prometheus::CreateDefaultAlertsService do - let_it_be(:project) { create(:project) } + let_it_be(:project) { create(:project, :repository) } let(:instance) { described_class.new(project: project) } let(:expected_alerts) { described_class::DEFAULT_ALERTS } @@ -45,6 +45,23 @@ describe Prometheus::CreateDefaultAlertsService do .by(expected_alerts.size) end + it 'does not schedule an update to prometheus' do + expect(::Clusters::Applications::ScheduleUpdateService).not_to receive(:new) + execute + end + + context 'cluster with prometheus exists' do + let!(:cluster) { create(:cluster, :with_installed_prometheus, :provided_by_user, projects: [project]) } + + it 'schedules an update to prometheus' do + expect_next_instance_of(::Clusters::Applications::ScheduleUpdateService) do |instance| + expect(instance).to receive(:execute) + end + + execute + end + end + context 'multiple environments' do let!(:production) { create(:environment, project: project, name: 'production') } |