2020-09-11 03:37:42 +08:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
|
|
|
RSpec.describe Jobs::EnsureS3UploadsExistence do
|
2023-06-21 22:00:19 +08:00
|
|
|
subject(:job) { described_class.new }
|
|
|
|
|
2024-06-10 13:16:00 +08:00
|
|
|
context "when `s3_inventory_bucket` has been set" do
|
|
|
|
before { SiteSetting.s3_inventory_bucket = "some-bucket-name" }
|
2020-09-11 03:37:42 +08:00
|
|
|
|
|
|
|
it "works" do
|
|
|
|
S3Inventory.any_instance.expects(:backfill_etags_and_list_missing).once
|
2023-06-21 22:00:19 +08:00
|
|
|
job.execute({})
|
2020-09-11 03:37:42 +08:00
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2024-06-10 13:16:00 +08:00
|
|
|
context "when `s3_inventory_bucket` has not been set" do
|
|
|
|
before { SiteSetting.s3_inventory_bucket = nil }
|
2020-09-11 03:37:42 +08:00
|
|
|
|
|
|
|
it "doesn't execute" do
|
|
|
|
S3Inventory.any_instance.expects(:backfill_etags_and_list_missing).never
|
2023-06-21 22:00:19 +08:00
|
|
|
job.execute({})
|
2020-09-11 03:37:42 +08:00
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|