In cinder.rpc.RPCAPI methods _determine_rpc_version_cap and
_determine_obj_version_cap use global variables LAST_RPC_VERSIONS and
LAST_OBJ_VERSIONS to cache version values so we need to clear these
values between tests so one test values don't get passed to the next
test.
This was problematic for example when running some
cinder.tests.unit.api.contrib tests in a specific order:
- test_admin_actions.AdminActionsTest.test_delete_backup_force_when_creating
- test_backups.BackupsAPITestCase.test_create_backup_snapshot_json
Change-Id: I073557a6e0a17a3e00fd32d48d389a3bcf42e341
self.useFixture(self.messaging_conf)
rpc.init(CONF)
+ # NOTE(geguileo): This is required because _determine_obj_version_cap
+ # and _determine_rpc_version_cap functions in cinder.rpc.RPCAPI cache
+ # versions in LAST_RPC_VERSIONS and LAST_OBJ_VERSIONS so we may have
+ # weird interactions between tests if we don't clear them before each
+ # test.
+ rpc.LAST_OBJ_VERSIONS = {}
+ rpc.LAST_RPC_VERSIONS = {}
+
conf_fixture.set_defaults(CONF)
CONF([], default_config_files=[])