Cleanup Security Group rules after TC execution
Security group rules created by SecGroupRulesQuotaTest are not being cleaned up after TC execution. Security Group rules normally would get cleanup if associated Security Group is deleted. However, SecGroupRulesQuotaTest doesn't create any Security Groups. The Security Group rules are created in default or existing Security Groups. Thus, the SecGroupRulesQuotaTest should be responsible to clean up the rules which created by the TC. Change-Id: I4dd2d9eb7e60101ba7f5c3d915ec27ee6c46b227
This commit is contained in:
parent
9c59654902
commit
70be7accfd
|
@ -240,12 +240,14 @@ class BaseSecGroupRulesQuota(base.BaseAdminNetworkTest):
|
|||
|
||||
def _create_security_group_rules(self, amount, port_index=1):
|
||||
for i in range(amount):
|
||||
self.create_security_group_rule(**{
|
||||
ingress_rule = self.create_security_group_rule(**{
|
||||
'project_id': self.client.tenant_id,
|
||||
'direction': 'ingress',
|
||||
'port_range_max': port_index + i,
|
||||
'port_range_min': port_index + i,
|
||||
'protocol': 'tcp'})
|
||||
self.addCleanup(
|
||||
self.client.delete_security_group_rule, ingress_rule['id'])
|
||||
|
||||
def _increase_sg_rules_quota(self):
|
||||
sg_rules_quota = self._get_sg_rules_quota()
|
||||
|
|
Loading…
Reference in New Issue