parent
83e1315e42
commit
d9c0dc8687
|
@ -7,7 +7,7 @@ module Jobs
|
||||||
|
|
||||||
return if !base_url.match?(/s3\.dualstack/)
|
return if !base_url.match?(/s3\.dualstack/)
|
||||||
|
|
||||||
old = base_url.sub('.dualstack', '')
|
old = base_url.sub('s3.dualstack.', 's3-')
|
||||||
old_like = %"#{old}%"
|
old_like = %"#{old}%"
|
||||||
|
|
||||||
DB.exec(<<~SQL, from: old, to: base_url, old_like: old_like)
|
DB.exec(<<~SQL, from: old, to: base_url, old_like: old_like)
|
||||||
|
|
|
@ -15,21 +15,21 @@ describe Jobs::CorrectMissingDualstackUrls do
|
||||||
expect(Discourse.store.absolute_base_url).to eq('//s3-upload-bucket.s3.dualstack.us-east-1.amazonaws.com')
|
expect(Discourse.store.absolute_base_url).to eq('//s3-upload-bucket.s3.dualstack.us-east-1.amazonaws.com')
|
||||||
|
|
||||||
current_upload = Upload.create!(
|
current_upload = Upload.create!(
|
||||||
url: '//s3-upload-bucket.s3.us-east-1.amazonaws.com/somewhere/a.png',
|
url: '//s3-upload-bucket.s3-us-east-1.amazonaws.com/somewhere/a.png',
|
||||||
original_filename: 'a.png',
|
original_filename: 'a.png',
|
||||||
filesize: 100,
|
filesize: 100,
|
||||||
user_id: -1,
|
user_id: -1,
|
||||||
)
|
)
|
||||||
|
|
||||||
bad_upload = Upload.create!(
|
bad_upload = Upload.create!(
|
||||||
url: '//s3-upload-bucket.s3.us-west-1.amazonaws.com/somewhere/a.png',
|
url: '//s3-upload-bucket.s3-us-west-1.amazonaws.com/somewhere/a.png',
|
||||||
original_filename: 'a.png',
|
original_filename: 'a.png',
|
||||||
filesize: 100,
|
filesize: 100,
|
||||||
user_id: -1,
|
user_id: -1,
|
||||||
)
|
)
|
||||||
|
|
||||||
current_optimized = OptimizedImage.create!(
|
current_optimized = OptimizedImage.create!(
|
||||||
url: '//s3-upload-bucket.s3.us-east-1.amazonaws.com/somewhere/a.png',
|
url: '//s3-upload-bucket.s3-us-east-1.amazonaws.com/somewhere/a.png',
|
||||||
filesize: 100,
|
filesize: 100,
|
||||||
upload_id: current_upload.id,
|
upload_id: current_upload.id,
|
||||||
width: 100,
|
width: 100,
|
||||||
|
@ -39,7 +39,7 @@ describe Jobs::CorrectMissingDualstackUrls do
|
||||||
)
|
)
|
||||||
|
|
||||||
bad_optimized = OptimizedImage.create!(
|
bad_optimized = OptimizedImage.create!(
|
||||||
url: '//s3-upload-bucket.s3.us-west-1.amazonaws.com/somewhere/a.png',
|
url: '//s3-upload-bucket.s3-us-west-1.amazonaws.com/somewhere/a.png',
|
||||||
filesize: 100,
|
filesize: 100,
|
||||||
upload_id: current_upload.id,
|
upload_id: current_upload.id,
|
||||||
width: 110,
|
width: 110,
|
||||||
|
@ -51,13 +51,13 @@ describe Jobs::CorrectMissingDualstackUrls do
|
||||||
Jobs::CorrectMissingDualstackUrls.new.execute_onceoff(nil)
|
Jobs::CorrectMissingDualstackUrls.new.execute_onceoff(nil)
|
||||||
|
|
||||||
bad_upload.reload
|
bad_upload.reload
|
||||||
expect(bad_upload.url).to eq('//s3-upload-bucket.s3.us-west-1.amazonaws.com/somewhere/a.png')
|
expect(bad_upload.url).to eq('//s3-upload-bucket.s3-us-west-1.amazonaws.com/somewhere/a.png')
|
||||||
|
|
||||||
current_upload.reload
|
current_upload.reload
|
||||||
expect(current_upload.url).to eq('//s3-upload-bucket.s3.dualstack.us-east-1.amazonaws.com/somewhere/a.png')
|
expect(current_upload.url).to eq('//s3-upload-bucket.s3.dualstack.us-east-1.amazonaws.com/somewhere/a.png')
|
||||||
|
|
||||||
bad_optimized.reload
|
bad_optimized.reload
|
||||||
expect(bad_optimized.url).to eq('//s3-upload-bucket.s3.us-west-1.amazonaws.com/somewhere/a.png')
|
expect(bad_optimized.url).to eq('//s3-upload-bucket.s3-us-west-1.amazonaws.com/somewhere/a.png')
|
||||||
|
|
||||||
current_optimized.reload
|
current_optimized.reload
|
||||||
expect(current_optimized.url).to eq('//s3-upload-bucket.s3.dualstack.us-east-1.amazonaws.com/somewhere/a.png')
|
expect(current_optimized.url).to eq('//s3-upload-bucket.s3.dualstack.us-east-1.amazonaws.com/somewhere/a.png')
|
||||||
|
|
Loading…
Reference in New Issue