]> git.apps.os.sepia.ceph.com Git - ceph-ci.git/commitdiff
qa/tasks/cephfs/test_misc: switch duration to timeout
authorXiubo Li <xiubli@redhat.com>
Tue, 28 Nov 2023 01:49:45 +0000 (09:49 +0800)
committerXiubo Li <xiubli@redhat.com>
Mon, 26 Feb 2024 02:36:55 +0000 (10:36 +0800)
The duration is impresise and sometimes will give a false alarm
just in case the shell command itself is issued late.

https://tracker.ceph.com/issues/63587
Signed-off-by: Xiubo Li <xiubli@redhat.com>
(cherry picked from commit f0ebac137bf2ba6ab56c4f923bceceb0499c2ce9)

qa/tasks/cephfs/test_misc.py

index 131d1c4b7b9e90386f27248c4388406915be81e6..31d383da8948c511884597be5b73394ea30d8732 100644 (file)
@@ -258,23 +258,23 @@ class TestMisc(CephFSTestCase):
                 self.mount_a.run_shell(["mkdir", os.path.join(dir_path, f"{i}_{j}")])
             start = time.time()
             if file_sync:
-                self.mount_a.run_shell(['python3', '-c', sync_dir_pyscript])
+                self.mount_a.run_shell(['python3', '-c', sync_dir_pyscript], timeout=4)
             else:
-                self.mount_a.run_shell(["sync"])
+                self.mount_a.run_shell(["sync"], timeout=4)
+            # the real duration should be less than the rough one
             duration = time.time() - start
-            log.info(f"sync mkdir i = {i}, duration = {duration}")
-            self.assertLess(duration, 4)
+            log.info(f"sync mkdir i = {i}, rough duration = {duration}")
 
             for j in range(5):
                 self.mount_a.run_shell(["rm", "-rf", os.path.join(dir_path, f"{i}_{j}")])
             start = time.time()
             if file_sync:
-                self.mount_a.run_shell(['python3', '-c', sync_dir_pyscript])
+                self.mount_a.run_shell(['python3', '-c', sync_dir_pyscript], timeout=4)
             else:
-                self.mount_a.run_shell(["sync"])
+                self.mount_a.run_shell(["sync"], timeout=4)
+            # the real duration should be less than the rough one
             duration = time.time() - start
-            log.info(f"sync rmdir i = {i}, duration = {duration}")
-            self.assertLess(duration, 4)
+            log.info(f"sync rmdir i = {i}, rough duration = {duration}")
 
         self.mount_a.run_shell(["rm", "-rf", dir_path])