Skip to content

Commit 074f05a

Browse files
committed
qa: test failure for duplicate retention spec
Signed-off-by: Milind Changire <[email protected]>
1 parent 59ec7a9 commit 074f05a

File tree

1 file changed

+24
-0
lines changed

1 file changed

+24
-0
lines changed

qa/tasks/cephfs/test_snap_schedules.py

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -545,6 +545,30 @@ def test_snap_schedule_for_number_of_snaps_retention(self):
545545

546546
self.mount_a.run_shell(['rmdir', test_dir[1:]])
547547

548+
def test_failure_for_duplicate_retention(self):
549+
"""
550+
Test that adding retention for same spec fails for second time.
551+
"""
552+
test_dir = '/' + TestSnapSchedules.TEST_DIRECTORY
553+
554+
self.mount_a.run_shell(['mkdir', '-p', test_dir[1:]])
555+
556+
self.fs_snap_schedule_cmd('add', path=test_dir, snap_schedule='1m')
557+
self.fs_snap_schedule_cmd('retention', 'add', path=test_dir,
558+
retention_spec_or_period='m',
559+
retention_count='50')
560+
561+
# Adding a duplicate retention spec should fail
562+
with self.assertRaises(CommandFailedError):
563+
self.fs_snap_schedule_cmd('retention', 'add', path=test_dir,
564+
retention_spec_or_period='m',
565+
retention_count='50')
566+
567+
# remove snapshot schedule
568+
self.fs_snap_schedule_cmd('remove', path=test_dir)
569+
570+
self.mount_a.run_shell(['rmdir', test_dir[1:]])
571+
548572
def test_snap_schedule_all_periods(self):
549573
test_dir = TestSnapSchedulesSnapdir.TEST_DIRECTORY + "/minutes"
550574
self.mount_a.run_shell(['mkdir', '-p', test_dir])

0 commit comments

Comments
 (0)