]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
qa: test failure for duplicate retention spec 59161/head
authorMilind Changire <mchangir@redhat.com>
Wed, 13 Mar 2024 04:55:24 +0000 (10:25 +0530)
committerMilind Changire <mchangir@redhat.com>
Mon, 12 Aug 2024 03:29:15 +0000 (08:59 +0530)
Signed-off-by: Milind Changire <mchangir@redhat.com>
qa/tasks/cephfs/test_snap_schedules.py

index 1fff047f468910dd5f40039863c41e3af55644ce..7e3a6b270dd0078337deb02e6b6a6e835b58504b 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])