]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
mgr/dashboard: fix tasks.mgr.dashboard.test_rbd.RbdTest.test_move_image_to_trash... 36563/head
authorKiefer Chang <kiefer.chang@suse.com>
Mon, 3 Aug 2020 05:42:18 +0000 (13:42 +0800)
committerTatjana Dehler <tdehler@suse.com>
Tue, 11 Aug 2020 09:46:36 +0000 (11:46 +0200)
The API call is a task and the response status is determined by whether
the call is completed within a pre-defined duration (2 seconds) or not.
We should also allow the status when the call takes longer.

Fixes: https://tracker.ceph.com/issues/46812
Signed-off-by: Kiefer Chang <kiefer.chang@suse.com>
(cherry picked from commit d208d67f9fc92873ba9d63190d7e5f5c202395a8)

qa/tasks/mgr/dashboard/test_rbd.py

index 8ec9049f422edc5a5b685150d8c5123c90e0fc92..804ffbb252df483ac63603fde37b6929652d164c 100644 (file)
@@ -173,14 +173,13 @@ class RbdTest(DashboardTestCase):
         cls._ceph_cmd(['osd', 'pool', 'delete', 'rbd_data', 'rbd_data',
                        '--yes-i-really-really-mean-it'])
 
-    @classmethod
-    def create_image_in_trash(cls, pool, name, delay=0):
-        cls.create_image(pool, None, name, 10240)
-        img = cls._get('/api/block/image/{}%2F{}'.format(pool, name))
+    def create_image_in_trash(self, pool, name, delay=0):
+        self.create_image(pool, None, name, 10240)
+        img = self._get('/api/block/image/{}%2F{}'.format(pool, name))
 
-        cls._task_post("/api/block/image/{}%2F{}/move_trash".format(pool, name),
+        self._task_post("/api/block/image/{}%2F{}/move_trash".format(pool, name),
                        {'delay': delay})
-
+        self.assertStatus([200, 201])
         return img['id']
 
     @classmethod
@@ -776,7 +775,6 @@ class RbdTest(DashboardTestCase):
 
     def test_move_image_to_trash(self):
         id = self.create_image_in_trash('rbd', 'test_rbd')
-        self.assertStatus(200)
 
         self.get_image('rbd', None, 'test_rbd')
         self.assertStatus(404)