Skip to content

Commit 3bc6ff0

Browse files
author
Balazs Gibizer
committed
Stabilize unshelve notification sample tests
The notification sample test for unshelve waits for the instance to reach ACTIVE state and then asserts if unshelve.end notification is emitted properly. However the instance.vm_state is set to ACTIVE earlier[1] than emitting the unshelve.end notification[2]. This can cause two different test case failure. 1) _test_unshelve_server() fails with no ushelve.end notification received. 2) _test_shelve_and_shelve_offload_server() also has a unshelve action at the end and that test step also only waits for the the ACTIVE state. So the unshelve.end notification from the end of _test_shelve_and_shelve_offload_server() can bleed into the _test_unshelve_server() step causing that it receive one more notifications. So this patch adds an extra self._wait_for_notification('instance.unshelve.end') call to each test step to prevent the instability. [1] https://github.com/openstack/nova/blob/5c6c1f8f/nova/compute/manager.py#L5322-L5326 [2] https://github.com/openstack/nova/blob/5c6c1f8f/nova/compute/manager.py#L5329 [3] https://github.com/openstack/nova/blob/5c6c1f8f/nova/tests/functional/notification_sample_tests/test_instance.py#L836 Closes-Bug: #1835070 Change-Id: Ie217523a8969326b27930d7f74e50e9b352ab7a1 (cherry picked from commit 40f1e7c)
1 parent b01bc2f commit 3bc6ff0

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

nova/tests/functional/notification_sample_tests/test_instance.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -841,6 +841,7 @@ def _test_shelve_and_shelve_offload_server(self, server):
841841

842842
self.api.post_server_action(server['id'], {'unshelve': None})
843843
self._wait_for_state_change(self.api, server, 'ACTIVE')
844+
self._wait_for_notification('instance.unshelve.end')
844845

845846
def _test_unshelve_server(self, server):
846847
# setting the shelved_offload_time to 0 should set the
@@ -858,6 +859,7 @@ def _test_unshelve_server(self, server):
858859
post = {'unshelve': None}
859860
self.api.post_server_action(server['id'], post)
860861
self._wait_for_state_change(self.admin_api, server, 'ACTIVE')
862+
self._wait_for_notification('instance.unshelve.end')
861863
self.assertEqual(9, len(fake_notifier.VERSIONED_NOTIFICATIONS))
862864
self._verify_notification(
863865
'instance-unshelve-start',

0 commit comments

Comments
 (0)