allow for numbers of missing and failed files to differ in recovery test
authorPhilipp Gesang <philipp.gesang@intra2net.com>
Mon, 14 Aug 2017 10:09:28 +0000 (12:09 +0200)
committerThomas Jarosch <thomas.jarosch@intra2net.com>
Mon, 2 Apr 2018 11:34:09 +0000 (13:34 +0200)
testing/test_recover.py

index 8378afc..e2a6292 100644 (file)
@@ -147,6 +147,7 @@ class RecoverTest (BaseTest):
     MISMATCHES  = 0     # files that were restored but corrupted
     CORRUPT     = corrupt_payload_start
     VOLUMES     = 1
+    MISSING     = None  # normally the number of failures
 
 
     def setUp(self):
@@ -284,7 +285,14 @@ class RecoverTest (BaseTest):
                     mismatch.append (key)
             else:
                 missing.append (key)
-        assert len (missing)  == self.FAILURES
+
+        # usually, an object whose extraction fails will not be found on
+        # disk afterwards so the number of failures equals that of missing
+        # files. however, some modes will create partial files for objects
+        # spanning multiple volumes that contain the parts whose checksums
+        # were valid.
+        assert len (missing)  == (self.MISSING if self.MISSING is not None
+                                               else self.FAILURES)
         assert len (mismatch) == self.MISMATCHES
 
         shutil.rmtree (self.dst_path)
@@ -452,6 +460,7 @@ class RecoverCorruptTrailingDataGZMultiTest (RecoverCorruptTrailingDataGZTestBas
     # the object is recreated from the first header of the second volume,
     # containing only the remainder of the data.
     MISMATCHES  = 1
+    MISSING     = 0
 
 
 class RecoverCorruptTrailingDataGZAESTestBase (RecoverTest):