Merge "Make test_detail_quota() test more generic"
diff --git a/neutron_tempest_plugin/api/admin/test_quotas.py b/neutron_tempest_plugin/api/admin/test_quotas.py
index 1acfc18..ae773c8 100644
--- a/neutron_tempest_plugin/api/admin/test_quotas.py
+++ b/neutron_tempest_plugin/api/admin/test_quotas.py
@@ -121,17 +121,26 @@
new_quotas = {'network': {'used': 1, 'limit': 2, 'reserved': 0},
'port': {'used': 1, 'limit': 2, 'reserved': 0}}
- # update quota limit for tenant
- new_quota = {'network': new_quotas['network']['limit'], 'port':
- new_quotas['port']['limit']}
- quota_set = self._setup_quotas(tenant_id, **new_quota)
-
# create test resources
network = self._create_network(tenant_id)
post_body = {"network_id": network['id'],
"tenant_id": tenant_id}
+
+ # NOTE(lucasagomes): Some backends such as OVN will create a port
+ # to be used by the metadata agent upon creating a network. In
+ # order to make this test more generic we need to calculate the
+ # number of expected used ports after the network is created and
+ # prior for the port being created
+ ports = self.admin_client.list_ports(tenant_id=tenant_id)
+ new_quotas['port']['used'] += len(ports['ports'])
+
self._create_port(**post_body)
+ # update quota limit for tenant
+ new_quota = {'network': new_quotas['network']['limit'], 'port':
+ new_quotas['port']['limit']}
+ quota_set = self._setup_quotas(tenant_id, **new_quota)
+
# confirm from extended API quotas were changed
# as requested for tenant
quota_set = self.admin_client.show_details_quota(tenant_id)