From: Milind Changire Date: Thu, 1 Dec 2022 05:37:09 +0000 (+0530) Subject: qa: add test for schedule auto deactivation X-Git-Tag: v18.1.0~38^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=ea9f829a8caf9b98fbfe49e095cdaf6edad2af18;p=ceph.git qa: add test for schedule auto deactivation Signed-off-by: Milind Changire (cherry picked from commit 3fda85ec45308ed223a23ca725bf01c5baee0e63) --- diff --git a/qa/tasks/cephfs/test_snap_schedules.py b/qa/tasks/cephfs/test_snap_schedules.py index dbd80076382..736f49fe2c3 100644 --- a/qa/tasks/cephfs/test_snap_schedules.py +++ b/qa/tasks/cephfs/test_snap_schedules.py @@ -456,6 +456,28 @@ class TestSnapSchedules(TestSnapSchedulesHelper): self.remove_snapshots(testdir[1:]) self.mount_a.run_shell(['rmdir', testdir[1:]]) + def test_schedule_auto_deactivation_for_non_existent_path(self): + """ + Test that a non-existent path leads to schedule deactivation after a few retries. + """ + self.fs_snap_schedule_cmd('add', path="/bad-path", snap_schedule='1M') + start_time = time.time() + + while time.time() - start_time < 60.0: + s = self.fs_snap_schedule_cmd('status', path="/bad-path", format='json') + json_status = json.loads(s)[0] + + self.assertTrue(int(json_status['active']) == 1) + time.sleep(60) + + s = self.fs_snap_schedule_cmd('status', path="/bad-path", format='json') + json_status = json.loads(s)[0] + self.assertTrue(int(json_status['active']) == 0) + + # remove snapshot schedule + self.fs_snap_schedule_cmd('remove', path="/bad-path") + + class TestSnapSchedulesSnapdir(TestSnapSchedulesHelper): def remove_snapshots(self, dir_path, sdn): snap_path = f'{dir_path}/{sdn}'