mirror of
https://github.com/discourse/discourse.git
synced 2025-01-19 02:12:46 +08:00
df16ab0758
This commit updates `S3Inventory#files` to ignore S3 inventory files which have a `last_modified` timestamp which are not at least 2 days older than `BackupMetadata.last_restore_date` timestamp. This check was previously only in `Jobs::EnsureS3UploadsExistence` but `S3Inventory` can also be used via Rake tasks so this protection needs to be in `S3Inventory` and not in the scheduled job.
27 lines
623 B
Ruby
27 lines
623 B
Ruby
# frozen_string_literal: true
|
|
|
|
RSpec.describe Jobs::EnsureS3UploadsExistence do
|
|
subject(:job) { described_class.new }
|
|
|
|
context "with S3 inventory enabled" do
|
|
before do
|
|
setup_s3
|
|
SiteSetting.enable_s3_inventory = true
|
|
end
|
|
|
|
it "works" do
|
|
S3Inventory.any_instance.expects(:backfill_etags_and_list_missing).once
|
|
job.execute({})
|
|
end
|
|
end
|
|
|
|
context "with S3 inventory disabled" do
|
|
before { SiteSetting.enable_s3_inventory = false }
|
|
|
|
it "doesn't execute" do
|
|
S3Inventory.any_instance.expects(:backfill_etags_and_list_missing).never
|
|
job.execute({})
|
|
end
|
|
end
|
|
end
|