diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2022-06-20 14:10:13 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2022-06-20 14:10:13 +0300 |
commit | 0ea3fcec397b69815975647f5e2aa5fe944a8486 (patch) | |
tree | 7979381b89d26011bcf9bdc989a40fcc2f1ed4ff /spec/models/clusters/integrations | |
parent | 72123183a20411a36d607d70b12d57c484394c8e (diff) |
Add latest changes from gitlab-org/gitlab@15-1-stable-eev15.1.0-rc42
Diffstat (limited to 'spec/models/clusters/integrations')
-rw-r--r-- | spec/models/clusters/integrations/prometheus_spec.rb | 38 |
1 files changed, 32 insertions, 6 deletions
diff --git a/spec/models/clusters/integrations/prometheus_spec.rb b/spec/models/clusters/integrations/prometheus_spec.rb index e529c751889..d1e40fffee0 100644 --- a/spec/models/clusters/integrations/prometheus_spec.rb +++ b/spec/models/clusters/integrations/prometheus_spec.rb @@ -21,11 +21,24 @@ RSpec.describe Clusters::Integrations::Prometheus do let(:cluster) { create(:cluster, :with_installed_helm) } it 'deactivates prometheus_integration' do - expect(Clusters::Applications::DeactivateServiceWorker) + expect(Clusters::Applications::DeactivateIntegrationWorker) .to receive(:perform_async).with(cluster.id, 'prometheus') integration.destroy! end + + context 'when the FF :rename_integrations_workers is disabled' do + before do + stub_feature_flags(rename_integrations_workers: false) + end + + it 'uses the old worker' do + expect(Clusters::Applications::DeactivateServiceWorker) + .to receive(:perform_async).with(cluster.id, 'prometheus') + + integration.destroy! + end + end end describe 'after_save' do @@ -38,10 +51,10 @@ RSpec.describe Clusters::Integrations::Prometheus do it 'does not touch project integrations' do integration # ensure integration exists before we set the expectations - expect(Clusters::Applications::DeactivateServiceWorker) + expect(Clusters::Applications::DeactivateIntegrationWorker) .not_to receive(:perform_async) - expect(Clusters::Applications::ActivateServiceWorker) + expect(Clusters::Applications::ActivateIntegrationWorker) .not_to receive(:perform_async) integration.update!(enabled: enabled) @@ -51,19 +64,32 @@ RSpec.describe Clusters::Integrations::Prometheus do context 'when enabling' do let(:enabled) { false } - it 'deactivates prometheus_integration' do - expect(Clusters::Applications::ActivateServiceWorker) + it 'activates prometheus_integration' do + expect(Clusters::Applications::ActivateIntegrationWorker) .to receive(:perform_async).with(cluster.id, 'prometheus') integration.update!(enabled: true) end + + context 'when the FF :rename_integrations_workers is disabled' do + before do + stub_feature_flags(rename_integrations_workers: false) + end + + it 'uses the old worker' do + expect(Clusters::Applications::ActivateServiceWorker) + .to receive(:perform_async).with(cluster.id, 'prometheus') + + integration.update!(enabled: true) + end + end end context 'when disabling' do let(:enabled) { true } it 'activates prometheus_integration' do - expect(Clusters::Applications::DeactivateServiceWorker) + expect(Clusters::Applications::DeactivateIntegrationWorker) .to receive(:perform_async).with(cluster.id, 'prometheus') integration.update!(enabled: false) |