Skip to content

Commit 8d0f08a

Browse files
author
Prasanna Santhanam
committed
Egress Rules: Corrections to few areas
1. correcting the log_test_exceptions decorator so nose testrunner can detect and document the running test 2. correct the wait for network cleanup -> network.gc 3. Remove commented skips 4. Sanitize host passwords Signed-off-by: Prasanna Santhanam <tsp@apache.org>
1 parent c1f8dc9 commit 8d0f08a

1 file changed

Lines changed: 21 additions & 24 deletions

File tree

‎test/integration/component/test_egress_fw_rules.py‎

Lines changed: 21 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -43,15 +43,14 @@
4343
import time
4444

4545
def log_test_exceptions(func):
46-
"""
47-
"""
48-
def _log_test_exceptions(self, *args, **kwargs):
46+
def test_wrap_exception_log(self, *args, **kwargs):
4947
try:
5048
func(self, *args, **kwargs)
5149
except Exception as e:
5250
self.debug('Test %s Failed due to Exception=%s' % (func, e))
5351
raise e
54-
return _log_test_exceptions
52+
test_wrap_exception_log.__doc__ = func.__doc__
53+
return test_wrap_exception_log
5554

5655
class Services:
5756
"""Test service data: Egress Firewall rules Tests for Advance Zone.
@@ -75,7 +74,7 @@ def __init__(self):
7574
"username" : "User",
7675
# Random characters are appended for unique
7776
# username
78-
"password" : "fr3sca",},
77+
"password" : "password",},
7978
"project" : {"name" : "Project",
8079
"displaytext" : "Test project",},
8180
"volume" : {"diskname" : "TestDiskServ",
@@ -130,7 +129,7 @@ def __init__(self):
130129
},
131130
"sleep" : 30,
132131
"ostype": 'CentOS 5.3 (64-bit)',
133-
"host_password": 'fr3sca',
132+
"host_password": 'password',
134133
}
135134

136135
class TestEgressFWRules(cloudstackTestCase):
@@ -203,7 +202,7 @@ def create_network_offering(self, egress_policy=True, RR=False):
203202
self.network_offering.update(self.apiclient, state='Enabled')
204203

205204

206-
def create_vm(self, networkid = None, pfrule=False, egress_policy=True, RR=False):
205+
def create_vm(self, pfrule=False, egress_policy=True, RR=False):
207206
self.create_network_offering(egress_policy, RR)
208207
# Creating network using the network offering created
209208
self.debug("Creating network with network offering: %s" %
@@ -295,7 +294,7 @@ def exec_script_on_user_vm(self, script, exec_cmd_params, expected_result, negat
295294

296295
exec_success = False
297296
if str(result).strip() == expected_result:
298-
self.debug('script executed succesfully exec_success=True')
297+
self.debug('script executed successfully exec_success=True')
299298
exec_success = True
300299

301300
ssh.execute('rm -rf %s' % script_file)
@@ -372,15 +371,14 @@ def tearDown(self):
372371
self.debug("Sleep for VM cleanup to complete.")
373372
time.sleep(self.services['sleep'])
374373
self.network.delete(self.apiclient)
375-
wait_for_cleanup(self.apiclient, ["expunge.interval", "expunge.delay"])
374+
wait_for_cleanup(self.apiclient, ["network.gc.wait", "network.gc.interval"])
376375
self.debug("Sleep for Network cleanup to complete.")
377376
time.sleep(self.services['sleep'])
378377
cleanup_resources(self.apiclient, reversed(self.cleanup))
379378
self.debug("Cleanup complete!")
380379
except Exception as e:
381380
self.debug("Warning! Exception in tearDown: %s" % e)
382381

383-
#@unittest.skip("Skip")
384382
@attr(tags = ["advanced"])
385383
@log_test_exceptions
386384
def test_01_egress_fr1(self):
@@ -397,7 +395,7 @@ def test_01_egress_fr1(self):
397395
"['0']",
398396
negative_test=False)
399397

400-
#@unittest.skip("Skip")
398+
401399
@attr(tags = ["advanced"])
402400
@log_test_exceptions
403401
def test_01_1_egress_fr1(self):
@@ -414,7 +412,7 @@ def test_01_1_egress_fr1(self):
414412
"['100']",
415413
negative_test=False)
416414

417-
#@unittest.skip("Skip")
415+
418416
@attr(tags = ["advanced"])
419417
@log_test_exceptions
420418
def test_02_egress_fr2(self):
@@ -452,7 +450,6 @@ def test_02_1_egress_fr2(self):
452450
negative_test=False)
453451

454452

455-
##@unittest.skip("Skip")
456453
@attr(tags = ["advanced"])
457454
@log_test_exceptions
458455
def test_03_egress_fr3(self):
@@ -497,7 +494,7 @@ def test_03_1_egress_fr3(self):
497494
"['failed:']",
498495
negative_test=False)
499496

500-
#@unittest.skip("Skip")
497+
501498
@attr(tags = ["advanced"])
502499
@log_test_exceptions
503500
def test_04_egress_fr4(self):
@@ -574,7 +571,7 @@ def test_04_1_egress_fr4(self):
574571
"DB results not matching")
575572

576573

577-
#@unittest.skip("Skip")
574+
578575
@attr(tags = ["advanced"])
579576
@log_test_exceptions
580577
def test_05_egress_fr5(self):
@@ -593,7 +590,7 @@ def test_05_egress_fr5(self):
593590
self.createEgressRule()
594591
#TODO: Query VR for expected route rules.
595592

596-
#@unittest.skip("Skip")
593+
597594
@attr(tags = ["advanced"])
598595
@log_test_exceptions
599596
def test_05_1_egress_fr5(self):
@@ -612,7 +609,7 @@ def test_05_1_egress_fr5(self):
612609
self.createEgressRule()
613610
#TODO: Query VR for expected route rules.
614611

615-
#@unittest.skip("Skip")
612+
616613
@attr(tags = ["advanced"])
617614
@log_test_exceptions
618615
def test_06_egress_fr6(self):
@@ -648,7 +645,7 @@ def test_06_1_egress_fr6(self):
648645
negative_test=False)
649646

650647

651-
#@unittest.skip("Skip")
648+
652649
@attr(tags = ["advanced"])
653650
@log_test_exceptions
654651
def test_07_egress_fr7(self):
@@ -683,7 +680,7 @@ def test_07_1_egress_fr7(self):
683680
"['failed:']",
684681
negative_test=False)
685682

686-
#@unittest.skip("Skip")
683+
687684
@attr(tags = ["advanced"])
688685
@log_test_exceptions
689686
def test_08_egress_fr8(self):
@@ -708,7 +705,7 @@ def test_08_1_egress_fr8(self):
708705
self.create_vm(pfrule=True, egress_policy=False)
709706
self.createEgressRule()
710707

711-
#@unittest.skip("Skip")
708+
712709
@attr(tags = ["advanced"])
713710
@log_test_exceptions
714711
def test_09_egress_fr9(self):
@@ -759,7 +756,7 @@ def test_09_1_egress_fr9(self):
759756
"['100']",
760757
negative_test=False)
761758

762-
#@unittest.skip("Skip")
759+
763760
@attr(tags = ["advanced"])
764761
@log_test_exceptions
765762
def test_10_egress_fr10(self):
@@ -784,7 +781,7 @@ def test_10_1_egress_fr10(self):
784781
self.create_vm(egress_policy=False)
785782
self.assertRaises(Exception, self.createEgressRule, '10.2.2.0/24')
786783

787-
#@unittest.skip("Skip")
784+
788785
@attr(tags = ["advanced"])
789786
@log_test_exceptions
790787
def test_11_egress_fr11(self):
@@ -807,7 +804,7 @@ def test_11_1_egress_fr11(self):
807804
# 3. All should work fine.
808805
self.create_vm(pfrule=True, egress_policy=False)
809806

810-
#@unittest.skip("Skip")
807+
811808
@attr(tags = ["advanced"])
812809
@log_test_exceptions
813810
def test_12_egress_fr12(self):
@@ -844,7 +841,7 @@ def test_12_1_egress_fr12(self):
844841
"['0']",
845842
negative_test=False)
846843

847-
#@unittest.skip("Skip")
844+
848845
@attr(tags = ["advanced"])
849846
@log_test_exceptions
850847
def test_13_egress_fr13(self):

0 commit comments

Comments
 (0)