diff options
author | Thong Kuah <tkuah@gitlab.com> | 2019-04-15 16:02:52 +1200 |
---|---|---|
committer | Stan Hu <stanhu@gmail.com> | 2019-04-29 22:55:12 -0700 |
commit | 024ddcab17517befafc0c5163d66cdcaae1b69e6 (patch) | |
tree | 49745142971ae8e930a358ca2eb3318021ee440f /spec/models/clusters/applications | |
parent | eae0fc2bcd6f7e2e183a922321ace3380c329adc (diff) | |
download | gitlab-ce-024ddcab17517befafc0c5163d66cdcaae1b69e6.tar.gz |
Deactivate any prometheus_service upon destroy
Basically does the reverse of after_transition to :installed.
Diffstat (limited to 'spec/models/clusters/applications')
-rw-r--r-- | spec/models/clusters/applications/prometheus_spec.rb | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/spec/models/clusters/applications/prometheus_spec.rb b/spec/models/clusters/applications/prometheus_spec.rb index 4022e01195d..76d2c4a9d1c 100644 --- a/spec/models/clusters/applications/prometheus_spec.rb +++ b/spec/models/clusters/applications/prometheus_spec.rb @@ -11,6 +11,23 @@ describe Clusters::Applications::Prometheus do include_examples 'cluster application helm specs', :clusters_applications_prometheus include_examples 'cluster application initial status specs' + describe 'after_destroy' do + let(:project) { create(:project) } + let(:cluster) { create(:cluster, :with_installed_helm, projects: [project]) } + let!(:application) { create(:clusters_applications_prometheus, :installed, cluster: cluster) } + let!(:prometheus_service) { project.create_prometheus_service(active: true) } + + it 'deactivates prometheus_service after destroy' do + expect do + application.destroy + + prometheus_service.reload + end.to change(prometheus_service, :active) + + expect(prometheus_service).not_to be_active + end + end + describe 'transition to installed' do let(:project) { create(:project) } let(:cluster) { create(:cluster, :with_installed_helm, projects: [project]) } |