Browse Source

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
changes/84/308384/3
Victor Stinner 5 years ago
committed by Brandon Logan
parent
commit
c5cbd394e1
  1. 12
      neutron_lbaas/tests/tempest/v1/api/admin/test_quotas.py

12
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])

Loading…
Cancel
Save