diff options
author | Russell Bryant <rbryant@redhat.com> | 2013-03-21 18:43:36 -0400 |
---|---|---|
committer | Russell Bryant <rbryant@redhat.com> | 2013-03-21 18:43:36 -0400 |
commit | ec8465a7b1077a71082324220e7c44cf700a4d4b (patch) | |
tree | 32e31f1e4fbdb0a280ef16c0077cba40a2d1919b /tests/unit/rpc | |
parent | bf70726d4228ebf3e65aa75b8f0ca6cab5e1e159 (diff) | |
download | oslo-ec8465a7b1077a71082324220e7c44cf700a4d4b.tar.gz oslo-ec8465a7b1077a71082324220e7c44cf700a4d4b.tar.xz oslo-ec8465a7b1077a71082324220e7c44cf700a4d4b.zip |
Enable message envelope.
Grizzly had the ability to receive messages with an envelope, but did
not send them. Now update the code to send them.
Change-Id: I73aad7697cf83ad4aabb3c2058b7cc4f53f783c2
Diffstat (limited to 'tests/unit/rpc')
-rw-r--r-- | tests/unit/rpc/amqp.py | 23 | ||||
-rw-r--r-- | tests/unit/rpc/test_common.py | 6 | ||||
-rw-r--r-- | tests/unit/rpc/test_zmq.py | 9 |
3 files changed, 2 insertions, 36 deletions
diff --git a/tests/unit/rpc/amqp.py b/tests/unit/rpc/amqp.py index 739297c..d8a3570 100644 --- a/tests/unit/rpc/amqp.py +++ b/tests/unit/rpc/amqp.py @@ -91,30 +91,11 @@ class BaseRpcAMQPTestCase(common.BaseRpcTestCase): envelope=False) self.assertEqual(self.test_msg, raw_msg) - # Envelopes enabled, but not enabled for notifications - self.stubs.Set(rpc_common, '_SEND_RPC_ENVELOPE', True) - self.rpc.notify(FLAGS, self.context, 'notifications.info', raw_msg, - envelope=False) - self.assertEqual(self.test_msg, raw_msg) - # Now turn it on for notifications - msg = { - 'oslo.version': rpc_common._RPC_ENVELOPE_VERSION, - 'oslo.message': jsonutils.dumps(raw_msg), - } - self.rpc.notify(FLAGS, self.context, 'notifications.info', raw_msg, - envelope=True) - remove_unique_id(self.test_msg) - remove_unique_id(msg) - self.assertEqual(self.test_msg, msg) - - # Make sure envelopes are still on notifications, even if turned off - # for general messages. - self.stubs.Set(rpc_common, '_SEND_RPC_ENVELOPE', False) self.rpc.notify(FLAGS, self.context, 'notifications.info', raw_msg, envelope=True) - remove_unique_id(self.test_msg) - self.assertEqual(self.test_msg, msg) + # Make sure the msg envelope was applied + self.assertTrue('oslo.version' in self.test_msg) def test_single_reply_queue_on_has_ids( self, single_reply_queue_for_callee_off=False): diff --git a/tests/unit/rpc/test_common.py b/tests/unit/rpc/test_common.py index b378b18..ee7bc96 100644 --- a/tests/unit/rpc/test_common.py +++ b/tests/unit/rpc/test_common.py @@ -238,13 +238,7 @@ class RpcCommonTestCase(test_utils.BaseTestCase): self.assertRaises(rpc_common.ClientException, naughty) self.assertRaises(ValueError, really_naughty) - def test_serialize_msg_v1(self): - self.stubs.Set(rpc_common, '_SEND_RPC_ENVELOPE', False) - msg = {'foo': 'bar'} - self.assertEqual(msg, rpc_common.serialize_msg(msg)) - def test_serialize_msg_v2(self): - self.stubs.Set(rpc_common, '_SEND_RPC_ENVELOPE', True) msg = {'foo': 'bar'} s_msg = {'oslo.version': rpc_common._RPC_ENVELOPE_VERSION, 'oslo.message': jsonutils.dumps(msg)} diff --git a/tests/unit/rpc/test_zmq.py b/tests/unit/rpc/test_zmq.py index 5339e3c..5380a98 100644 --- a/tests/unit/rpc/test_zmq.py +++ b/tests/unit/rpc/test_zmq.py @@ -125,15 +125,6 @@ class RpcZmqBaseTopicTestCase(_RpcZmqBaseTestCase): pass -class RpcZmqEnvelopeEnabledTestCase(_RpcZmqBaseTestCase): - """ - This sends messages with envelopes enabled. - """ - def setUp(self): - super(RpcZmqEnvelopeEnabledTestCase, self).setUp() - self.stubs.Set(rpc_common, '_SEND_RPC_ENVELOPE', True) - - class RpcZmqDirectTopicTestCase(_RpcZmqBaseTestCase): """ Test communication directly to a host, |