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:
authorGitLab Bot <gitlab-bot@gitlab.com>2023-09-20 14:18:08 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2023-09-20 14:18:08 +0300
commit5afcbe03ead9ada87621888a31a62652b10a7e4f (patch)
tree9918b67a0d0f0bafa6542e839a8be37adf73102d /spec/models/integrations/prometheus_spec.rb
parentc97c0201564848c1f53226fe19d71fdcc472f7d0 (diff)
Add latest changes from gitlab-org/gitlab@16-4-stable-eev16.4.0-rc42
Diffstat (limited to 'spec/models/integrations/prometheus_spec.rb')
-rw-r--r--spec/models/integrations/prometheus_spec.rb28
1 files changed, 28 insertions, 0 deletions
diff --git a/spec/models/integrations/prometheus_spec.rb b/spec/models/integrations/prometheus_spec.rb
index da43d851b31..4a998efe665 100644
--- a/spec/models/integrations/prometheus_spec.rb
+++ b/spec/models/integrations/prometheus_spec.rb
@@ -422,6 +422,34 @@ RSpec.describe Integrations::Prometheus, :use_clean_rails_memory_store_caching,
end
end
+ describe '#sync_http_integration after_save callback' do
+ context 'with corresponding HTTP integration' do
+ let_it_be_with_reload(:http_integration) { create(:alert_management_prometheus_integration, :legacy, project: project) }
+
+ it 'syncs the attribute' do
+ expect { integration.update!(manual_configuration: false) }
+ .to change { http_integration.reload.active }
+ .from(true).to(false)
+ end
+
+ context 'when changing a different attribute' do
+ it 'does not sync the attribute or execute extra queries' do
+ expect { integration.update!(api_url: 'https://any.url') }
+ .to issue_fewer_queries_than { integration.update!(manual_configuration: false) }
+ end
+ end
+ end
+
+ context 'without corresponding HTTP integration' do
+ let_it_be(:other_http_integration) { create(:alert_management_prometheus_integration, project: project) }
+
+ it 'does not sync the attribute or execute extra queries' do
+ expect { integration.update!(manual_configuration: false) }
+ .not_to change { other_http_integration.reload.active }
+ end
+ end
+ end
+
describe '#editable?' do
it 'is editable' do
expect(integration.editable?).to be(true)