]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
qa: fix loop variable reference
authorPatrick Donnelly <pdonnell@redhat.com>
Tue, 8 Jan 2019 23:51:53 +0000 (15:51 -0800)
committerPrashant D <pdhange@redhat.com>
Sun, 20 Jan 2019 23:55:51 +0000 (18:55 -0500)
Otherwise the Mutation for Truncate is done on obj_id of the last iteration of the previous loop.

Fixes: http://tracker.ceph.com/issues/37836
Signed-off-by: Patrick Donnelly <pdonnell@redhat.com>
(cherry picked from commit 909d0f1333a730c648c08cda047bb5f356a61986)

qa/tasks/cephfs/test_damage.py

index 459077b04282333297301f70a5991bb1af6b1c92..2ac14bf4b198f450045ed7cfeba7ddd103a53b15 100644 (file)
@@ -134,8 +134,8 @@ class TestDamage(CephFSTestCase):
         mutations = []
 
         # Removals
-        for obj_id in objects:
-            if obj_id in [
+        for o in objects:
+            if o in [
                 # JournalPointers are auto-replaced if missing (same path as upgrade)
                 "400.00000000",
                 # Missing dirfrags for non-system dirs result in empty directory
@@ -150,13 +150,13 @@ class TestDamage(CephFSTestCase):
                 expectation = DAMAGED_ON_START
 
             log.info("Expectation on rm '{0}' will be '{1}'".format(
-                obj_id, expectation
+                o, expectation
             ))
 
             mutations.append(MetadataMutation(
-                obj_id,
-                "Delete {0}".format(obj_id),
-                lambda o=obj_id: self.fs.rados(["rm", o]),
+                o,
+                "Delete {0}".format(o),
+                lambda o=o: self.fs.rados(["rm", o]),
                 expectation
             ))
 
@@ -171,8 +171,8 @@ class TestDamage(CephFSTestCase):
         ])
 
         # Truncations
-        for obj_id in data_objects:
-            if obj_id == "500.00000000":
+        for o in data_objects:
+            if o == "500.00000000":
                 # The PurgeQueue is allowed to be empty: Journaler interprets
                 # an empty header object as an empty journal.
                 expectation = NO_DAMAGE
@@ -206,22 +206,22 @@ class TestDamage(CephFSTestCase):
             )
 
         # OMAP header corruptions
-        for obj_id in omap_header_objs:
-            if re.match("60.\.00000000", obj_id) \
-                    or obj_id in ["1.00000000", "100.00000000", "mds0_sessionmap"]:
+        for o in omap_header_objs:
+            if re.match("60.\.00000000", o) \
+                    or o in ["1.00000000", "100.00000000", "mds0_sessionmap"]:
                 expectation = DAMAGED_ON_START
             else:
                 expectation = NO_DAMAGE
 
             log.info("Expectation on corrupt header '{0}' will be '{1}'".format(
-                obj_id, expectation
+                o, expectation
             ))
 
             mutations.append(
                 MetadataMutation(
-                    obj_id,
-                    "Corrupt omap header on {0}".format(obj_id),
-                    lambda o=obj_id: self.fs.rados(["setomapheader", o, junk]),
+                    o,
+                    "Corrupt omap header on {0}".format(o),
+                    lambda o=o: self.fs.rados(["setomapheader", o, junk]),
                     expectation
                 )
             )