extend fs access test to compress and crypto variant
authorPhilipp Gesang <philipp.gesang@intra2net.com>
Thu, 5 Jul 2018 09:16:28 +0000 (11:16 +0200)
committerThomas Jarosch <thomas.jarosch@intra2net.com>
Sat, 1 Feb 2020 14:14:06 +0000 (15:14 +0100)
runtests.py
testing/test_deltatar.py

index 7da7b7c..eb2c7a4 100755 (executable)
@@ -87,7 +87,9 @@ from testing.test_deltatar import (DeltaTarTest, DeltaTar2Test,
     DeltaTarStreamTest, DeltaTarGzipTest, DeltaTarGzipStreamTest,
     DeltaTarGzipConcatTest, DeltaTarGzipAes128ConcatTest,
     DeltaTarAes128ConcatTest,
-    DeltaTarFilesystemHandlingTest
+    DeltaTarFSGzipTest, DeltaTarFSGzipConcatTest,
+    DeltaTarFSAes128ConcatTest, DeltaTarFSGzipAes128ConcatTest
+
     )
 from testing.test_compression_level import suite
 
index 9a0b7d6..adfcfbb 100644 (file)
@@ -1532,12 +1532,18 @@ class DeltaTarTest(BaseTest):
         # then apply diff backup in target_dir
         index_filename = deltatar.index_name_func(is_full=False)
         index_path = os.path.join("backup_dir2", index_filename)
-        deltatar.restore_backup("target_dir",
-            backup_indexes_paths=[index_path, prev_index_path])
 
-        # then compare the two directories source_dir and target_dir and check
-        # they are the same
-        self.check_equal_dirs('source_dir', 'target_dir', deltatar)
+        try:
+            deltatar.restore_backup("target_dir",
+                backup_indexes_paths=[index_path, prev_index_path])
+
+            # then compare the two directories source_dir and target_dir and check
+            # they are the same
+            self.check_equal_dirs('source_dir', 'target_dir', deltatar)
+        except FileNotFoundError as exn:
+            if self.FSTEST is None:
+                # fs traversal may fail here
+                raise exn
 
     def test_restore_from_index_diff_backup3(self):
         '''
@@ -1661,6 +1667,8 @@ class DeltaTarTest(BaseTest):
         # first restore initial backup in target_dir
         tar_filename = deltatar.volume_name_func('backup_dir', True, 0)
         tar_path = os.path.join("backup_dir", tar_filename)
+        if self.FSTEST is not None:
+            return  # the below will fail in stat checks, but that is expected
         deltatar.restore_backup("target_dir", backup_tar_path=tar_path)
 
         # and check that target_dir equals to source_dir (which is the same as
@@ -1960,9 +1968,25 @@ class DeltaTarAes128ConcatTest(DeltaTarTest):
     ENCRYPTION = ('some magic key', 1)
 
 
-class DeltaTarFilesystemHandlingTest(DeltaTarGzipTest):
+class DeltaTarFilesystemHandlingTestBase(BaseTest):
     '''
     Mess with filesystem APIs.
     '''
     FSTEST = fsapi_access_true
 
+class DeltaTarFSGzipTest(DeltaTarFilesystemHandlingTestBase,
+                         DeltaTarGzipTest):
+    pass
+
+class DeltaTarFSGzipConcatTest(DeltaTarFilesystemHandlingTestBase,
+                               DeltaTarGzipConcatTest):
+    pass
+
+class DeltaTarFSAes128ConcatTest(DeltaTarFilesystemHandlingTestBase,
+                                 DeltaTarAes128ConcatTest):
+    pass
+
+class DeltaTarFSGzipAes128ConcatTest(DeltaTarFilesystemHandlingTestBase,
+                                     DeltaTarGzipAes128ConcatTest):
+    pass
+