]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
qa: test failure for duplicate retention spec 63969/head
authorMilind Changire <mchangir@redhat.com>
Wed, 13 Mar 2024 04:55:24 +0000 (10:25 +0530)
committerMilind Changire <mchangir@redhat.com>
Tue, 17 Jun 2025 04:02:09 +0000 (09:32 +0530)
Signed-off-by: Milind Changire <mchangir@redhat.com>
(cherry picked from commit 074f05ae294a50f8b6a22fb58d03b46bfb956966)

qa/tasks/cephfs/test_snap_schedules.py

index bdfec3db5400bcf47df4a7202a564ac631501542..207942eaa8165946a97e2cda4c160eae8f97406c 100644 (file)
@@ -545,6 +545,30 @@ class TestSnapSchedules(TestSnapSchedulesHelper):
 
         self.mount_a.run_shell(['rmdir', test_dir[1:]])
 
+    def test_failure_for_duplicate_retention(self):
+        """
+        Test that adding retention for same spec fails for second time.
+        """
+        test_dir = '/' + TestSnapSchedules.TEST_DIRECTORY
+
+        self.mount_a.run_shell(['mkdir', '-p', test_dir[1:]])
+
+        self.fs_snap_schedule_cmd('add', path=test_dir, snap_schedule='1m')
+        self.fs_snap_schedule_cmd('retention', 'add', path=test_dir,
+                                  retention_spec_or_period='m',
+                                  retention_count='50')
+
+        # Adding a duplicate retention spec should fail
+        with self.assertRaises(CommandFailedError):
+            self.fs_snap_schedule_cmd('retention', 'add', path=test_dir,
+                                      retention_spec_or_period='m',
+                                      retention_count='50')
+
+        # remove snapshot schedule
+        self.fs_snap_schedule_cmd('remove', path=test_dir)
+
+        self.mount_a.run_shell(['rmdir', test_dir[1:]])
+
     def test_snap_schedule_all_periods(self):
         test_dir = TestSnapSchedulesSnapdir.TEST_DIRECTORY + "/minutes"
         self.mount_a.run_shell(['mkdir', '-p', test_dir])