From: Patrick Donnelly Date: Tue, 16 Apr 2024 19:22:13 +0000 (-0400) Subject: qa: move reqid_tostr helper X-Git-Tag: testing/wip-pdonnell-testing-20240429.210911-debug~8^2~5 X-Git-Url: http://git.apps.os.sepia.ceph.com/?a=commitdiff_plain;h=78a82ee4f7c7aca4dae4a5713770aa523f7c0418;p=ceph-ci.git qa: move reqid_tostr helper Signed-off-by: Patrick Donnelly --- diff --git a/qa/tasks/cephfs/cephfs_test_case.py b/qa/tasks/cephfs/cephfs_test_case.py index 6f46bb7734e..c1312ec5efc 100644 --- a/qa/tasks/cephfs/cephfs_test_case.py +++ b/qa/tasks/cephfs/cephfs_test_case.py @@ -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 diff --git a/qa/tasks/cephfs/test_quiesce.py b/qa/tasks/cephfs/test_quiesce.py index 62144c2ffbc..6b18055aff0 100644 --- a/qa/tasks/cephfs/test_quiesce.py +++ b/qa/tasks/cephfs/test_quiesce.py @@ -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}")