summaryrefslogtreecommitdiffstats
path: root/nova/tests
diff options
context:
space:
mode:
Diffstat (limited to 'nova/tests')
-rw-r--r--nova/tests/compute/test_compute.py24
-rw-r--r--nova/tests/compute/test_rpcapi.py18
2 files changed, 22 insertions, 20 deletions
diff --git a/nova/tests/compute/test_compute.py b/nova/tests/compute/test_compute.py
index dec61d3ff..4aa6545d1 100644
--- a/nova/tests/compute/test_compute.py
+++ b/nova/tests/compute/test_compute.py
@@ -589,7 +589,7 @@ class ComputeTestCase(BaseTestCase):
def test_set_admin_password(self):
"""Ensure instance can have its admin password set"""
- instance = self._create_fake_instance()
+ instance = jsonutils.to_primitive(self._create_fake_instance())
self.compute.run_instance(self.context, instance['uuid'])
db.instance_update(self.context, instance['uuid'],
{'task_state': task_states.UPDATING_PASSWORD})
@@ -598,7 +598,7 @@ class ComputeTestCase(BaseTestCase):
self.assertEqual(inst_ref['vm_state'], vm_states.ACTIVE)
self.assertEqual(inst_ref['task_state'], task_states.UPDATING_PASSWORD)
- self.compute.set_admin_password(self.context, instance['uuid'])
+ self.compute.set_admin_password(self.context, instance=instance)
inst_ref = db.instance_get_by_uuid(self.context, instance['uuid'])
self.assertEqual(inst_ref['vm_state'], vm_states.ACTIVE)
@@ -613,7 +613,8 @@ class ComputeTestCase(BaseTestCase):
db.instance_update(self.context, instance['uuid'], {
"power_state": power_state.NOSTATE,
})
- instance = db.instance_get_by_uuid(self.context, instance['uuid'])
+ instance = jsonutils.to_primitive(db.instance_get_by_uuid(
+ self.context, instance['uuid']))
self.assertEqual(instance['power_state'], power_state.NOSTATE)
@@ -630,7 +631,7 @@ class ComputeTestCase(BaseTestCase):
self.assertRaises(exception.Invalid,
self.compute.set_admin_password,
self.context,
- instance['uuid'])
+ instance=instance)
self.compute.terminate_instance(self.context, instance['uuid'])
def test_set_admin_password_driver_error(self):
@@ -660,7 +661,8 @@ class ComputeTestCase(BaseTestCase):
#so a new error is raised
self.assertRaises(exception.NovaException,
self.compute.set_admin_password,
- self.context, instance['uuid'])
+ self.context,
+ instance=jsonutils.to_primitive(inst_ref))
inst_ref = db.instance_get_by_uuid(self.context, instance['uuid'])
self.assertEqual(inst_ref['vm_state'], vm_states.ERROR)
@@ -747,11 +749,11 @@ class ComputeTestCase(BaseTestCase):
def test_snapshot(self):
"""Ensure instance can be snapshotted"""
- instance = self._create_fake_instance()
+ instance = jsonutils.to_primitive(self._create_fake_instance())
instance_uuid = instance['uuid']
name = "myfakesnapshot"
self.compute.run_instance(self.context, instance_uuid)
- self.compute.snapshot_instance(self.context, instance_uuid, name)
+ self.compute.snapshot_instance(self.context, name, instance=instance)
self.compute.terminate_instance(self.context, instance_uuid)
def test_snapshot_fails(self):
@@ -761,11 +763,11 @@ class ComputeTestCase(BaseTestCase):
self.stubs.Set(self.compute.driver, 'snapshot', fake_snapshot)
- instance = self._create_fake_instance()
+ instance = jsonutils.to_primitive(self._create_fake_instance())
self.compute.run_instance(self.context, instance['uuid'])
self.assertRaises(test.TestingException,
self.compute.snapshot_instance,
- self.context, instance['uuid'], "failing_snapshot")
+ self.context, "failing_snapshot", instance=instance)
self._assert_state({'task_state': None})
self.compute.terminate_instance(self.context, instance['uuid'])
@@ -1625,8 +1627,8 @@ class ComputeTestCase(BaseTestCase):
"version": "1.26"}, None)
rpc.cast(c, topic,
{"method": "rollback_live_migration_at_destination",
- "args": {'instance_id': inst_id},
- "version": "1.0"})
+ "args": {'instance': rpcinst},
+ "version": "1.32"})
# start test
self.mox.ReplayAll()
diff --git a/nova/tests/compute/test_rpcapi.py b/nova/tests/compute/test_rpcapi.py
index 7a1195fe0..cafd7fd55 100644
--- a/nova/tests/compute/test_rpcapi.py
+++ b/nova/tests/compute/test_rpcapi.py
@@ -60,8 +60,9 @@ class ComputeRpcAPITestCase(test.TestCase):
'rebuild_instance', 'remove_fixed_ip_from_instance',
'remove_volume_connection', 'rescue_instance', 'reset_network',
'resize_instance', 'resume_instance', 'revert_resize',
- 'start_instance', 'stop_instance', 'suspend_instance',
- 'unpause_instance'
+ 'rollback_live_migration_at_destination', 'set_admin_password',
+ 'snapshot_instance', 'start_instance', 'stop_instance',
+ 'suspend_instance', 'unpause_instance'
]
if 'rpcapi_class' in kwargs:
@@ -86,10 +87,7 @@ class ComputeRpcAPITestCase(test.TestCase):
methods_with_instance):
instance = expected_msg['args']['instance']
del expected_msg['args']['instance']
- if method in ['rollback_live_migration_at_destination']:
- expected_msg['args']['instance_id'] = instance['id']
- else:
- expected_msg['args']['instance_uuid'] = instance['uuid']
+ expected_msg['args']['instance_uuid'] = instance['uuid']
expected_msg['version'] = expected_version
cast_and_call = ['confirm_resize', 'stop_instance']
@@ -291,11 +289,12 @@ class ComputeRpcAPITestCase(test.TestCase):
def test_rollback_live_migration_at_destination(self):
self._test_compute_api('rollback_live_migration_at_destination',
- 'cast', instance=self.fake_instance, host='host')
+ 'cast', instance=self.fake_instance, host='host',
+ version='1.32')
def test_set_admin_password(self):
self._test_compute_api('set_admin_password', 'cast',
- instance=self.fake_instance, new_pass='pw')
+ instance=self.fake_instance, new_pass='pw', version='1.33')
def test_set_host_enabled(self):
self._test_compute_api('set_host_enabled', 'call',
@@ -308,7 +307,8 @@ class ComputeRpcAPITestCase(test.TestCase):
def test_snapshot_instance(self):
self._test_compute_api('snapshot_instance', 'cast',
instance=self.fake_instance, image_id='id', image_type='type',
- backup_type='type', rotation='rotation')
+ backup_type='type', rotation='rotation',
+ version='1.34')
def test_start_instance(self):
self._test_compute_api('start_instance', 'cast',