From c5cbd394e1aca10d915272c3e787129949e9f6a2 Mon Sep 17 00:00:00 2001 From: Victor Stinner Date: Wed, 20 Apr 2016 16:46:27 +0200 Subject: [PATCH] Fix test_quotas The change I1cd91b5e06bd17f9aac97bba71228f2e5c48879b modified the delete_tenant_quota() function: it now raises a NotFound error if delete failed. Fix the test: catch and ignore the NotFound exception. The test removes the quota by reseting quotas of the tenant. Change-Id: I87df52474014c4bceff8124a627f829f6b625ce0 Closes-Bug: #1572592 --- .../tests/tempest/v1/api/admin/test_quotas.py | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/neutron_lbaas/tests/tempest/v1/api/admin/test_quotas.py b/neutron_lbaas/tests/tempest/v1/api/admin/test_quotas.py index 487554bcb..bdd2cc634 100644 --- a/neutron_lbaas/tests/tempest/v1/api/admin/test_quotas.py +++ b/neutron_lbaas/tests/tempest/v1/api/admin/test_quotas.py @@ -14,8 +14,9 @@ # License for the specific language governing permissions and limitations # under the License. -from tempest import test from tempest.lib.common.utils import data_utils +from tempest.lib import exceptions +from tempest import test from neutron_lbaas.tests.tempest.v1.api import base @@ -59,7 +60,14 @@ class QuotasTest(base.BaseAdminNetworkTest): # Change quotas for tenant quota_set = self.admin_client.update_quotas(tenant_id, **new_quotas) - self.addCleanup(self.admin_client.reset_quotas, tenant_id) + + def safe_reset_quotas(tenant_id): + try: + self.admin_client.reset_quotas(tenant_id) + except exceptions.NotFound: + pass + + self.addCleanup(safe_reset_quotas, tenant_id) for key, value in new_quotas.items(): self.assertEqual(value, quota_set[key])