From 540571cda757bc9da2b3ae07717f2638d88283b6 Mon Sep 17 00:00:00 2001 From: Kotresh HR Date: Tue, 1 Feb 2022 16:38:41 +0530 Subject: [PATCH] qa: Add test for subvolumegroup ls filter Fixes: https://tracker.ceph.com/issues/54099 Signed-off-by: Kotresh HR (cherry picked from commit 95a83efcbe7b7faf2a292889e7c7ea7fcc629749) --- qa/tasks/cephfs/test_volumes.py | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/qa/tasks/cephfs/test_volumes.py b/qa/tasks/cephfs/test_volumes.py index cfbcfcdf09fd2..2f45fc01909b3 100644 --- a/qa/tasks/cephfs/test_volumes.py +++ b/qa/tasks/cephfs/test_volumes.py @@ -683,6 +683,26 @@ class TestSubvolumeGroups(TestVolumesHelper): if collections.Counter(subvolgroupnames) != collections.Counter(subvolumegroups): raise RuntimeError("Error creating or listing subvolume groups") + def test_subvolume_group_ls_filter(self): + # tests the 'fs subvolumegroup ls' command filters '_deleting' directory + + subvolumegroups = [] + + #create subvolumegroup + subvolumegroups = self._generate_random_group_name(3) + for groupname in subvolumegroups: + self._fs_cmd("subvolumegroup", "create", self.volname, groupname) + + # create subvolume and remove. This creates '_deleting' directory. + subvolume = self._generate_random_subvolume_name() + self._fs_cmd("subvolume", "create", self.volname, subvolume) + self._fs_cmd("subvolume", "rm", self.volname, subvolume) + + subvolumegroupls = json.loads(self._fs_cmd('subvolumegroup', 'ls', self.volname)) + subvolgroupnames = [subvolumegroup['name'] for subvolumegroup in subvolumegroupls] + if "_deleting" in subvolgroupnames: + self.fail("Listing subvolume groups listed '_deleting' directory") + def test_subvolume_group_ls_for_nonexistent_volume(self): # tests the 'fs subvolumegroup ls' command when /volume doesn't exist # prerequisite: we expect that the test volume is created and a subvolumegroup is NOT created -- 2.39.5