From d9f0e29f7b1713e76bb10a11de08017277cbe5c2 Mon Sep 17 00:00:00 2001 From: Rishabh Dave Date: Fri, 7 Feb 2025 18:43:37 +0530 Subject: [PATCH] qa/cephfs: add tests for "fs subvolume create" command when... subvolume metadata file name length is too long. Signed-off-by: Rishabh Dave (cherry picked from commit 01f8f710c1a615bc9de03babc6d1fe7e0bc8a5bd) Conflicts: qa/tasks/cephfs/test_volumes.py - Region where patch is to be applied has changed in Reef compared to main. --- qa/tasks/cephfs/test_volumes.py | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/qa/tasks/cephfs/test_volumes.py b/qa/tasks/cephfs/test_volumes.py index 97997185716..227b6fc0468 100644 --- a/qa/tasks/cephfs/test_volumes.py +++ b/qa/tasks/cephfs/test_volumes.py @@ -4264,6 +4264,36 @@ class TestSubvolumes(TestVolumesHelper): # verify trash dir is clean. self._wait_for_trash_empty() + def test_create_when_subvol_name_is_too_long(self): + ''' + 255 chars of subvol name + 7 chars of (':', '_' and '.meta') and 0 + chars for default group name is greater than 256 chars, therefore + subvol meta file issue should be tested. + ''' + subvolname = 's' * 255 + self.negtest_ceph_cmd( + f'fs subvolume create {self.volname} {subvolname}', + retval=errno.ENAMETOOLONG, + errmsgs='Error ENAMETOOLONG: use shorter group or subvol name, ' + 'combination of both should be less than 249 characters') + + def test_create_when_subvol_group_name_is_too_long(self): + ''' + 248 chars of group name + 7 chars of (':', '_' and '.meta') and 7 + chars for subvol name is greater than 256 chars, therefore subvol + meta file issue should be tested. + ''' + groupname = 'g' * 248 + self.run_ceph_cmd( + f'fs subvolumegroup create {self.volname} {groupname}') + subvolname = 's' * 7 + self.negtest_ceph_cmd( + f'fs subvolume create {self.volname} {subvolname} --group-name ' + f'{groupname}', + retval=errno.ENAMETOOLONG, + errmsgs='Error ENAMETOOLONG: use shorter group or subvol name, ' + 'combination of both should be less than 249 characters') + class TestPausePurging(TestVolumesHelper): ''' Tests related to config "mgr/volumes/pause_purging". -- 2.39.5