FIX: Restoring could fail due to missing path
This commit is contained in:
parent
4f5ea4fbde
commit
0b05302cfe
|
@ -6,7 +6,7 @@ module BackupRestore
|
||||||
|
|
||||||
delegate :log, to: :@logger, private: true
|
delegate :log, to: :@logger, private: true
|
||||||
|
|
||||||
def initialize(logger, filename, current_db, root_tmp_directory = Rails.root, location = nil)
|
def initialize(logger, filename, current_db, root_tmp_directory: Rails.root, location: nil)
|
||||||
@logger = logger
|
@logger = logger
|
||||||
@filename = filename
|
@filename = filename
|
||||||
@current_db = current_db
|
@current_db = current_db
|
||||||
|
|
|
@ -28,7 +28,7 @@ module BackupRestore
|
||||||
end
|
end
|
||||||
|
|
||||||
def create_backup_file_handler(filename, current_db, location)
|
def create_backup_file_handler(filename, current_db, location)
|
||||||
BackupFileHandler.new(logger, filename, current_db, location)
|
BackupFileHandler.new(logger, filename, current_db, location: location)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -19,7 +19,11 @@ describe BackupRestore::BackupFileHandler do
|
||||||
|
|
||||||
Dir.mktmpdir do |root_directory|
|
Dir.mktmpdir do |root_directory|
|
||||||
current_db = RailsMultisite::ConnectionManagement.current_db
|
current_db = RailsMultisite::ConnectionManagement.current_db
|
||||||
file_handler = BackupRestore::BackupFileHandler.new(logger, backup_filename, current_db, root_directory, location)
|
file_handler = BackupRestore::BackupFileHandler.new(
|
||||||
|
logger, backup_filename, current_db,
|
||||||
|
root_tmp_directory: root_directory,
|
||||||
|
location: location
|
||||||
|
)
|
||||||
tmp_directory, db_dump_path = file_handler.decompress
|
tmp_directory, db_dump_path = file_handler.decompress
|
||||||
|
|
||||||
expected_tmp_path = File.join(root_directory, "tmp/restores", current_db, "2019-12-24-143148")
|
expected_tmp_path = File.join(root_directory, "tmp/restores", current_db, "2019-12-24-143148")
|
||||||
|
|
Loading…
Reference in New Issue