Return-Path: X-Original-To: apmail-cloudstack-commits-archive@www.apache.org Delivered-To: apmail-cloudstack-commits-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 8E64C97EE for ; Fri, 24 May 2013 01:01:10 +0000 (UTC) Received: (qmail 73314 invoked by uid 500); 24 May 2013 01:01:08 -0000 Delivered-To: apmail-cloudstack-commits-archive@cloudstack.apache.org Received: (qmail 73191 invoked by uid 500); 24 May 2013 01:01:08 -0000 Mailing-List: contact commits-help@cloudstack.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@cloudstack.apache.org Delivered-To: mailing list commits@cloudstack.apache.org Received: (qmail 72956 invoked by uid 99); 24 May 2013 01:01:07 -0000 Received: from tyr.zones.apache.org (HELO tyr.zones.apache.org) (140.211.11.114) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 24 May 2013 01:01:07 +0000 Received: by tyr.zones.apache.org (Postfix, from userid 65534) id 6DD20695F; Fri, 24 May 2013 01:01:07 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: mchen@apache.org To: commits@cloudstack.apache.org Date: Fri, 24 May 2013 01:01:19 -0000 Message-Id: <5dbf647f1d6c4437943b9ed078f1dda5@git.apache.org> In-Reply-To: <0fc44cef7180424587a3a5d525cb9dd6@git.apache.org> References: <0fc44cef7180424587a3a5d525cb9dd6@git.apache.org> X-Mailer: ASF-Git Admin Mailer Subject: [13/50] [abbrv] git commit: updated refs/heads/object_store to 98af424 CLOUDSTACK-2577: Fix exception handling for listPortForwarding API listPortForwarding API returns an exception if the PF is deleted. Changed testcases to handle this exception. Signed-off-by: Girish Shilamkar Signed-off-by: Prasanna Santhanam Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/44a81f0b Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/44a81f0b Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/44a81f0b Branch: refs/heads/object_store Commit: 44a81f0b6f2d4305d8e92058abb88c1a6334d814 Parents: 6160110 Author: Girish Shilamkar Authored: Wed May 22 15:53:27 2013 +0530 Committer: Prasanna Santhanam Committed: Wed May 22 15:52:31 2013 +0530 ---------------------------------------------------------------------- test/integration/smoke/test_network.py | 69 +++++++++----------------- 1 files changed, 24 insertions(+), 45 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/cloudstack/blob/44a81f0b/test/integration/smoke/test_network.py ---------------------------------------------------------------------- diff --git a/test/integration/smoke/test_network.py b/test/integration/smoke/test_network.py index 4a7bb44..61ddf46 100644 --- a/test/integration/smoke/test_network.py +++ b/test/integration/smoke/test_network.py @@ -18,6 +18,7 @@ """ #Import Local Modules import marvin +from marvin.cloudstackException import cloudstackAPIException from marvin.cloudstackTestCase import * from marvin.cloudstackAPI import * from marvin import remoteSSHClient @@ -447,16 +448,14 @@ class TestPortForwarding(cloudstackTestCase): nat_rule.delete(self.apiclient) - list_nat_rule_response = list_nat_rules( + try: + list_nat_rule_response = list_nat_rules( self.apiclient, id=nat_rule.id ) + except cloudstackAPIException: + self.debug("Nat Rule is deleted") - self.assertEqual( - list_nat_rule_response, - None, - "Check Port Forwarding Rule is deleted" - ) # Check if the Public SSH port is inaccessible with self.assertRaises(Exception): self.debug( @@ -565,15 +564,14 @@ class TestPortForwarding(cloudstackTestCase): nat_rule.delete(self.apiclient) - list_nat_rule_response = list_nat_rules( + try: + list_nat_rule_response = list_nat_rules( self.apiclient, id=nat_rule.id ) - self.assertEqual( - list_nat_rule_response, - None, - "Check Port Forwarding Rule is deleted" - ) + except cloudstackAPIException: + self.debug("Nat Rule is deleted") + # Check if the Public SSH port is inaccessible with self.assertRaises(Exception): self.debug( @@ -785,7 +783,6 @@ class TestLoadBalancingRule(cloudstackTestCase): "SSH into VM (IPaddress: %s) & NAT Rule (Public IP: %s)" % (self.vm_1.ipaddress, src_nat_ip_addr.ipaddress) ) - ssh_1 = remoteSSHClient( src_nat_ip_addr.ipaddress, self.services['lbrule']["publicport"], @@ -1582,32 +1579,28 @@ class TestReleaseIP(cloudstackTestCase): "Check if disassociated IP Address is no longer available" ) + self.debug("List NAT Rule response" + str(list_nat_rule)) # ListPortForwardingRules should not list # associated rules with Public IP address - list_nat_rule = list_nat_rules( + try: + list_nat_rule = list_nat_rules( self.apiclient, id=self.nat_rule.id ) - self.debug("List NAT Rule response" + str(list_nat_rule)) - self.assertEqual( - list_nat_rule, - None, - "Check if PF rules are no longer available for IP address" - ) + except cloudstackAPIException: + self.debug("Port Forwarding Rule is deleted") # listLoadBalancerRules should not list # associated rules with Public IP address - list_lb_rule = list_lb_rules( + self.debug("List LB Rule response" + str(list_lb_rule)) + try: + list_lb_rule = list_lb_rules( self.apiclient, id=self.lb_rule.id ) - self.debug("List LB Rule response" + str(list_lb_rule)) - self.assertEqual( - list_lb_rule, - None, - "Check if LB rules for IP Address are no longer available" - ) + except cloudstackAPIException: + self.debug("Port Forwarding Rule is deleted") # SSH Attempt though public IP should fail with self.assertRaises(Exception): @@ -1720,16 +1713,9 @@ class TestDeleteAccount(cloudstackTestCase): account=self.account.name, domainid=self.account.domainid ) - self.assertEqual( - list_lb_reponse, - None, - "Check load balancing rule is properly deleted." - ) - except Exception as e: + except cloudstackAPIException: + self.debug("Port Forwarding Rule is deleted") - raise Exception( - "Exception raised while fetching LB rules for account: %s" % - self.account.name) # ListPortForwardingRules should not # list associated rules with deleted account try: @@ -1738,16 +1724,9 @@ class TestDeleteAccount(cloudstackTestCase): account=self.account.name, domainid=self.account.domainid ) - self.assertEqual( - list_nat_reponse, - None, - "Check load balancing rule is properly deleted." - ) - except Exception as e: + except cloudstackAPIException: + self.debug("NATRule is deleted") - raise Exception( - "Exception raised while fetching NAT rules for account: %s" % - self.account.name) #Retrieve router for the user account try: routers = list_routers(