Update rake task to backfill etags from s3 inventory

This commit is contained in:
Vinoth Kannan
2019-02-14 05:18:06 +05:30
parent b8d2549922
commit 7b5931013a
4 changed files with 26 additions and 8 deletions

View File

@ -74,4 +74,15 @@ describe "S3Inventory" do
expect(output).to eq("Downloading inventory file 'Key' to tmp directory...\n#{upload.url}\n1 of 4 uploads are missing\n")
end
it "should backfill etags to uploads table correctly" do
Fabricate(:upload, url: "//bucket.amazonaws.com/original/0184537a4f419224404d013414e913a4f56018f2.jpg", created_at: 2.days.ago)
inventory.expects(:decompress_inventory_files)
inventory.expects(:files).returns([{ key: "Key", filename: "#{csv_filename}.gz" }]).at_least(1)
output = capture_stdout do
expect { inventory.list_missing(backfill_etags: true) }.to change { Upload.where(etag: nil).count }.by(-1)
end
end
end