From 14e2e92d7de71ce50510b356577aced3f99f3ffe Mon Sep 17 00:00:00 2001 From: Daniel Garcia Moreno Date: Tue, 1 Jul 2014 20:16:52 +0200 Subject: [PATCH] Added test to test multivolume corruption at restore --- testing/test_deltatar.py | 44 +++++++++++++++++++++++++++++++++++++++++++- 1 files changed, 43 insertions(+), 1 deletions(-) diff --git a/testing/test_deltatar.py b/testing/test_deltatar.py index 1f97eee..20c6397 100644 --- a/testing/test_deltatar.py +++ b/testing/test_deltatar.py @@ -173,6 +173,48 @@ class DeltaTarTest(BaseTest): if value: assert value == self.md5sum(key) + def test_restore_multivol_split(self): + ''' + Creates a full backup without any filtering with multiple volumes + with big files bigger than the max volume size and + restore it. + ''' + deltatar = DeltaTar(mode=self.MODE, password=self.PASSWORD, + logger=self.consoleLogger) + + + self.hash = dict() + os.makedirs('source_dir2') + self.hash["source_dir2/big"] = self.create_file("source_dir2/big", 4*1024*1024) + self.hash["source_dir2/huge"] = self.create_file("source_dir2/huge", 4*1024*1024) + self.hash["source_dir2/huge2"] = self.create_file("source_dir2/huge2", 4*1024*1024) + + # create first backup + deltatar.create_full_backup( + source_path="source_dir2", + backup_path="backup_dir", + max_volume_size=2) + + assert os.path.exists("backup_dir") + assert os.path.exists(os.path.join("backup_dir", + deltatar.volume_name_func("backup_dir", True, 0))) + assert os.path.exists(os.path.join("backup_dir", + deltatar.volume_name_func("backup_dir", True, 1))) + + shutil.rmtree("source_dir2") + + index_filename = deltatar.index_name_func(True) + index_path = os.path.join("backup_dir", index_filename) + + deltatar.restore_backup(target_path="source_dir2", + backup_indexes_paths=[index_path]) + + for key, value in self.hash.items(): + assert os.path.exists(key) + if value: + assert value == self.md5sum(key) + + def test_full_backup_index_extra_data(self): ''' Tests that the index file for a full backup can store extra_data and @@ -1379,4 +1421,4 @@ class DeltaTarAes256ConcatTest(DeltaTarTest): Same as DeltaTar but with specific aes128 concat stream mode ''' MODE = '#aes256' - PASSWORD = 'some magic key' \ No newline at end of file + PASSWORD = 'some magic key' -- 1.7.1