diff --git a/neutron_tempest_plugin/api/admin/test_quotas.py b/neutron_tempest_plugin/api/admin/test_quotas.py index 0cf474e0..eb47fa5a 100644 --- a/neutron_tempest_plugin/api/admin/test_quotas.py +++ b/neutron_tempest_plugin/api/admin/test_quotas.py @@ -87,7 +87,7 @@ class QuotasTest(QuotasTestBase): new_quotas = {'network': 0, 'security_group': 0} # Change quotas for tenant - quota_set = self._setup_quotas(tenant_id, **new_quotas) + quota_set = self._setup_quotas(tenant_id, force=True, **new_quotas) for key, value in new_quotas.items(): self.assertEqual(value, quota_set[key]) @@ -112,6 +112,23 @@ class QuotasTest(QuotasTestBase): for q in non_default_quotas['quotas']: self.assertNotEqual(tenant_id, q['tenant_id']) + @decorators.idempotent_id('43d01327-d8be-4773-a8f0-1d2e9664fda2') + @decorators.attr(type='gate') + @utils.requires_ext(extension='quota-check-limit-default', + service='network') + def test_quotas_force_false(self): + project_id = self.create_project()['id'] + self._create_network(project_id) + + new_quotas = {'network': 0} + # force=false (by default) + self.assertRaises(lib_exc.BadRequest, self.admin_client.update_quotas, + project_id, **new_quotas) + + new_quotas['network'] = 100 + quota_set = self._setup_quotas(project_id, **new_quotas) + self.assertEqual(new_quotas['network'], quota_set['network']) + @decorators.idempotent_id('e974b5ba-090a-452c-a578-f9710151d9fc') @decorators.attr(type='gate') @utils.requires_ext(extension="quota_details", service="network") diff --git a/neutron_tempest_plugin/api/test_security_groups.py b/neutron_tempest_plugin/api/test_security_groups.py index 5e8b18ef..69923992 100644 --- a/neutron_tempest_plugin/api/test_security_groups.py +++ b/neutron_tempest_plugin/api/test_security_groups.py @@ -281,9 +281,10 @@ class BaseSecGroupQuota(base.BaseAdminNetworkTest): def _set_quota(self, val, resource): res_quota = self._get_quota(resource) project_id = self.client.project_id - self.admin_client.update_quotas(project_id, **{resource: val}) + self.admin_client.update_quotas(project_id, **{resource: val, + 'force': True}) self.addCleanup(self.admin_client.update_quotas, - project_id, **{resource: res_quota}) + project_id, **{resource: res_quota, 'force': True}) def _get_quota(self, resource): project_id = self.client.project_id @@ -383,7 +384,8 @@ class BaseSecGroupRulesQuota(base.BaseAdminNetworkTest): def _set_sg_rules_quota(self, val): project_id = self.client.project_id self.admin_client.update_quotas(project_id, - **{'security_group_rule': val}) + **{'security_group_rule': val, + 'force': True}) LOG.info('Trying to update security group rule quota {} '.format(val)) def _get_sg_rules_quota(self): @@ -435,7 +437,8 @@ class SecGroupRulesQuotaTest(BaseSecGroupRulesQuota): sg_rules_quota = self._get_sg_rules_quota() project_id = self.client.project_id self.addCleanup(self.admin_client.update_quotas, - project_id, **{'security_group_rule': sg_rules_quota}) + project_id, **{'security_group_rule': sg_rules_quota, + 'force': True}) values = [-1, 0, 10, 2147483647] for value in values: self._set_sg_rules_quota(value)