]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
qa: move reqid_tostr helper
authorPatrick Donnelly <pdonnell@redhat.com>
Tue, 16 Apr 2024 19:22:13 +0000 (15:22 -0400)
committerPatrick Donnelly <pdonnell@redhat.com>
Mon, 29 Apr 2024 20:59:50 +0000 (16:59 -0400)
Signed-off-by: Patrick Donnelly <pdonnell@redhat.com>
qa/tasks/cephfs/cephfs_test_case.py
qa/tasks/cephfs/test_quiesce.py

index 6f46bb7734e9cd97ea790eafbc986ad1f5d971c4..c1312ec5efcd1b2ccb09b98621ef125438cc8bc1 100644 (file)
@@ -81,6 +81,13 @@ class CephFSTestCase(CephTestCase):
 
     LOAD_SETTINGS = [] # type: ignore
 
+    def _reqid_tostr(self, reqid):
+        """
+        Change a json reqid to a string representation.
+        """
+
+        return f"{reqid['entity']['type']}.{reqid['entity']['num']}:{reqid['tid']}"
+
     def _save_mount_details(self):
         """
         XXX: Tests may change details of mount objects, so let's stash them so
index 62144c2ffbc3c814a47e2201b822e84e2012f96e..6b18055aff00635d386eff09d0f005e67929147c 100644 (file)
@@ -329,9 +329,6 @@ class QuiesceTestCase(CephFSTestCase):
         # check request/cap count is stopped
         # count inodes under /usr and count subops!
 
-    def reqid_tostr(self, reqid):
-        return f"{reqid['entity']['type']}.{reqid['entity']['num']}:{reqid['tid']}"
-
 class TestQuiesce(QuiesceTestCase):
     """
     Single rank functional tests.
@@ -348,7 +345,7 @@ class TestQuiesce(QuiesceTestCase):
         sleep(secrets.randbelow(30)+10)
 
         J = self.fs.rank_tell(["quiesce", "path", self.subvolume])
-        reqid = self.reqid_tostr(J['op']['reqid'])
+        reqid = self._reqid_tostr(J['op']['reqid'])
         self._wait_for_quiesce_complete(reqid)
 
         self._verify_quiesce()
@@ -364,7 +361,7 @@ class TestQuiesce(QuiesceTestCase):
         sleep(secrets.randbelow(30)+10)
 
         J = self.fs.rank_tell(["quiesce", "path", self.subvolume])
-        reqid = self.reqid_tostr(J['op']['reqid'])
+        reqid = self._reqid_tostr(J['op']['reqid'])
         self._wait_for_quiesce_complete(reqid)
 
         #path = os.path.normpath(os.path.join(self.mntpnt, ".."))
@@ -380,7 +377,7 @@ class TestQuiesce(QuiesceTestCase):
         """
 
         J = self.fs.rank_tell(["quiesce", "path", self.subvolume])
-        reqid = self.reqid_tostr(J['op']['reqid'])
+        reqid = self._reqid_tostr(J['op']['reqid'])
         self._wait_for_quiesce_complete(reqid)
         self._verify_quiesce()
 
@@ -391,7 +388,7 @@ class TestQuiesce(QuiesceTestCase):
         """
 
         J = self.fs.rank_tell(["quiesce", "path", self.subvolume])
-        reqid = self.reqid_tostr(J['op']['reqid'])
+        reqid = self._reqid_tostr(J['op']['reqid'])
         self._wait_for_quiesce_complete(reqid)
         self._verify_quiesce()
         ops = self.fs.get_ops()
@@ -422,7 +419,7 @@ class TestQuiesce(QuiesceTestCase):
         log.debug(f"{P}")
 
         J = self.fs.rank_tell(["quiesce", "path", self.subvolume])
-        reqid = self.reqid_tostr(J['op']['reqid'])
+        reqid = self._reqid_tostr(J['op']['reqid'])
         self._wait_for_quiesce_complete(reqid)
 
         P = self.fs.rank_tell(["ops"])
@@ -492,7 +489,7 @@ class TestQuiesce(QuiesceTestCase):
         path = self.mount_a.cephfs_mntpt + "/dir"
 
         J = self.fs.rank_tell(["quiesce", "path", path, '--wait'])
-        reqid = self.reqid_tostr(J['op']['reqid'])
+        reqid = self._reqid_tostr(J['op']['reqid'])
         self._wait_for_quiesce_complete(reqid, path=path)
         self._verify_quiesce(root=path)
 
@@ -519,7 +516,7 @@ class TestQuiesce(QuiesceTestCase):
         self._configure_subvolume()
 
         op1 = self.fs.rank_tell(["quiesce", "path", self.subvolume])['op']
-        op1_reqid = self.reqid_tostr(op1['reqid'])
+        op1_reqid = self._reqid_tostr(op1['reqid'])
         op2 = self.fs.rank_tell(["quiesce", "path", self.subvolume, '--wait'])['op']
         op1 = self.fs.get_op(op1_reqid)['type_data'] # for possible dup result
         log.debug(f"op1 = {op1}")
@@ -555,7 +552,7 @@ class TestQuiesce(QuiesceTestCase):
 
         J = self.fs.rank_tell(["quiesce", "path", self.subvolume])
         log.debug(f"{J}")
-        reqid = self.reqid_tostr(J['op']['reqid'])
+        reqid = self._reqid_tostr(J['op']['reqid'])
         self._wait_for_quiesce_complete(reqid)
         self._verify_quiesce(root=self.subvolume)
 
@@ -577,7 +574,7 @@ class TestQuiesce(QuiesceTestCase):
 
         J = self.fs.rank_tell(["quiesce", "path", self.subvolume])
         log.debug(f"{J}")
-        reqid = self.reqid_tostr(J['op']['reqid'])
+        reqid = self._reqid_tostr(J['op']['reqid'])
         self._wait_for_quiesce_complete(reqid)
         self._verify_quiesce(root=self.subvolume)
 
@@ -664,7 +661,7 @@ class TestQuiesceMultiRank(QuiesceTestCase):
         for d in dirs:
             path = os.path.join(self.mntpnt, d)
             op = self.fs.rank_tell("quiesce", "path", path, rank=0)['op']
-            reqid = self.reqid_tostr(op['reqid'])
+            reqid = self._reqid_tostr(op['reqid'])
             log.info(f"created {reqid}")
             qops.append(reqid)
 
@@ -727,11 +724,11 @@ class TestQuiesceMultiRank(QuiesceTestCase):
             path = os.path.join(self.mntpnt, d)
             for r in self.ranks:
                 op = self.fs.rank_tell(["quiesce", "path", path], rank=r)['op']
-                reqid = self.reqid_tostr(op['reqid'])
+                reqid = self._reqid_tostr(op['reqid'])
                 log.info(f"created {reqid}")
                 ops.append((r, op, path))
         for rank, op, path in ops:
-            reqid = self.reqid_tostr(op['reqid'])
+            reqid = self._reqid_tostr(op['reqid'])
             log.debug(f"waiting for ({rank}, {reqid})")
             op = self._wait_for_quiesce_complete(reqid, rank=rank, path=path, status=status)
         for rank, op, path in ops:
@@ -784,8 +781,8 @@ class TestQuiesceSplitAuth(QuiesceTestCase):
 
         op0 = self.fs.rank_tell(["quiesce", "path", self.subvolume], rank=0)['op']
         op1 = self.fs.rank_tell(["quiesce", "path", self.subvolume], rank=1)['op']
-        reqid0 = self.reqid_tostr(op0['reqid'])
-        reqid1 = self.reqid_tostr(op1['reqid'])
+        reqid0 = self._reqid_tostr(op0['reqid'])
+        reqid1 = self._reqid_tostr(op1['reqid'])
         op0 = self._wait_for_quiesce_complete(reqid0, rank=0, timeout=300)
         op1 = self._wait_for_quiesce_complete(reqid1, rank=1, timeout=300)
         log.debug(f"op0 = {op0}")