mirror of https://github.com/apache/cloudstack.git
fix ping tests to properly recognise successful ping test
This commit is contained in:
parent
7a1efd687e
commit
47104cf2b3
|
|
@ -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"
|
||||
)
|
||||
|
|
|
|||
|
|
@ -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"
|
||||
)
|
||||
|
|
|
|||
|
|
@ -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(
|
||||
|
|
|
|||
|
|
@ -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"
|
||||
)
|
||||
|
|
|
|||
|
|
@ -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"
|
||||
)
|
||||
|
|
|
|||
Loading…
Reference in New Issue