Make test_detail_quota() test more generic
Backends such as OVN will create a port to be used by the metadata agent upon creating a network. That port will be substract from the tenant's quota and that was what was previsouly causing this test to fail in OVN. This patch is changing the approach to make it more generic by calculating the number of used ports based on the number existent after the network is created and prior to the new port being created. A similar approach was used in the patch https://review.openstack.org/#/c/559758/ for the same reason. Change-Id: I952d31c4473159a3fdd0552eeae98750ee27a1f9
This commit is contained in:
parent
02a5e2b076
commit
3d3320716d
|
@ -121,17 +121,26 @@ class QuotasTest(QuotasTestBase):
|
|||
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)
|
||||
|
|
Loading…
Reference in New Issue