]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
qa: test empty string arg during subvol create 53989/head
authorMilind Changire <mchangir@redhat.com>
Wed, 22 Feb 2023 07:53:41 +0000 (13:23 +0530)
committerMilind Changire <mchangir@redhat.com>
Wed, 16 Apr 2025 09:26:39 +0000 (14:56 +0530)
Signed-off-by: Milind Changire <mchangir@redhat.com>
qa/suites/fs/volumes/tasks/volumes/test/basic.yaml
qa/tasks/cephfs/test_volumes.py

index 49783bcc03bf8e83f7e08b09a6d55418dadc6f99..4e557bfb32531e8a87aa3294e7b86d665576cee6 100644 (file)
@@ -6,4 +6,5 @@ tasks:
         - tasks.cephfs.test_volumes.TestVolumeCreate
         - tasks.cephfs.test_volumes.TestSubvolumeGroups
         - tasks.cephfs.test_volumes.TestSubvolumes
+        - tasks.cephfs.test_volumes.TestEmptyStringForCreates
         - tasks.cephfs.test_subvolume
index 489bf4b6f530fe7c341e8d96560b4d59583fd8bb..603c60ae076ea70ba9fcea88a279d8efdefa37d6 100644 (file)
@@ -9778,3 +9778,48 @@ class TestPerModuleFinsherThread(TestVolumesHelper):
 
         # verify trash dir is clean
         self._wait_for_trash_empty()
+
+class TestEmptyStringForCreates(CephFSTestCase):
+    CLIENTS_REQUIRED = 1
+    MDSS_REQUIRED = 1
+
+    def setUp(self):
+        super().setUp()
+        result = json.loads(self.get_ceph_cmd_stdout("fs", "volume", "ls"))
+        self.assertTrue(len(result) > 0)
+        self.volname = result[0]['name']
+
+    def tearDown(self):
+        # clean up
+        super().tearDown()
+
+    def test_empty_name_string_for_subvolumegroup_name(self):
+        """
+        To test that an empty string is unacceptable for a subvolumegroup name
+        """
+        with self.assertRaises(CommandFailedError):
+            self.run_ceph_cmd("fs", "subvolumegroup", "create", self.volname, "")
+
+        with self.assertRaises(CommandFailedError):
+            self.run_ceph_cmd("fs", "subvolumegroup", "create", self.volname, "''")
+
+    def test_empty_name_string_for_subvolume_name(self):
+        """
+        To test that an empty string is unacceptable for a subvolume name
+        """
+        with self.assertRaises(CommandFailedError):
+            self.run_ceph_cmd("fs", "subvolume", "create", "")
+
+        with self.assertRaises(CommandFailedError):
+            self.run_ceph_cmd("fs", "subvolume", "create", "''")
+
+    def test_empty_name_string_for_subvolumegroup_name_argument(self):
+        """
+        To test that an empty string is unacceptable for a subvolumegroup name
+        argument when creating a subvolume
+        """
+        with self.assertRaises(CommandFailedError):
+            self.run_ceph_cmd("fs", "subvolume", "create", self.volname, "sv1", "--group_name")
+
+        with self.assertRaises(CommandFailedError):
+            self.run_ceph_cmd("fs", "subvolume", "create", self.volname, "sv1", "--group_name", "''")