summaryrefslogtreecommitdiff
path: root/nova/tests/functional/notification_sample_tests/test_instance.py
diff options
context:
space:
mode:
Diffstat (limited to 'nova/tests/functional/notification_sample_tests/test_instance.py')
-rw-r--r--nova/tests/functional/notification_sample_tests/test_instance.py32
1 files changed, 19 insertions, 13 deletions
diff --git a/nova/tests/functional/notification_sample_tests/test_instance.py b/nova/tests/functional/notification_sample_tests/test_instance.py
index 710b2a71fb..5a52c2dad6 100644
--- a/nova/tests/functional/notification_sample_tests/test_instance.py
+++ b/nova/tests/functional/notification_sample_tests/test_instance.py
@@ -11,8 +11,8 @@
# under the License.
import time
+from unittest import mock
-import mock
from nova import exception
from nova.tests import fixtures
@@ -46,18 +46,18 @@ class TestInstanceNotificationSampleWithMultipleCompute(
self.compute2 = self.start_service('compute', host='host2')
actions = [
- self._test_live_migration_rollback,
- self._test_live_migration_abort,
- self._test_live_migration_success,
- self._test_evacuate_server,
- self._test_live_migration_force_complete
+ (self._test_live_migration_rollback, 'ACTIVE'),
+ (self._test_live_migration_abort, 'ACTIVE'),
+ (self._test_live_migration_success, 'ACTIVE'),
+ (self._test_evacuate_server, 'SHUTOFF'),
+ (self._test_live_migration_force_complete, 'ACTIVE'),
]
- for action in actions:
+ for action, expected_state in actions:
self.notifier.reset()
action(server)
# Ensure that instance is in active state after an action
- self._wait_for_state_change(server, 'ACTIVE')
+ self._wait_for_state_change(server, expected_state)
@mock.patch('nova.compute.manager.ComputeManager.'
'_live_migration_cleanup_flags', return_value=[True, False])
@@ -193,7 +193,7 @@ class TestInstanceNotificationSampleWithMultipleCompute(
self.admin_api.delete_migration(server['id'], migrations[0]['id'])
self._wait_for_notification('instance.live_migration_abort.start')
self._wait_for_state_change(server, 'ACTIVE')
- # NOTE(gibi): the intance.live_migration_rollback notification emitted
+ # NOTE(gibi): the instance.live_migration_rollback notification emitted
# after the instance.live_migration_abort notification so we have to
# wait for the rollback to ensure we can assert both notifications
# below
@@ -275,6 +275,12 @@ class TestInstanceNotificationSampleWithMultipleCompute(
self.admin_api.put_service(service_id, {'forced_down': False})
def _test_live_migration_force_complete(self, server):
+ # In the scenario evacuate happened before which stopped the
+ # server.
+ self._start_server(server)
+ self._wait_for_state_change(server, 'ACTIVE')
+ self.notifier.reset()
+
post = {
'os-migrateLive': {
'host': 'host2',
@@ -1231,7 +1237,7 @@ class TestInstanceNotificationSample(
'nova_object.data': {},
'nova_object.name': 'ImageMetaPropsPayload',
'nova_object.namespace': 'nova',
- 'nova_object.version': '1.8',
+ 'nova_object.version': '1.12',
},
'image.size': 58145823,
'image.tags': [],
@@ -1327,7 +1333,7 @@ class TestInstanceNotificationSample(
'nova_object.data': {},
'nova_object.name': 'ImageMetaPropsPayload',
'nova_object.namespace': 'nova',
- 'nova_object.version': '1.8',
+ 'nova_object.version': '1.12',
},
'image.size': 58145823,
'image.tags': [],
@@ -1500,8 +1506,8 @@ class TestInstanceNotificationSample(
self.api.delete_server_volume(server['id'], volume_id)
self._wait_for_notification('instance.volume_detach.end')
- def _volume_swap_server(self, server, attachement_id, volume_id):
- self.api.put_server_volume(server['id'], attachement_id, volume_id)
+ def _volume_swap_server(self, server, attachment_id, volume_id):
+ self.api.put_server_volume(server['id'], attachment_id, volume_id)
def test_volume_swap_server(self):
server = self._boot_a_server(