mirror of
https://github.com/discourse/discourse.git
synced 2025-02-25 18:55:32 -06:00
new S3 backup layout (#9830)
* DEV: new S3 backup layout Currently, with $S3_BACKUP_BUCKET of "bucket/backups", multisite backups end up in "bucket/backups/backups/dbname/" and single-site will be in "bucket/backups/". Both _should_ be in "bucket/backups/dbname/" - remove MULTISITE_PREFIX, - always include dbname, - method to move to the new prefix - job to call the method * SPEC: add tests for `VacateLegacyPrefixBackups` onceoff job. Co-authored-by: Vinoth Kannan <vinothkannan@vinkas.com>
This commit is contained in:
@@ -13,7 +13,7 @@ describe BackupRestore::S3BackupStore do
|
||||
@objects = []
|
||||
|
||||
def expected_prefix
|
||||
Rails.configuration.multisite ? "backups/#{RailsMultisite::ConnectionManagement.current_db}/" : ""
|
||||
"#{RailsMultisite::ConnectionManagement.current_db}/"
|
||||
end
|
||||
|
||||
def check_context(context)
|
||||
@@ -102,26 +102,21 @@ describe BackupRestore::S3BackupStore do
|
||||
|
||||
def objects_with_prefix(context)
|
||||
prefix = context.params[:prefix]
|
||||
|
||||
if prefix.blank?
|
||||
@objects.reject { |obj| obj[:key].include?("backups/") }
|
||||
else
|
||||
@objects.select { |obj| obj[:key].start_with?(prefix) }
|
||||
end
|
||||
@objects.select { |obj| obj[:key].start_with?(prefix) }
|
||||
end
|
||||
|
||||
def create_backups
|
||||
@objects.clear
|
||||
|
||||
@objects << { key: "b.tar.gz", size: 17, last_modified: Time.parse("2018-09-13T15:10:00Z") }
|
||||
@objects << { key: "a.tgz", size: 29, last_modified: Time.parse("2018-02-11T09:27:00Z") }
|
||||
@objects << { key: "r.sql.gz", size: 11, last_modified: Time.parse("2017-12-20T03:48:00Z") }
|
||||
@objects << { key: "no-backup.txt", size: 12, last_modified: Time.parse("2018-09-05T14:27:00Z") }
|
||||
@objects << { key: "subfolder/c.tar.gz", size: 23, last_modified: Time.parse("2019-01-24T18:44:00Z") }
|
||||
@objects << { key: "default/b.tar.gz", size: 17, last_modified: Time.parse("2018-09-13T15:10:00Z") }
|
||||
@objects << { key: "default/a.tgz", size: 29, last_modified: Time.parse("2018-02-11T09:27:00Z") }
|
||||
@objects << { key: "default/r.sql.gz", size: 11, last_modified: Time.parse("2017-12-20T03:48:00Z") }
|
||||
@objects << { key: "default/no-backup.txt", size: 12, last_modified: Time.parse("2018-09-05T14:27:00Z") }
|
||||
@objects << { key: "default/subfolder/c.tar.gz", size: 23, last_modified: Time.parse("2019-01-24T18:44:00Z") }
|
||||
|
||||
@objects << { key: "backups/second/multi-2.tar.gz", size: 19, last_modified: Time.parse("2018-11-27T03:16:54Z") }
|
||||
@objects << { key: "backups/second/multi-1.tar.gz", size: 22, last_modified: Time.parse("2018-11-26T03:17:09Z") }
|
||||
@objects << { key: "backups/second/subfolder/multi-3.tar.gz", size: 23, last_modified: Time.parse("2019-01-24T18:44:00Z") }
|
||||
@objects << { key: "second/multi-2.tar.gz", size: 19, last_modified: Time.parse("2018-11-27T03:16:54Z") }
|
||||
@objects << { key: "second/multi-1.tar.gz", size: 22, last_modified: Time.parse("2018-11-26T03:17:09Z") }
|
||||
@objects << { key: "second/subfolder/multi-3.tar.gz", size: 23, last_modified: Time.parse("2019-01-24T18:44:00Z") }
|
||||
end
|
||||
|
||||
def remove_backups
|
||||
|
||||
Reference in New Issue
Block a user