Merge "Test security group creation with insufficient rules quota"
diff --git a/neutron_tempest_plugin/api/test_security_groups_negative.py b/neutron_tempest_plugin/api/test_security_groups_negative.py
index 24e2289..7efa70e 100644
--- a/neutron_tempest_plugin/api/test_security_groups_negative.py
+++ b/neutron_tempest_plugin/api/test_security_groups_negative.py
@@ -16,6 +16,7 @@
from neutron_lib import constants
from neutron_lib.db import constants as db_const
from tempest.lib.common.utils import data_utils
+from tempest.lib.common.utils import test_utils
from tempest.lib import decorators
from tempest.lib import exceptions as lib_exc
@@ -170,3 +171,21 @@
values = [-2, 2147483648, "value"]
for value in values:
self.assertRaises(lib_exc.BadRequest, self._set_sg_quota, value)
+
+
+class NegativeSecGroupRulesQuotaTest(
+ test_security_groups.BaseSecGroupRulesQuota):
+
+ credentials = ['primary', 'admin']
+ required_extensions = ['security-group', 'quotas']
+
+ def setUp(self):
+ super(NegativeSecGroupRulesQuotaTest, self).setUp()
+ self.addCleanup(test_utils.call_and_ignore_notfound_exc,
+ self.admin_client.reset_quotas, self.client.tenant_id)
+ self._set_sg_rules_quota(10)
+
+ @decorators.idempotent_id('8336e6ea-2e0a-4a1a-8673-a6f81b577d57')
+ def test_sg_creation_with_insufficient_sg_rules_quota(self):
+ self._set_sg_rules_quota(0)
+ self.assertRaises(lib_exc.Conflict, self.create_security_group)