Repository: cloudstack Updated Branches: refs/heads/master c841d6850 -> 66d51c91e
Made misc changes Reviewed-By: Shweta Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/66d51c91 Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/66d51c91 Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/66d51c91 Branch: refs/heads/master Commit: 66d51c91ea452b786077d28e92f7a4af52cd0efc Parents: c841d68 Author: Sanjeev Neelarapu <sanjeev.neelar...@citrix.com> Authored: Tue Jun 23 17:18:03 2015 +0530 Committer: sanjeev <sanj...@apache.org> Committed: Tue Jun 23 17:47:19 2015 +0530 ---------------------------------------------------------------------- .../component/test_security_groups.py | 42 ++++++++++++-------- 1 file changed, 25 insertions(+), 17 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/cloudstack/blob/66d51c91/test/integration/component/test_security_groups.py ---------------------------------------------------------------------- diff --git a/test/integration/component/test_security_groups.py b/test/integration/component/test_security_groups.py old mode 100644 new mode 100755 index 2a37fd8..f132e3a --- a/test/integration/component/test_security_groups.py +++ b/test/integration/component/test_security_groups.py @@ -39,6 +39,7 @@ from marvin.codes import PASS import time import subprocess import socket +import platform class TestDefaultSecurityGroup(cloudstackTestCase): @@ -1338,9 +1339,13 @@ class TestIngressRule(cloudstackTestCase): # User should be able to ping VM try: self.debug("Trying to ping VM %s" % self.virtual_machine.ssh_ip) - result = subprocess.call( - ['ping', '-c 1', self.virtual_machine.ssh_ip]) - + platform_type = platform.system().lower() + if platform_type == 'windows': + result = subprocess.call( + ['ping', '-n', '1', self.virtual_machine.ssh_ip]) + else: + result = subprocess.call( + ['ping', '-c 1', self.virtual_machine.ssh_ip]) self.debug("Ping result: %s" % result) # if ping successful, then result should be 0 self.assertEqual( @@ -1462,9 +1467,13 @@ class TestIngressRule(cloudstackTestCase): # User should be able to ping VM try: self.debug("Trying to ping VM %s" % self.virtual_machine.ssh_ip) - result = subprocess.call( - ['ping', '-c 1', self.virtual_machine.ssh_ip]) - + platform_type = platform.system().lower() + if platform_type == 'windows': + result = subprocess.call( + ['ping', '-n', '1', self.virtual_machine.ssh_ip]) + else: + result = subprocess.call( + ['ping', '-c 1', self.virtual_machine.ssh_ip]) self.debug("Ping result: %s" % result) # if ping successful, then result should be 0 self.assertEqual( @@ -1472,30 +1481,30 @@ class TestIngressRule(cloudstackTestCase): 0, "Check if ping is successful or not" ) - except Exception as e: self.fail("Ping failed for ingress rule ID: %s, %s" % (icmp_rule["ruleid"], e)) - self.debug( "Revoke Ingress Rule for Security Group %s for account: %s" % ( security_group.id, self.account.name )) - result = security_group.revoke( self.apiclient, id=icmp_rule["ruleid"] ) self.debug("Revoke ingress rule result: %s" % result) - time.sleep(self.testdata["sleep"]) # User should not be able to ping VM try: self.debug("Trying to ping VM %s" % self.virtual_machine.ssh_ip) - result = subprocess.call( - ['ping', '-c 1', self.virtual_machine.ssh_ip]) + if platform_type == 'windows': + result = subprocess.call( + ['ping', '-n', '1', self.virtual_machine.ssh_ip]) + else: + result = subprocess.call( + ['ping', '-c 1', self.virtual_machine.ssh_ip]) self.debug("Ping result: %s" % result) # if ping successful, then result should be 0 @@ -1504,7 +1513,6 @@ class TestIngressRule(cloudstackTestCase): 0, "Check if ping is successful or not" ) - except Exception as e: self.fail("Ping failed for ingress rule ID: %s, %s" % (icmp_rule["ruleid"], e)) @@ -1816,7 +1824,7 @@ class TestIngressRuleSpecificIpSet(cloudstackTestCase): ) except Exception as e: self.fail("SSH Access failed for %s: %s" % - (self.virtual_machine.ipaddress, e) + (virtual_machine_1.ipaddress, e) ) try: @@ -1828,7 +1836,7 @@ class TestIngressRuleSpecificIpSet(cloudstackTestCase): ) except Exception as e: self.fail("SSH Access failed for %s: %s" % - (self.virtual_machine.ipaddress, e) + (virtual_machine_2.ipaddress, e) ) sshClient = SshClient( @@ -1991,7 +1999,7 @@ class TestIngressRuleSpecificIpSet(cloudstackTestCase): ) except Exception as e: self.fail("SSH Access failed for %s: %s" % - (self.virtual_machine.ipaddress, e) + (virtual_machine_1.ipaddress, e) ) try: @@ -2003,7 +2011,7 @@ class TestIngressRuleSpecificIpSet(cloudstackTestCase): ) except Exception as e: self.fail("SSH Access failed for %s: %s" % - (self.virtual_machine.ipaddress, e) + (virtual_machine_2.ipaddress, e) ) sshClient = SshClient(