From: Milind Changire Date: Wed, 13 Mar 2024 04:55:24 +0000 (+0530) Subject: qa: test failure for duplicate retention spec X-Git-Tag: v20.1.0~31^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=4842f7b7abdc9daa2a09ebd5e572d404144ce4fb;p=ceph.git qa: test failure for duplicate retention spec Signed-off-by: Milind Changire (cherry picked from commit 074f05ae294a50f8b6a22fb58d03b46bfb956966) --- diff --git a/qa/tasks/cephfs/test_snap_schedules.py b/qa/tasks/cephfs/test_snap_schedules.py index bdfec3db5400b..207942eaa8165 100644 --- a/qa/tasks/cephfs/test_snap_schedules.py +++ b/qa/tasks/cephfs/test_snap_schedules.py @@ -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])