From: Kefu Chai Date: Thu, 26 Sep 2019 00:54:01 +0000 (+0800) Subject: mgr/dashboard: wait for iscsi/target create/put X-Git-Tag: v14.2.5~131^2~6 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=db82baaadbe1b16a75d33990f9bd4249268f08ab;p=ceph.git mgr/dashboard: wait for iscsi/target create/put IscsiTarget.create() returns a Task, so we need to wait for its completion before moving on. the same applies to IscsiTarget.put() Signed-off-by: Kefu Chai (cherry picked from commit 82d72161f2a0036008ebca8be101a50a80d9cf0e) --- diff --git a/src/pybind/mgr/dashboard/tests/test_iscsi.py b/src/pybind/mgr/dashboard/tests/test_iscsi.py index 2997668494256..3e9352454fdd3 100644 --- a/src/pybind/mgr/dashboard/tests/test_iscsi.py +++ b/src/pybind/mgr/dashboard/tests/test_iscsi.py @@ -103,7 +103,7 @@ class IscsiTest(ControllerTestCase, CLICommandTestMixin): target_iqn = "iqn.2003-01.com.redhat.iscsi-gw:iscsi-igw1" request = copy.deepcopy(iscsi_target_request) request['target_iqn'] = target_iqn - self._post('/api/iscsi/target', request) + self._task_post('/api/iscsi/target', request) self.assertStatus(201) self._get('/api/iscsi/target') self.assertStatus(200) @@ -116,7 +116,7 @@ class IscsiTest(ControllerTestCase, CLICommandTestMixin): target_iqn = "iqn.2003-01.com.redhat.iscsi-gw:iscsi-igw2" request = copy.deepcopy(iscsi_target_request) request['target_iqn'] = target_iqn - self._post('/api/iscsi/target', request) + self._task_post('/api/iscsi/target', request) self.assertStatus(201) self._get('/api/iscsi/target/{}'.format(request['target_iqn'])) self.assertStatus(200) @@ -129,7 +129,7 @@ class IscsiTest(ControllerTestCase, CLICommandTestMixin): target_iqn = "iqn.2003-01.com.redhat.iscsi-gw:iscsi-igw3" request = copy.deepcopy(iscsi_target_request) request['target_iqn'] = target_iqn - self._post('/api/iscsi/target', request) + self._task_post('/api/iscsi/target', request) self.assertStatus(201) self._delete('/api/iscsi/target/{}'.format(request['target_iqn'])) self.assertStatus(204) @@ -350,7 +350,7 @@ class IscsiTest(ControllerTestCase, CLICommandTestMixin): create_request['target_iqn'] = target_iqn create_request['groups'].append(copy.deepcopy(create_request['groups'][0])) create_request['groups'][1]['group_id'] = 'mygroup2' - self._post('/api/iscsi/target', create_request) + self._task_post('/api/iscsi/target', create_request) self.assertStatus(400) self.assertJsonBody({ 'detail': 'Each initiator can only be part of 1 group at a time', @@ -359,7 +359,7 @@ class IscsiTest(ControllerTestCase, CLICommandTestMixin): }) def _update_iscsi_target(self, create_request, update_request, response): - self._post('/api/iscsi/target', create_request) + self._task_post('/api/iscsi/target', create_request) self.assertStatus(201) self._put('/api/iscsi/target/{}'.format(create_request['target_iqn']), update_request) self.assertStatus(200)