trove/trove/tests/unittests/common
Amrith Kumar 577d43b02d insulate TroveContext from possible changes in oslo.context
Earlier code introduced in[1] aimed to handle the situation where a
context object serialized and sent over a message queue as a
dictionary is received by a version of code that doesn't necessarily
understand that context object.

That code relied on the fact that vars(TroveContext).keys() was a
dictionary that matched the full set of parameters that you can send
to the initializers for TroveContext() and RequestContext().

Recent changes in oslo.context [2] and [3] broke that
assumption. vars() on TroveContext provided a dictionary with the
internal representation(s) that are not the same as the kwargs in
RequestContext() and the params that TroveContext used to pop.

To get around this, new code introduced here uses
oslo_utils.reflection to determine all the possible kwargs that can be
sent to TroveContext, some of which are consumed by TroveContext and
the rest of which are sent along to RequestContext().

The construct in the earlier _remove_incompatible_context_args() also
modified kwargs.keys() by pop'ing values from it while iterating over
this. Python 3 takes a dim view of this and therefore some changes
have been made to accomodate this.

A unittest has been added to ensure that the from_dict() method
properly dumps stuff it doesn't know about. The test explicitly
verifies the warning generated when a bogus argument is eliminated.

[1] 24c5e8e244
[2] 2394cff0631944a9259bfe04925e444d9f817758
[3] f25543fcc792ebf155728a91fde06e8dc4e96cea

Change-Id: I477dd29e034295e770925091c4ac6268c22ae59b
Related-Bug:#1661790
2017-02-04 12:07:56 -05:00
..
__init__.py Rename from reddwarf to trove. 2013-06-24 14:11:15 -07:00
test_common_extensions.py Add support for Oslo Policies to Trove 2016-12-06 21:51:21 +00:00
test_conductor_serializer.py secure oslo_messaging.rpc 2017-01-11 07:56:35 -05:00
test_context.py insulate TroveContext from possible changes in oslo.context 2017-02-04 12:07:56 -05:00
test_crypto_utils.py Port crypto_utils to Python 3 2016-04-20 14:45:26 +02:00
test_dbmodels.py Enable hacking extensions framework 2016-11-17 14:43:36 -05:00
test_exception.py Fix leaked mocks in the 'common' module if any 2015-05-06 15:21:57 -04:00
test_notification.py Use more specific asserts in tests 2016-09-29 10:16:56 +02:00
test_pagination.py Port test_pagination on Python 3 2016-06-29 15:55:18 +02:00
test_policy.py Add support for Oslo Policies to Trove 2016-12-06 21:51:21 +00:00
test_remote.py unwedge the gate 2017-01-29 18:37:11 -05:00
test_secure_serializer.py secure oslo_messaging.rpc 2017-01-11 07:56:35 -05:00
test_serializer.py secure oslo_messaging.rpc 2017-01-11 07:56:35 -05:00
test_server_group.py Locality support for replication 2016-06-20 19:38:48 +00:00
test_stream_codecs.py Port more common unit tests to Python 3 2016-04-11 12:09:56 +02:00
test_template.py Merge "Use more specific asserts in tests" 2016-10-04 16:25:37 +00:00
test_utils.py Implement full online backups for DB2 2016-09-13 20:35:01 +00:00
test_wsgi.py Fix leaked mocks in the 'common' module if any 2015-05-06 15:21:57 -04:00