Browse Source

Merge "check the task state after creating image"

changes/55/674855/1
Zuul 1 month ago
parent
commit
6e44e22716
2 changed files with 26 additions and 7 deletions
  1. 9
    0
      rally_openstack/scenarios/nova/utils.py
  2. 17
    7
      tests/unit/scenarios/nova/test_utils.py

+ 9
- 0
rally_openstack/scenarios/nova/utils.py View File

@@ -514,6 +514,15 @@ class NovaScenario(scenario.OpenStackScenario):
514 514
                 timeout=CONF.openstack.nova_server_image_create_timeout,
515 515
                 check_interval=check_interval
516 516
             )
517
+        with atomic.ActionTimer(self, "nova.wait_for_server"):
518
+            utils.wait_for_status(
519
+                server,
520
+                ready_statuses=["None"],
521
+                status_attr="OS-EXT-STS:task_state",
522
+                update_resource=utils.get_from_manager(),
523
+                timeout=CONF.openstack.nova_server_image_create_timeout,
524
+                check_interval=check_interval
525
+            )
517 526
         return image
518 527
 
519 528
     @atomic.action_timer("nova.get_keypair")

+ 17
- 7
tests/unit/scenarios/nova/test_utils.py View File

@@ -236,13 +236,23 @@ class NovaScenarioTestCase(test.ScenarioTestCase):
236 236
         glance.get_image.return_value = self.image
237 237
         nova_scenario = utils.NovaScenario(context=self.context)
238 238
         return_image = nova_scenario._create_image(self.server)
239
-        self.mock_wait_for_status.mock.assert_called_once_with(
240
-            self.image,
241
-            ready_statuses=["ACTIVE"],
242
-            update_resource=glance.get_image,
243
-            check_interval=CONF.openstack.
244
-            nova_server_image_create_poll_interval,
245
-            timeout=CONF.openstack.nova_server_image_create_timeout)
239
+        self.mock_wait_for_status.mock.assert_has_calls([
240
+            mock.call(
241
+                self.image,
242
+                ready_statuses=["ACTIVE"],
243
+                update_resource=glance.get_image,
244
+                check_interval=CONF.openstack.
245
+                nova_server_image_create_poll_interval,
246
+                timeout=CONF.openstack.nova_server_image_create_timeout),
247
+            mock.call(
248
+                self.server,
249
+                ready_statuses=["None"],
250
+                status_attr="OS-EXT-STS:task_state",
251
+                update_resource=self.mock_get_from_manager.mock.return_value,
252
+                check_interval=CONF.openstack.
253
+                nova_server_image_create_poll_interval,
254
+                timeout=CONF.openstack.nova_server_image_create_timeout)
255
+        ])
246 256
         self.assertEqual(self.mock_wait_for_status.mock.return_value,
247 257
                          return_image)
248 258
         self._test_atomic_action_timer(nova_scenario.atomic_actions(),

Loading…
Cancel
Save