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-11-28 12:07:59 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2023-11-28 12:07:59 +0300
commit94f0f0e4b9fa3f49bf6145100b206c36c0c4eef6 (patch)
tree312acc67554de704dfe734619e20a8453b8c3ab2
parentdeacfcd2fcccfbcf76fb07b26a2710579fd5e17a (diff)
Add latest changes from gitlab-org/gitlab@16-6-stable-ee
-rw-r--r--app/workers/pages/deactivated_deployments_delete_cron_worker.rb1
-rw-r--r--spec/workers/pages/deactivated_deployments_delete_cron_worker_spec.rb11
2 files changed, 8 insertions, 4 deletions
diff --git a/app/workers/pages/deactivated_deployments_delete_cron_worker.rb b/app/workers/pages/deactivated_deployments_delete_cron_worker.rb
index 7ee6327cea7..75905759761 100644
--- a/app/workers/pages/deactivated_deployments_delete_cron_worker.rb
+++ b/app/workers/pages/deactivated_deployments_delete_cron_worker.rb
@@ -12,6 +12,7 @@ module Pages
def perform
PagesDeployment.deactivated.each_batch do |deployments| # rubocop: disable Style/SymbolProc
+ deployments.each { |deployment| deployment.file.remove! }
deployments.delete_all
end
end
diff --git a/spec/workers/pages/deactivated_deployments_delete_cron_worker_spec.rb b/spec/workers/pages/deactivated_deployments_delete_cron_worker_spec.rb
index b4ee1d6b439..e2687e7cd9a 100644
--- a/spec/workers/pages/deactivated_deployments_delete_cron_worker_spec.rb
+++ b/spec/workers/pages/deactivated_deployments_delete_cron_worker_spec.rb
@@ -5,11 +5,14 @@ require 'spec_helper'
RSpec.describe Pages::DeactivatedDeploymentsDeleteCronWorker, feature_category: :pages do
subject(:worker) { described_class.new }
- it 'deletes all deactivated pages deployments' do
- create(:pages_deployment) # active
- create(:pages_deployment, deleted_at: 3.minutes.ago) # deactivated
- create(:pages_deployment, path_prefix: 'other', deleted_at: 3.minutes.ago) # deactivated
+ let!(:pages_deployment) { create(:pages_deployment) }
+ let!(:deactivated_pages_deployment) { create(:pages_deployment, deleted_at: 3.minutes.ago) }
+ let!(:alt_deactivated_pages_deployment) { create(:pages_deployment, path_prefix: 'other', deleted_at: 3.minutes.ago) }
+
+ it 'deletes all deactivated pages deployments and their files from the filesystem' do
+ file_paths = [deactivated_pages_deployment.file.path, alt_deactivated_pages_deployment.file.path]
expect { worker.perform }.to change { PagesDeployment.count }.by(-2)
+ .and change { (file_paths.any? { |path| File.exist?(path) }) }.from(true).to(false)
end
end