From 82fa0661b200616379c8f506151e8b35ef4860cc Mon Sep 17 00:00:00 2001 From: Venky Shankar Date: Wed, 23 Aug 2023 06:27:21 -0400 Subject: [PATCH] qa: add test to validate periodic checks by async threads Signed-off-by: Venky Shankar --- qa/tasks/cephfs/test_volumes.py | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/qa/tasks/cephfs/test_volumes.py b/qa/tasks/cephfs/test_volumes.py index 1213f5ef03a1..a360f9fa4b4c 100644 --- a/qa/tasks/cephfs/test_volumes.py +++ b/qa/tasks/cephfs/test_volumes.py @@ -7366,6 +7366,29 @@ class TestSubvolumeSnapshotClones(TestVolumesHelper): max_concurrent_clones = int(self.config_get('mgr', 'mgr/volumes/max_concurrent_clones')) self.assertEqual(max_concurrent_clones, 2) + def test_periodic_async_work(self): + """ + to validate that the async thread (purge thread in this case) will + process a job that's manually created. + """ + + self.config_set('mgr', 'mgr/volumes/periodic_async_work', True) + + trashdir = os.path.join("./", "volumes", "_deleting") + entry = os.path.join(trashdir, "subvol") + # hand create the directory + self.mount_a.run_shell(['sudo', 'mkdir', '-p', entry], omit_sudo=False) + + # verify trash dir is processed + self._wait_for_trash_empty() + + self.config_set('mgr', 'mgr/volumes/periodic_async_work', False) + + # wait a bit so that the default wakeup time (5s) is consumed + # by the async threads (i.e., the default gets honoured before + # the file system gets purged). + time.sleep(10) + def test_subvolume_under_group_snapshot_clone(self): subvolume = self._generate_random_subvolume_name() group = self._generate_random_group_name() -- 2.47.3