Merge "Fix test_network_quota_exceeding test"
diff --git a/tempest/api/network/admin/test_negative_quotas.py b/tempest/api/network/admin/test_negative_quotas.py
index 190d9e3..614dfcf 100644
--- a/tempest/api/network/admin/test_negative_quotas.py
+++ b/tempest/api/network/admin/test_negative_quotas.py
@@ -45,11 +45,16 @@
super(QuotasNegativeTest, self).setUp()
name = data_utils.rand_name('test_project_')
description = data_utils.rand_name('desc_')
- self.project = identity.identity_utils(self.os_admin).create_project(
+ self.creds_client = identity.identity_utils(self.os_admin)
+ self.project = self.creds_client.create_project(
name=name, description=description)
self.addCleanup(identity.identity_utils(self.os_admin).delete_project,
self.project['id'])
+ def tearDown(self):
+ super(QuotasNegativeTest, self).tearDown()
+ self.credentials_provider.cleanup_default_secgroup(self.project['id'])
+
@decorators.attr(type=['negative'])
@decorators.idempotent_id('644f4e1b-1bf9-4af0-9fd8-eb56ac0f51cf')
def test_network_quota_exceeding(self):
diff --git a/tempest/lib/common/dynamic_creds.py b/tempest/lib/common/dynamic_creds.py
index 3b17af2..32dea44 100644
--- a/tempest/lib/common/dynamic_creds.py
+++ b/tempest/lib/common/dynamic_creds.py
@@ -518,7 +518,7 @@
LOG.warning('network with name: %s not found for delete',
network_name)
- def _cleanup_default_secgroup(self, tenant):
+ def cleanup_default_secgroup(self, tenant):
nsg_client = self.security_groups_admin_client
resp_body = nsg_client.list_security_groups(tenant_id=tenant,
name="default")
@@ -572,13 +572,13 @@
LOG.warning("user with name: %s not found for delete",
creds.username)
# NOTE(zhufl): Only when neutron's security_group ext is
- # enabled, _cleanup_default_secgroup will not raise error. But
+ # enabled, cleanup_default_secgroup will not raise error. But
# here cannot use test_utils.is_extension_enabled for it will cause
# "circular dependency". So here just use try...except to
# ensure tenant deletion without big changes.
try:
if self.neutron_available:
- self._cleanup_default_secgroup(creds.tenant_id)
+ self.cleanup_default_secgroup(creds.tenant_id)
except lib_exc.NotFound:
LOG.warning("failed to cleanup tenant %s's secgroup",
creds.tenant_name)