Fix QuotasNegativeTest to use non dynamic credentials
The tests with enabled force_tenant_isolation option always use dynamic
credentials. Made changes to QuotasNegativeTest to run test in the new
project.
Change-Id: I62ce52fda632eaa27f8145ce0cead0b13ff8587a
Closes-Bug: #1789938
diff --git a/tempest/api/network/admin/test_negative_quotas.py b/tempest/api/network/admin/test_negative_quotas.py
index e79f8c3..a075b51 100644
--- a/tempest/api/network/admin/test_negative_quotas.py
+++ b/tempest/api/network/admin/test_negative_quotas.py
@@ -14,7 +14,9 @@
# under the License.
from tempest.api.network import base
+from tempest.common import identity
from tempest.common import utils
+from tempest.lib.common.utils import data_utils
from tempest.lib import decorators
from tempest.lib import exceptions as lib_exc
@@ -30,7 +32,6 @@
quota_driver = neutron.db.quota_db.DbQuotaDriver
"""
- force_tenant_isolation = True
@classmethod
def skip_checks(cls):
@@ -39,27 +40,36 @@
msg = "quotas extension not enabled."
raise cls.skipException(msg)
+ def setUp(self):
+ 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(
+ name=name, description=description)
+ self.addCleanup(identity.identity_utils(self.os_admin).delete_project,
+ self.project['id'])
+
@decorators.attr(type=['negative'])
@decorators.idempotent_id('644f4e1b-1bf9-4af0-9fd8-eb56ac0f51cf')
def test_network_quota_exceeding(self):
# Set the network quota to two
- self.admin_quotas_client.update_quotas(self.networks_client.tenant_id,
- network=2)
- self.addCleanup(self.admin_quotas_client.reset_quotas,
- self.networks_client.tenant_id)
+ self.admin_quotas_client.update_quotas(self.project['id'], network=2)
# Create two networks
- n1 = self.networks_client.create_network()
- self.addCleanup(self.networks_client.delete_network,
+ n1 = self.admin_networks_client.create_network(
+ tenant_id=self.project['id'])
+ self.addCleanup(self.admin_networks_client.delete_network,
n1['network']['id'])
- n2 = self.networks_client.create_network()
- self.addCleanup(self.networks_client.delete_network,
+ n2 = self.admin_networks_client.create_network(
+ tenant_id=self.project['id'])
+ self.addCleanup(self.admin_networks_client.delete_network,
n2['network']['id'])
# Try to create a third network while the quota is two
with self.assertRaisesRegex(
lib_exc.Conflict,
r"Quota exceeded for resources: \['network'\].*"):
- n3 = self.networks_client.create_network()
- self.addCleanup(self.networks_client.delete_network,
+ n3 = self.admin_networks_client.create_network(
+ tenant_id=self.project['id'])
+ self.addCleanup(self.admin_networks_client.delete_network,
n3['network']['id'])