From 47104cf2b359800be55b34a546a7085a67add86b Mon Sep 17 00:00:00 2001 From: Paul Angus Date: Mon, 26 Sep 2016 12:08:41 +0100 Subject: [PATCH] fix ping tests to properly recognise successful ping test --- test/integration/smoke/test_password_server.py | 4 ++-- test/integration/smoke/test_router_dhcphosts.py | 4 ++-- test/integration/smoke/test_routers_network_ops.py | 8 ++++---- test/integration/smoke/test_vpc_redundant.py | 4 ++-- test/integration/smoke/test_vpc_router_nics.py | 4 ++-- 5 files changed, 12 insertions(+), 12 deletions(-) diff --git a/test/integration/smoke/test_password_server.py b/test/integration/smoke/test_password_server.py index c10478fe590..a85bd5488b1 100644 --- a/test/integration/smoke/test_password_server.py +++ b/test/integration/smoke/test_password_server.py @@ -180,12 +180,12 @@ class TestIsolatedNetworksPasswdServer(cloudstackTestCase): ssh = vm.get_ssh_client(ipaddress=nat_rule.ipaddress, port=self.services[rule_label]["publicport"], retries=5) result = str(ssh.execute(ssh_command)) - self.logger.debug("SSH result: %s; COUNT is ==> %s" % (result, result.count("3 packets received"))) + self.logger.debug("SSH result: %s; COUNT is ==> %s" % (result, result.count(" 0% packet loss"))) except: self.fail("Failed to SSH into VM - %s" % (nat_rule.ipaddress)) self.assertEqual( - result.count("3 packets received"), + result.count(" 0% packet loss"), 1, "Ping to outside world from VM should be successful" ) diff --git a/test/integration/smoke/test_router_dhcphosts.py b/test/integration/smoke/test_router_dhcphosts.py index 1681674a289..c90599bfc38 100644 --- a/test/integration/smoke/test_router_dhcphosts.py +++ b/test/integration/smoke/test_router_dhcphosts.py @@ -188,12 +188,12 @@ class TestRouterDHCPHosts(cloudstackTestCase): ssh = vm.get_ssh_client(ipaddress=nat_rule.ipaddress, port=self.services[rule_label]["publicport"], retries=5) result = str(ssh.execute(ssh_command)) - self.logger.debug("SSH result: %s; COUNT is ==> %s" % (result, result.count("3 packets received"))) + self.logger.debug("SSH result: %s; COUNT is ==> %s" % (result, result.count(" 0% packet loss"))) except: self.fail("Failed to SSH into VM - %s" % (nat_rule.ipaddress)) self.assertEqual( - result.count("3 packets received"), + result.count(" 0% packet loss"), 1, "Ping to outside world from VM should be successful" ) diff --git a/test/integration/smoke/test_routers_network_ops.py b/test/integration/smoke/test_routers_network_ops.py index 94c07742ad1..a15150d40a2 100644 --- a/test/integration/smoke/test_routers_network_ops.py +++ b/test/integration/smoke/test_routers_network_ops.py @@ -270,7 +270,7 @@ class TestRedundantIsolateNetworks(cloudstackTestCase): # Test SSH after closing port 22 expected = 1 ssh_command = "ping -c 3 8.8.8.8" - check_string = "3 packets received" + check_string = " 0% packet loss" result = check_router_command(virtual_machine, nat_rule.ipaddress, ssh_command, check_string, self) self.assertEqual( @@ -434,7 +434,7 @@ class TestRedundantIsolateNetworks(cloudstackTestCase): expected = 0 ssh_command = "ping -c 3 8.8.8.8" - check_string = "3 packets received" + check_string = " 0% packet loss" result = check_router_command(virtual_machine, nat_rule.ipaddress, ssh_command, check_string, self) self.assertEqual( @@ -822,7 +822,7 @@ class TestIsolatedNetworks(cloudstackTestCase): # Test SSH after closing port 22 expected = 1 ssh_command = "ping -c 3 8.8.8.8" - check_string = "3 packets received" + check_string = " 0% packet loss" result = check_router_command(virtual_machine, nat_rule.ipaddress, ssh_command, check_string, self) self.assertEqual( @@ -977,7 +977,7 @@ class TestIsolatedNetworks(cloudstackTestCase): expected = 0 ssh_command = "ping -c 3 8.8.8.8" - check_string = "3 packets received" + check_string = " 0% packet loss" result = check_router_command(virtual_machine, nat_rule.ipaddress, ssh_command, check_string, self) self.assertEqual( diff --git a/test/integration/smoke/test_vpc_redundant.py b/test/integration/smoke/test_vpc_redundant.py index fbaa5b96e6c..9e4038a32d6 100644 --- a/test/integration/smoke/test_vpc_redundant.py +++ b/test/integration/smoke/test_vpc_redundant.py @@ -695,14 +695,14 @@ class TestVPCRedundancy(cloudstackTestCase): self.logger.debug("Ping to google.com from VM") result = str(ssh.execute(ssh_command)) - self.logger.debug("SSH result: %s; COUNT is ==> %s" % (result, result.count("3 packets received"))) + self.logger.debug("SSH result: %s; COUNT is ==> %s" % (result, result.count(" 0% packet loss"))) except Exception as e: self.fail("SSH Access failed for %s: %s" % \ (vmObj.get_ip(), e) ) self.assertEqual( - result.count("3 packets received"), + result.count(" 0% packet loss"), 1, "Ping to outside world from VM should be successful" ) diff --git a/test/integration/smoke/test_vpc_router_nics.py b/test/integration/smoke/test_vpc_router_nics.py index cb0734d9930..39a92144438 100644 --- a/test/integration/smoke/test_vpc_router_nics.py +++ b/test/integration/smoke/test_vpc_router_nics.py @@ -464,14 +464,14 @@ class TestVPCNics(cloudstackTestCase): self.logger.debug("Ping to google.com from VM") result = str(ssh.execute(ssh_command)) - self.logger.debug("SSH result: %s; COUNT is ==> %s" % (result, result.count("3 packets received"))) + self.logger.debug("SSH result: %s; COUNT is ==> %s" % (result, result.count(" 0% packet loss"))) except Exception as e: self.fail("SSH Access failed for %s: %s" % \ (vmObj.get_ip(), e) ) self.assertEqual( - result.count("3 packets received"), + result.count(" 0% packet loss"), 1, "Ping to outside world from VM should be successful" )