Skip to content

Commit 7d6b4a4

Browse files
author
Prasanna Santhanam
committed
Fix vpc network tests and reduce delay by removing wait for cleanup
CIDR dictionary changes in the test causing the subsequent test to fail. Reinitialize the dictionary at the beginning of the test Signed-off-by: Prasanna Santhanam <tsp@apache.org>
1 parent ffcd693 commit 7d6b4a4

2 files changed

Lines changed: 20 additions & 82 deletions

File tree

test/integration/component/test_vpc.py

Lines changed: 11 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -202,7 +202,6 @@ def setUpClass(cls):
202202
cls.vpc_off.update(cls.api_client, state='Enabled')
203203
cls._cleanup = [
204204
cls.service_offering,
205-
cls.vpc_off
206205
]
207206
return
208207

@@ -435,7 +434,7 @@ def test_03_delete_vpc_no_networks(self):
435434

436435
@attr(tags=["advanced", "intervlan"])
437436
def test_04_delete_vpc_with_networks(self):
438-
""" Test delete VPC having with networks
437+
""" Test delete VPC having networks
439438
"""
440439

441440
# Validate the following
@@ -757,7 +756,7 @@ def test_06_list_vpc_apis_admin(self):
757756
self.apiclient,
758757
self.services["account"],
759758
)
760-
self.cleanup.append(self.user)
759+
self._cleanup.append(self.user)
761760

762761
self.services["vpc"]["cidr"] = "10.1.1.1/16"
763762
self.debug("creating a VPC network in the account: %s" %
@@ -1841,7 +1840,7 @@ def test_12_deploy_vm_with_netdomain(self):
18411840

18421841
@attr(tags=["advanced", "intervlan"])
18431842
def test_13_deploy_vm_with_vpc_netdomain(self):
1844-
""" Test deployment of vm in a VPC with netdomain
1843+
""" Test deployment of vm in a VPC with network domain
18451844
"""
18461845

18471846
# 1. Create VPC with providing networkDomain.
@@ -1918,7 +1917,7 @@ def test_14_deploy_vm_1(self):
19181917
self.services["account"]
19191918
)
19201919
self.debug("Created account: %s" % user.name)
1921-
self.cleanup.append(user)
1920+
self._cleanup.append(user)
19221921

19231922
self.services["vpc"]["cidr"] = "10.1.1.1/16"
19241923
self.debug("creating a VPC network in the account: %s" %
@@ -1999,7 +1998,7 @@ def test_15_deploy_vm_2(self):
19991998
self.services["account"]
20001999
)
20012000
self.debug("Created account: %s" % user.name)
2002-
self.cleanup.append(user)
2001+
self._cleanup.append(user)
20032002

20042003
self.services["vpc"]["cidr"] = "10.1.1.1/16"
20052004
self.debug("creating a VPC network in the account: %s" %
@@ -2075,7 +2074,7 @@ def test_16_deploy_vm_for_user_by_admin(self):
20752074
self.services["account"]
20762075
)
20772076
self.debug("Created account: %s" % user.name)
2078-
self.cleanup.append(user)
2077+
self._cleanup.append(user)
20792078

20802079
self.services["vpc"]["cidr"] = "10.1.1.1/16"
20812080
self.debug("creating a VPC network in the account: %s" %
@@ -2159,7 +2158,7 @@ def test_17_deploy_vm_for_user_by_domain_admin(self):
21592158
self.services["domain_admin"]
21602159
)
21612160
self.debug("Created account: %s" % domain_admin.name)
2162-
self.cleanup.append(domain_admin)
2161+
self._cleanup.append(domain_admin)
21632162
da_apiclient = self.testClient.getUserApiClient(
21642163
account=domain_admin.name,
21652164
domain=domain_admin.domain,
@@ -2170,7 +2169,7 @@ def test_17_deploy_vm_for_user_by_domain_admin(self):
21702169
self.services["account"]
21712170
)
21722171
self.debug("Created account: %s" % user.name)
2173-
self.cleanup.append(user)
2172+
self._cleanup.append(user)
21742173

21752174
self.services["vpc"]["cidr"] = "10.1.1.1/16"
21762175
self.debug("creating a VPC network in the account: %s" %
@@ -2194,8 +2193,7 @@ def test_17_deploy_vm_for_user_by_domain_admin(self):
21942193

21952194
@attr(tags=["advanced", "intervlan"])
21962195
def test_18_create_net_for_user_diff_domain_by_doadmin(self):
2197-
""" Test creation of network by domain admin for user from different
2198-
domain.
2196+
""" Test creation of network by domain admin for user from different domain
21992197
"""
22002198

22012199
#1. As domain admin account , Create VPC(name,zoneId,cidr,vpcOfferingId,networkDomain) without passing Account/domain ID.
@@ -2211,7 +2209,7 @@ def test_18_create_net_for_user_diff_domain_by_doadmin(self):
22112209
self.services["domain_admin"]
22122210
)
22132211
self.debug("Created account: %s" % domain_admin.name)
2214-
self.cleanup.append(domain_admin)
2212+
self._cleanup.append(domain_admin)
22152213
da_apiclient = self.testClient.getUserApiClient(
22162214
account=domain_admin.name,
22172215
domain=self.services["domain"]["name"],
@@ -2222,7 +2220,7 @@ def test_18_create_net_for_user_diff_domain_by_doadmin(self):
22222220
self.services["account"]
22232221
)
22242222
self.debug("Created account: %s" % user.name)
2225-
self.cleanup.append(user)
2223+
self._cleanup.append(user)
22262224

22272225
self.services["vpc"]["cidr"] = "10.1.1.1/16"
22282226
self.debug("creating a VPC network in the account: %s" %

test/integration/component/test_vpc_network.py

Lines changed: 9 additions & 69 deletions
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,6 @@ def __init__(self):
7272
},
7373
"serviceCapabilityList": {
7474
"SourceNat": {"SupportedSourceNatTypes": "peraccount"},
75-
"Lb": {"lbSchemes": "public", "SupportedLbIsolation": "dedicated"}
7675
},
7776
},
7877
"network_off_netscaler": {
@@ -95,7 +94,6 @@ def __init__(self):
9594
},
9695
"serviceCapabilityList": {
9796
"SourceNat": {"SupportedSourceNatTypes": "peraccount"},
98-
"Lb": {"lbSchemes": "public", "SupportedLbIsolation": "dedicated"}
9997
},
10098
},
10199
"network_off_shared": {
@@ -229,25 +227,7 @@ def setUp(self):
229227
admin=True,
230228
domainid=self.domain.id
231229
)
232-
self.cleanup = [self.account]
233-
return
234-
235-
def tearDown(self):
236-
try:
237-
#Clean up, terminate the created network offerings
238-
cleanup_resources(self.apiclient, self.cleanup)
239-
interval = list_configurations(
240-
self.apiclient,
241-
name='network.gc.interval'
242-
)
243-
wait = list_configurations(
244-
self.apiclient,
245-
name='network.gc.wait'
246-
)
247-
# Sleep to ensure that all resources are deleted
248-
time.sleep(int(interval[0].value) + int(wait[0].value))
249-
except Exception as e:
250-
raise Exception("Warning: Exception during cleanup : %s" % e)
230+
self._cleanup.insert(0, self.account)
251231
return
252232

253233
def validate_vpc_offering(self, vpc_offering):
@@ -394,7 +374,7 @@ def test_01_create_network(self):
394374

395375
@attr(tags=["advanced", "intervlan"])
396376
def test_02_create_network_fail(self):
397-
""" Test create network in VPC
377+
""" Test create network in VPC mismatched services (Should fail)
398378
"""
399379

400380
# Validate the following
@@ -712,7 +692,7 @@ def test_05_create_network_ext_LB(self):
712692

713693
@attr(tags=["advanced", "intervlan"])
714694
def test_06_create_network_with_rvr(self):
715-
""" Test create network with eredundant router capability
695+
""" Test create network with redundant router capability
716696
"""
717697

718698
# Validate the following
@@ -1094,25 +1074,7 @@ def setUp(self):
10941074
admin=True,
10951075
domainid=self.domain.id
10961076
)
1097-
self.cleanup = [self.account]
1098-
return
1099-
1100-
def tearDown(self):
1101-
try:
1102-
#Clean up, terminate the created network offerings
1103-
cleanup_resources(self.apiclient, self.cleanup)
1104-
interval = list_configurations(
1105-
self.apiclient,
1106-
name='network.gc.interval'
1107-
)
1108-
wait = list_configurations(
1109-
self.apiclient,
1110-
name='network.gc.wait'
1111-
)
1112-
# Sleep to ensure that all resources are deleted
1113-
time.sleep(int(interval[0].value) + int(wait[0].value))
1114-
except Exception as e:
1115-
raise Exception("Warning: Exception during cleanup : %s" % e)
1077+
self._cleanup.insert(0, self.account)
11161078
return
11171079

11181080
def validate_vpc_offering(self, vpc_offering):
@@ -1365,6 +1327,7 @@ def test_04_create_network_overlapping_range(self):
13651327
# 3. Add network2 with cidr - 10.1.1.1/24 to this VPC
13661328
# 4. Add network3 with cidr - 10.1.1.1/26 to this VPC
13671329
# 5. Network creation in step 3 & 4 should fail.
1330+
self.services = Services().services
13681331

13691332
self.debug("Creating a VPC offering")
13701333
vpc_off = VpcOffering.create(
@@ -1606,19 +1569,7 @@ def setUp(self):
16061569
admin=True,
16071570
domainid=self.domain.id
16081571
)
1609-
self.cleanup = [self.account]
1610-
return
1611-
1612-
def tearDown(self):
1613-
try:
1614-
#Clean up, terminate the created network offerings
1615-
cleanup_resources(self.apiclient, self.cleanup)
1616-
wait_for_cleanup(self.apiclient, [
1617-
"network.gc.interval",
1618-
"network.gc.wait"])
1619-
1620-
except Exception as e:
1621-
raise Exception("Warning: Exception during cleanup : %s" % e)
1572+
self._cleanup.insert(0, self.account)
16221573
return
16231574

16241575
def validate_vpc_offering(self, vpc_offering):
@@ -1673,8 +1624,7 @@ def validate_vpc_network(self, network, state=None):
16731624

16741625
@attr(tags=["advanced", "intervlan"])
16751626
def test_01_network_services_upgrade(self):
1676-
""" Test update Network that is part of a VPC to a network offering
1677-
that has more services.
1627+
""" Test update Network that is part of a VPC to a network offering that has more services
16781628
"""
16791629

16801630
# Validate the following
@@ -2027,8 +1977,7 @@ def test_01_network_services_upgrade(self):
20271977

20281978
@attr(tags=["advanced", "intervlan"])
20291979
def test_02_network_vpcvr2vr_upgrade(self):
2030-
""" Test update Network that is NOT part of a VPC to a nw offering
2031-
that has services that are provided by VPCVR and vice versa.
1980+
""" Test update Network that is NOT part of a VPC to a nw offering that has services that are provided by VPCVR and vice versa
20321981
"""
20331982

20341983
# Validate the following
@@ -2298,7 +2247,6 @@ def setUp(self):
22982247
cmd = stopVirtualMachine.stopVirtualMachineCmd()
22992248
cmd.id = vm.id
23002249
self.apiclient.stopVirtualMachine(cmd)
2301-
self.cleanup = []
23022250
return
23032251

23042252
def tearDown(self):
@@ -2311,15 +2259,7 @@ def tearDown(self):
23112259
)
23122260
for vm in vms:
23132261
if vm.state == "Stopped":
2314-
cmd = startVirtualMachine.startVirtualMachineCmd()
2315-
cmd.id = vm.id
2316-
self.apiclient.startVirtualMachine(cmd)
2317-
2318-
try:
2319-
#Clean up, terminate the created network offerings
2320-
cleanup_resources(self.apiclient, self.cleanup)
2321-
except Exception as e:
2322-
raise Exception("Warning: Exception during cleanup : %s" % e)
2262+
vm.start(self.apiclient)
23232263
return
23242264

23252265
def validate_vpc_offering(self, vpc_offering):

0 commit comments

Comments
 (0)