From c59de915c6d1f860368a01d8256ff1ff24996759 Mon Sep 17 00:00:00 2001 From: Miguel Ferreira Date: Fri, 23 Oct 2015 12:03:55 +0200 Subject: [PATCH] Fix error message in test_isolate_network_FW_PF_default_routes While running test_isolate_network_FW_PF_default_routes it is expected that SSH'ing into a VM does not work immediately. However, when it fails (as expected) witht he follwoing error ====Trying SSH Connection: Host:192.168.23.12 Uer:root Port:22 RetryCnt:1=== Traceback (most recent call last): File "/home/jenkins/workspace/mccloud/mct-run-marvin-tests@2/venv/lib/python2.7/site-packages/marvin/sshClient.py", line 121, in createConnection timeout=self.timeout) File "/home/jenkins/workspace/mccloud/mct-run-marvin-tests@2/venv/lib/python2.7/site-packages/paramiko/client.py", line 251, in connect retry_on_signal(lambda: sock.connect(addr)) File /home/jenkins/workspace/mccloud/mct-run-marvin-tests@2/venv/lib/python2.7/site-packages/paramiko/util.py", line 270, in retry_on_signal return function() File /home/jenkins/workspace/mccloud/mct-run-marvin-tests@2/venv/lib/python2.7/site-packages/paramiko/client.py", line 251, in retry_on_signal(lambda: sock.connect(addr)) File "/usr/lib64/python2.7/socket.py", line 224, in meth return getattr(self._sock,name)(*args) error: [Errno 113] No route to host it would try to print a message that generates a actual error: DEBUG: ====Trying SSH Connection: Host:192.168.23.12 User:root Port:22 RetryCnt:0=== test_isolate_network_FW_PF_default_routes (integration.component.test_routers_network_ops.TestIsolatedNetworks): CRITICAL: EXCEPTION: test_isolate_network_FW_PF_default_routes: Traceback (most recent call last):, File "/usr/lib64/python2.7/unittest/case.py", line 369, in run testMethod()', File "/home/jenkins/workspace/mccloud/mct-run-marvin-tests@2/test/integration/component/test_routers_network_ops.py", line 448, in test_isolate_network_FW_PF_default_routes self.fail("Failed to SSH into VM - %s" % (public_ip.ipaddress.ipaddress)), "AttributeError: 'unicode' object has no attribute 'ipaddress'" --- .../component/test_routers_network_ops.py | 20 +++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/test/integration/component/test_routers_network_ops.py b/test/integration/component/test_routers_network_ops.py index ba3e5e461f6..57024106f9d 100644 --- a/test/integration/component/test_routers_network_ops.py +++ b/test/integration/component/test_routers_network_ops.py @@ -81,9 +81,9 @@ class TestRedundantIsolateNetworks(cloudstackTestCase): cls.api_client, cls.services["service_offering"] ) - + cls.services["nw_off_persistent_RVR"]["egress_policy"] = "true" - + cls.network_offering = NetworkOffering.create( cls.api_client, cls.services["nw_off_persistent_RVR"], @@ -95,7 +95,7 @@ class TestRedundantIsolateNetworks(cloudstackTestCase): cls.service_offering, cls.network_offering, ] - + cls.logger = logging.getLogger('TestRedundantIsolateNetworks') cls.stream_handler = logging.StreamHandler() cls.logger.setLevel(logging.DEBUG) @@ -168,7 +168,7 @@ class TestRedundantIsolateNetworks(cloudstackTestCase): serviceofferingid=self.service_offering.id, networkids=[str(network.id)] ) - + self.logger.debug("Deployed VM in network: %s" % network.id) vms = VirtualMachine.list( @@ -305,7 +305,7 @@ class TestIsolatedNetworks(cloudstackTestCase): cls.api_client, cls.services["service_offering"] ) - + cls.services["network_offering"]["egress_policy"] = "true" cls.network_offering = NetworkOffering.create(cls.api_client, @@ -313,7 +313,7 @@ class TestIsolatedNetworks(cloudstackTestCase): conservemode=True) cls.network_offering.update(cls.api_client, state='Enabled') - + cls.network = Network.create(cls.api_client, cls.services["network"], accountid=cls.account.name, @@ -336,7 +336,7 @@ class TestIsolatedNetworks(cloudstackTestCase): cls.service_offering, cls.account ] - + cls.logger = logging.getLogger('TestIsolatedNetworks') cls.stream_handler = logging.StreamHandler() cls.logger.setLevel(logging.DEBUG) @@ -435,17 +435,17 @@ class TestIsolatedNetworks(cloudstackTestCase): 'Active', "Check list port forwarding rules" ) - + result = 'failed' try: ssh_command = "ping -c 3 8.8.8.8" - self.logger.debug("SSH into VM with ID: %s" % nat_rule.ipaddress) + self.logger.debug("SSH into VM with IP: %s" % nat_rule.ipaddress) ssh = self.vm_1.get_ssh_client(ipaddress=nat_rule.ipaddress, port=self.services["natrule"]["publicport"], retries=5) result = str(ssh.execute(ssh_command)) self.logger.debug("SSH result: %s; COUNT is ==> %s" % (result, result.count("3 packets received"))) except: - self.fail("Failed to SSH into VM - %s" % (public_ip.ipaddress.ipaddress)) + self.fail("Failed to SSH into VM - %s" % (nat_rule.ipaddress)) self.assertEqual( result.count("3 packets received"),