From eff0a1d2aeab269e57b2bcf9e9bef48ffa6b5d07 Mon Sep 17 00:00:00 2001 From: Leonid Usov Date: Tue, 24 Oct 2023 16:13:43 +0300 Subject: [PATCH] qa/tasks/cephfs: give the tests more time to run heavy fs workloads Signed-off-by: Leonid Usov --- qa/tasks/cephfs/mount.py | 13 +++++++------ qa/tasks/cephfs/test_snapshots.py | 2 +- 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/qa/tasks/cephfs/mount.py b/qa/tasks/cephfs/mount.py index be1ef6ea428e2..5263c5bfac470 100644 --- a/qa/tasks/cephfs/mount.py +++ b/qa/tasks/cephfs/mount.py @@ -761,17 +761,18 @@ class CephFSMount(object): 'rm', '-f', os.path.join(self.hostfs_mntpt, filename) ]) - def _run_python(self, pyscript, py_version='python3', sudo=False): + def _run_python(self, pyscript, py_version='python3', sudo=False, timeout=None): args, omit_sudo = [], True if sudo: args.append('sudo') omit_sudo = False - args += ['stdin-killer', '--', py_version, '-c', pyscript] + timeout_args = ['--timeout', "%d" % timeout] if timeout is not None else [] + args += ['stdin-killer', *timeout_args, '--', py_version, '-c', pyscript] return self.client_remote.run(args=args, wait=False, stdin=run.PIPE, stdout=StringIO(), omit_sudo=omit_sudo) - def run_python(self, pyscript, py_version='python3', sudo=False): - p = self._run_python(pyscript, py_version, sudo=sudo) + def run_python(self, pyscript, py_version='python3', sudo=False, timeout=None): + p = self._run_python(pyscript, py_version, sudo=sudo, timeout=timeout) p.wait() return p.stdout.getvalue().strip() @@ -1243,7 +1244,7 @@ class CephFSMount(object): size=size ))) - def validate_test_pattern(self, filename, size): + def validate_test_pattern(self, filename, size, timeout=None): log.info("Validating {0} bytes from {1}".format(size, filename)) # Use sudo because cephfs-data-scan may recreate the file with owner==root return self.run_python(dedent(""" @@ -1262,7 +1263,7 @@ class CephFSMount(object): """.format( path=os.path.join(self.hostfs_mntpt, filename), size=size - )), sudo=True) + )), sudo=True, timeout=timeout) def open_n_background(self, fs_path, count): """ diff --git a/qa/tasks/cephfs/test_snapshots.py b/qa/tasks/cephfs/test_snapshots.py index a9639a7ebbcaf..4cca133c31828 100644 --- a/qa/tasks/cephfs/test_snapshots.py +++ b/qa/tasks/cephfs/test_snapshots.py @@ -376,7 +376,7 @@ class TestSnapshots(CephFSTestCase): self.mount_a.write_test_pattern("d0/d1/file_a", 8 * 1024 * 1024) self.mount_a.run_shell(["mkdir", "d0/.snap/s1"]) self.mount_a.run_shell(["rm", "-f", "d0/d1/file_a"]) - self.mount_a.validate_test_pattern("d0/.snap/s1/d1/file_a", 8 * 1024 * 1024) + self.mount_a.validate_test_pattern("d0/.snap/s1/d1/file_a", 8 * 1024 * 1024, timeout=20) self.mount_a.run_shell(["rmdir", "d0/.snap/s1"]) self.mount_a.run_shell(["rm", "-rf", "d0"]) -- 2.39.5