From: Patrick Donnelly Date: Tue, 8 Jan 2019 23:51:53 +0000 (-0800) Subject: qa: fix loop variable reference X-Git-Tag: v13.2.5~92^2~1 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=e73681453116ac9e6517b9f7785eca2217040d03;p=ceph.git qa: fix loop variable reference 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 (cherry picked from commit 909d0f1333a730c648c08cda047bb5f356a61986) --- diff --git a/qa/tasks/cephfs/test_damage.py b/qa/tasks/cephfs/test_damage.py index 459077b042823..2ac14bf4b198f 100644 --- a/qa/tasks/cephfs/test_damage.py +++ b/qa/tasks/cephfs/test_damage.py @@ -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 ) )