]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
qa: add test for schedule auto deactivation 51246/head
authorMilind Changire <mchangir@redhat.com>
Thu, 1 Dec 2022 05:37:09 +0000 (11:07 +0530)
committerMilind Changire <mchangir@redhat.com>
Thu, 27 Apr 2023 08:54:48 +0000 (14:24 +0530)
Signed-off-by: Milind Changire <mchangir@redhat.com>
(cherry picked from commit 3fda85ec45308ed223a23ca725bf01c5baee0e63)

qa/tasks/cephfs/test_snap_schedules.py

index f4d3f51b1b46de7ece157057291b650183a346f3..6fc53c267d6aa168fa05ef1defceabd4461e5cfa 100644 (file)
@@ -448,6 +448,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}'