From 82d72161f2a0036008ebca8be101a50a80d9cf0e Mon Sep 17 00:00:00 2001 From: Kefu Chai Date: Thu, 26 Sep 2019 08:54:01 +0800 Subject: [PATCH] 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 --- src/pybind/mgr/dashboard/tests/test_iscsi.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/pybind/mgr/dashboard/tests/test_iscsi.py b/src/pybind/mgr/dashboard/tests/test_iscsi.py index 4b59155b70a5c..5c1d91a50fbbc 100644 --- a/src/pybind/mgr/dashboard/tests/test_iscsi.py +++ b/src/pybind/mgr/dashboard/tests/test_iscsi.py @@ -107,7 +107,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) @@ -120,7 +120,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) @@ -133,7 +133,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) @@ -354,7 +354,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', @@ -363,7 +363,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) -- 2.39.5