diff options
author | ChangBo Guo(gcb) <eric.guo@easystack.cn> | 2016-12-08 17:00:46 +0800 |
---|---|---|
committer | ChangBo Guo(gcb) <eric.guo@easystack.cn> | 2017-01-20 21:48:37 +0800 |
commit | 1da7610f3c4e6390a8a3c8d103efb6e419ccc7eb (patch) | |
tree | 240f91bb84dd55401bab23c89a6f3177990b6f43 /nova/tests/unit/test_rpc.py | |
parent | 9acfef2c90186644120942558437b3fcc90222de (diff) | |
download | nova-1da7610f3c4e6390a8a3c8d103efb6e419ccc7eb.tar.gz |
Set access_policy for messaging's dispatcher
oslo.messaging allow dispatcher to restrict endpoint methods since
5.11.0 in d3a8f280ebd6fd12865fd20c4d772774e39aefa2, set with
DefaultRPCAccessPolicy to fix FutureWarning like:
"The access_policy argument is changing its default value to <class
'oslo_messaging.rpc.dispatcher.DefaultRPCAccessPolicy'> in version '?',
please update the code to explicitly set None as the value:
access_policy defaults to LegacyRPCAccessPolicy which exposes private
methods. Explicitly set access_policy to DefaultRPCAccessPolicy or
ExplicitRPCAccessPolicy.
"
Change-Id: I568d6bb8ec245059f09f853388c6fa3b30bded86
Diffstat (limited to 'nova/tests/unit/test_rpc.py')
-rw-r--r-- | nova/tests/unit/test_rpc.py | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/nova/tests/unit/test_rpc.py b/nova/tests/unit/test_rpc.py index 3f50efec21..a265d45cbd 100644 --- a/nova/tests/unit/test_rpc.py +++ b/nova/tests/unit/test_rpc.py @@ -17,6 +17,7 @@ import datetime import fixtures import mock import oslo_messaging as messaging +from oslo_messaging.rpc import dispatcher from oslo_serialization import jsonutils from oslo_utils import fixture as utils_fixture import testtools @@ -214,8 +215,10 @@ class TestRPC(testtools.TestCase): server = rpc.get_server(tgt, ends, serializer='foo') mock_ser.assert_called_once_with('foo') + access_policy = dispatcher.DefaultRPCAccessPolicy mock_get.assert_called_once_with(rpc.TRANSPORT, tgt, ends, - executor='eventlet', serializer=ser) + executor='eventlet', serializer=ser, + access_policy=access_policy) self.assertEqual('server', server) @mock.patch.object(rpc, 'profiler', mock.Mock()) @@ -250,8 +253,10 @@ class TestRPC(testtools.TestCase): server = rpc.get_server(tgt, ends, serializer='foo') mock_ser.assert_called_once_with('foo') + access_policy = dispatcher.DefaultRPCAccessPolicy mock_get.assert_called_once_with(rpc.TRANSPORT, tgt, ends, - executor='eventlet', serializer=ser) + executor='eventlet', serializer=ser, + access_policy=access_policy) self.assertEqual('server', server) def test_get_notifier(self): |