Unbreak the world!

This commit contains 2 unrelated fixes, updates the sample config to
reflect changes in a recent oslo.log release and remove direct calls
to fixtures cleanUp(). Normally we don't want to do this and should
have only 1 fix per patch. However, because they are both breaking the
tempest gate at the same time and preventing anything from landing if
we don't land them in a single patch neither fix will be able to land.

The fixtures 1.3.0 release started enforcing that manually calling the
cleanUp() function for a fixture that was created using useFixture()
was a bad idea. It's basically saying we don't want to manage the
fixture lifecycle but at the same time want to manually run cleanUp().
This enforcement included in the new release has been causing several
unit test failures when running with that release. This commit
addresses this by removing all the uses of this call straightup as it
turns out it was unecessary, or changing the tests to not rely on it
anymore.

Change-Id: I24f6e20cc8e310ba69fb23510795e235218abb2d
Closes-Bug: #1469825
This commit is contained in:
Matthew Treinish 2015-06-29 14:29:30 -04:00
parent 9ae9616d91
commit be15b877ca
No known key found for this signature in database
GPG Key ID: FD12A0F214C9E177
4 changed files with 28 additions and 48 deletions

View File

@ -77,9 +77,6 @@
# Enables or disables publication of error events. (boolean value)
#publish_errors = false
# Enables or disables fatal status of deprecations. (boolean value)
#fatal_deprecations = false
# The format for an instance that is passed with the log message.
# (string value)
#instance_format = "[instance: %(uuid)s] "

View File

@ -292,7 +292,6 @@ class TestAccount(base.TestCase):
'password': 'p', 'roles': ['role-7', 'role-11'],
'resources': {'network': 'network-2'}}]
# Clear previous mock using self.test_accounts
self.accounts_mock.cleanUp()
self.useFixture(mockpatch.Patch(
'tempest.common.accounts.read_accounts_yaml',
return_value=test_accounts))

View File

@ -213,8 +213,8 @@ class TestRequiresExtDecorator(BaseDecoratorsTest):
service='compute')
def test_requires_ext_decorator_with_all_ext_enabled(self):
# disable fixture so the default (all) is used.
self.config_fixture.cleanUp()
cfg.CONF.set_default('api_extensions', 'all',
group='compute-feature-enabled')
self._test_requires_ext_helper(expected_to_skip=False,
extension='random_ext',
service='compute')

View File

@ -211,20 +211,15 @@ class TestTenantIsolation(base.TestCase):
iso_creds = isolated_creds.IsolatedCreds(name='test class',
password='fake_password')
self._mock_assign_user_role()
roles_fix = self._mock_list_role()
tenant_fix = self._mock_tenant_create('1234', 'fake_prim_tenant')
user_fix = self._mock_user_create('1234', 'fake_prim_user')
self._mock_list_role()
self._mock_tenant_create('1234', 'fake_prim_tenant')
self._mock_user_create('1234', 'fake_prim_user')
iso_creds.get_primary_creds()
tenant_fix.cleanUp()
user_fix.cleanUp()
tenant_fix = self._mock_tenant_create('12345', 'fake_alt_tenant')
user_fix = self._mock_user_create('12345', 'fake_alt_user')
self._mock_tenant_create('12345', 'fake_alt_tenant')
self._mock_user_create('12345', 'fake_alt_user')
iso_creds.get_alt_creds()
tenant_fix.cleanUp()
user_fix.cleanUp()
roles_fix.cleanUp()
tenant_fix = self._mock_tenant_create('123456', 'fake_admin_tenant')
user_fix = self._mock_user_create('123456', 'fake_admin_user')
self._mock_tenant_create('123456', 'fake_admin_tenant')
self._mock_user_create('123456', 'fake_admin_user')
self._mock_list_roles('123456', 'admin')
iso_creds.get_admin_creds()
user_mock = self.patch(
@ -335,47 +330,36 @@ class TestTenantIsolation(base.TestCase):
password='fake_password')
# Create primary tenant and network
self._mock_assign_user_role()
roles_fix = self._mock_list_role()
user_fix = self._mock_user_create('1234', 'fake_prim_user')
tenant_fix = self._mock_tenant_create('1234', 'fake_prim_tenant')
net_fix = self._mock_network_create(iso_creds, '1234', 'fake_net')
subnet_fix = self._mock_subnet_create(iso_creds, '1234', 'fake_subnet')
router_fix = self._mock_router_create('1234', 'fake_router')
self._mock_list_role()
self._mock_user_create('1234', 'fake_prim_user')
self._mock_tenant_create('1234', 'fake_prim_tenant')
self._mock_network_create(iso_creds, '1234', 'fake_net')
self._mock_subnet_create(iso_creds, '1234', 'fake_subnet')
self._mock_router_create('1234', 'fake_router')
router_interface_mock = self.patch(
'tempest.services.network.json.network_client.NetworkClientJSON.'
'add_router_interface_with_subnet_id')
iso_creds.get_primary_creds()
router_interface_mock.called_once_with('1234', '1234')
router_interface_mock.reset_mock()
tenant_fix.cleanUp()
user_fix.cleanUp()
net_fix.cleanUp()
subnet_fix.cleanUp()
router_fix.cleanUp()
# Create alternate tenant and network
user_fix = self._mock_user_create('12345', 'fake_alt_user')
tenant_fix = self._mock_tenant_create('12345', 'fake_alt_tenant')
net_fix = self._mock_network_create(iso_creds, '12345', 'fake_alt_net')
subnet_fix = self._mock_subnet_create(iso_creds, '12345',
'fake_alt_subnet')
router_fix = self._mock_router_create('12345', 'fake_alt_router')
self._mock_user_create('12345', 'fake_alt_user')
self._mock_tenant_create('12345', 'fake_alt_tenant')
self._mock_network_create(iso_creds, '12345', 'fake_alt_net')
self._mock_subnet_create(iso_creds, '12345',
'fake_alt_subnet')
self._mock_router_create('12345', 'fake_alt_router')
iso_creds.get_alt_creds()
router_interface_mock.called_once_with('12345', '12345')
router_interface_mock.reset_mock()
tenant_fix.cleanUp()
user_fix.cleanUp()
net_fix.cleanUp()
subnet_fix.cleanUp()
router_fix.cleanUp()
roles_fix.cleanUp()
# Create admin tenant and networks
user_fix = self._mock_user_create('123456', 'fake_admin_user')
tenant_fix = self._mock_tenant_create('123456', 'fake_admin_tenant')
net_fix = self._mock_network_create(iso_creds, '123456',
'fake_admin_net')
subnet_fix = self._mock_subnet_create(iso_creds, '123456',
'fake_admin_subnet')
router_fix = self._mock_router_create('123456', 'fake_admin_router')
self._mock_user_create('123456', 'fake_admin_user')
self._mock_tenant_create('123456', 'fake_admin_tenant')
self._mock_network_create(iso_creds, '123456',
'fake_admin_net')
self._mock_subnet_create(iso_creds, '123456',
'fake_admin_subnet')
self._mock_router_create('123456', 'fake_admin_router')
self._mock_list_roles('123456', 'admin')
iso_creds.get_admin_creds()
self.patch('tempest.services.identity.v2.json.identity_client.'