From fc2e0f454da174eb56d54350a920c211542d0d6d Mon Sep 17 00:00:00 2001 From: Gorka Eguileor Date: Wed, 2 Mar 2016 13:23:31 +0100 Subject: [PATCH] Fix test isolation issues related to versions 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 --- cinder/test.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/cinder/test.py b/cinder/test.py index 1d2d01c35..0fdb1efd0 100644 --- a/cinder/test.py +++ b/cinder/test.py @@ -188,6 +188,14 @@ class TestCase(testtools.TestCase): 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=[]) -- 2.45.2