From 0b8267aa834e9d86cf2ecd9fd64ccc218df454bd Mon Sep 17 00:00:00 2001 From: Russell Bryant Date: Sat, 8 Feb 2014 16:28:58 -0500 Subject: [PATCH] Fix a couple of unit test typos There were two cases in rpcapi unit tests where it was checking method instead of rpc_method. Fix up the typo and the reason why the typo didn't matter before. Also fix two places where rpcapi code had a return for a cast(), which is now caught by the unit tests. Closes-bug: #1272518 Change-Id: Ib5e3a002f6b0f7eb8dee8bd84bd53dbf817017f7 --- nova/network/rpcapi.py | 2 +- nova/scheduler/rpcapi.py | 2 +- nova/tests/network/test_rpcapi.py | 4 ++-- nova/tests/scheduler/test_rpcapi.py | 4 ++-- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/nova/network/rpcapi.py b/nova/network/rpcapi.py index 8417e67d4bb2..39827f0d9a81 100644 --- a/nova/network/rpcapi.py +++ b/nova/network/rpcapi.py @@ -284,7 +284,7 @@ class NetworkAPI(object): def update_dns(self, ctxt, network_ids): cctxt = self.client.prepare(fanout=True, version='1.3') - return cctxt.cast(ctxt, 'update_dns', network_ids=network_ids) + cctxt.cast(ctxt, 'update_dns', network_ids=network_ids) # NOTE(russellb): Ideally this would not have a prefix of '_' since it is # a part of the rpc API. However, this is how it was being called when the diff --git a/nova/scheduler/rpcapi.py b/nova/scheduler/rpcapi.py index 004ddcd0fd68..45d6c837210c 100644 --- a/nova/scheduler/rpcapi.py +++ b/nova/scheduler/rpcapi.py @@ -113,7 +113,7 @@ class SchedulerAPI(object): version = '2.9' msg_kwargs['legacy_bdm_in_spec'] = legacy_bdm_in_spec cctxt = self.client.prepare(version=version) - return cctxt.cast(ctxt, 'run_instance', **msg_kwargs) + cctxt.cast(ctxt, 'run_instance', **msg_kwargs) def prep_resize(self, ctxt, instance, instance_type, image, request_spec, filter_properties, reservations): diff --git a/nova/tests/network/test_rpcapi.py b/nova/tests/network/test_rpcapi.py index 79070299282d..341d67641a8a 100644 --- a/nova/tests/network/test_rpcapi.py +++ b/nova/tests/network/test_rpcapi.py @@ -42,7 +42,7 @@ class NetworkRpcAPITestCase(test.NoDBTestCase): self.assertIsNotNone(rpcapi.client) self.assertEqual(rpcapi.client.target.topic, CONF.network_topic) - expected_retval = 'foo' if method == 'call' else None + expected_retval = 'foo' if rpc_method == 'call' else None expected_version = kwargs.pop('version', None) expected_fanout = kwargs.pop('fanout', None) expected_kwargs = kwargs.copy() @@ -86,7 +86,7 @@ class NetworkRpcAPITestCase(test.NoDBTestCase): rpcapi.client.prepare(**prepare_kwargs).AndReturn(rpcapi.client) rpc_method = getattr(rpcapi.client, rpc_method) - rpc_method(ctxt, method, **expected_kwargs).AndReturn(expected_retval) + rpc_method(ctxt, method, **expected_kwargs).AndReturn('foo') self.mox.ReplayAll() diff --git a/nova/tests/scheduler/test_rpcapi.py b/nova/tests/scheduler/test_rpcapi.py index 5a71c7859ad5..2ec43cb23619 100644 --- a/nova/tests/scheduler/test_rpcapi.py +++ b/nova/tests/scheduler/test_rpcapi.py @@ -34,7 +34,7 @@ class SchedulerRpcAPITestCase(test.NoDBTestCase): self.assertIsNotNone(rpcapi.client) self.assertEqual(rpcapi.client.target.topic, CONF.scheduler_topic) - expected_retval = 'foo' if method == 'call' else None + expected_retval = 'foo' if rpc_method == 'call' else None expected_version = kwargs.pop('version', None) expected_fanout = kwargs.pop('fanout', None) expected_kwargs = kwargs.copy() @@ -54,7 +54,7 @@ class SchedulerRpcAPITestCase(test.NoDBTestCase): rpc_method = getattr(rpcapi.client, rpc_method) - rpc_method(ctxt, method, **expected_kwargs).AndReturn(expected_retval) + rpc_method(ctxt, method, **expected_kwargs).AndReturn('foo') self.mox.ReplayAll()