Updated Branches: refs/heads/4.3 0a02c7e14 -> b87f675f4
CLOUDSTACK-5169: Egress rules - Improved assertion code related to SSH to avoid assertion error Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/b87f675f Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/b87f675f Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/b87f675f Branch: refs/heads/4.3 Commit: b87f675f4abb9abff91b87dff5c6a087407427df Parents: 0a02c7e Author: Ashutosh K <ashut...@clogeny.com> Authored: Fri Nov 15 11:28:07 2013 +0530 Committer: Girish Shilamkar <gir...@clogeny.com> Committed: Fri Nov 15 11:29:32 2013 +0530 ---------------------------------------------------------------------- test/integration/component/test_egress_rules.py | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/cloudstack/blob/b87f675f/test/integration/component/test_egress_rules.py ---------------------------------------------------------------------- diff --git a/test/integration/component/test_egress_rules.py b/test/integration/component/test_egress_rules.py index eb38c1a..590f72a 100644 --- a/test/integration/component/test_egress_rules.py +++ b/test/integration/component/test_egress_rules.py @@ -1439,8 +1439,7 @@ class TestMultipleAccountsEgressRuleNeg(cloudstackTestCase): try: self.debug("SSHing into VM type B from VM A") self.debug("VM IP: %s" % self.virtual_machineB.ssh_ip) - res = ssh.execute("ssh %s@%s" % ( - self.services["virtual_machine"]["username"], + res = ssh.execute("ssh -o 'BatchMode=yes' %s" % ( self.virtual_machineB.ssh_ip )) self.debug("SSH result: %s" % str(res)) @@ -1450,10 +1449,14 @@ class TestMultipleAccountsEgressRuleNeg(cloudstackTestCase): (self.virtual_machineA.ipaddress, e) ) result = str(res) - self.assertEqual( - result.count("Connection timed out"), - 1, - "SSH into management server from VM should not be successful" + + # SSH failure may result in one of the following three error messages + ssh_failure_result_set = ["ssh: connect to host %s port 22: No route to host" % self.virtual_machineB.ssh_ip, + "ssh: connect to host %s port 22: Connection timed out" % self.virtual_machineB.ssh_ip, + "Host key verification failed."] + + self.assertFalse(set(res).isdisjoint(ssh_failure_result_set), + "SSH into VM of other account should not be successful" ) return