You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudstack.apache.org by ya...@apache.org on 2013/07/23 03:45:45 UTC

git commit: updated refs/heads/master to 9f15779

Updated Branches:
  refs/heads/master cc99a83d7 -> 9f15779f1


CLOUDSTACK-3643: Automation: Fix VPC test cases

Also add a timeout for network connection testings.

Ideally this timeout should be around 30s or even less, but keep it at 60s for
now for safe.


Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/9f15779f
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/9f15779f
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/9f15779f

Branch: refs/heads/master
Commit: 9f15779f106a63a8a08702ad3928cbdd90f6b552
Parents: cc99a83
Author: Sheng Yang <sh...@citrix.com>
Authored: Mon Jul 22 18:37:26 2013 -0700
Committer: Sheng Yang <sh...@citrix.com>
Committed: Mon Jul 22 18:45:39 2013 -0700

----------------------------------------------------------------------
 .../component/test_vpc_network_lbrules.py       |  17 ++--
 .../component/test_vpc_network_pfrules.py       | 101 +++++++++++--------
 .../component/test_vpc_network_staticnatrule.py |  20 ++--
 3 files changed, 82 insertions(+), 56 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/9f15779f/test/integration/component/test_vpc_network_lbrules.py
----------------------------------------------------------------------
diff --git a/test/integration/component/test_vpc_network_lbrules.py b/test/integration/component/test_vpc_network_lbrules.py
index ae452c4..d3c5ce1 100644
--- a/test/integration/component/test_vpc_network_lbrules.py
+++ b/test/integration/component/test_vpc_network_lbrules.py
@@ -42,6 +42,7 @@ from marvin.integration.lib.common import (get_domain,
                                         get_template,
                                         cleanup_resources,
                                         list_routers)
+import socket
 
 class Services:
     """Test VPC network services Load Balancing Rules Test data
@@ -179,6 +180,9 @@ class TestVPCNetworkLBRules(cloudstackTestCase):
 
     @classmethod
     def setUpClass(cls):
+        # We want to fail quicker if it's failure
+        socket.setdefaulttimeout(60)
+
         cls.api_client = super(
                             TestVPCNetworkLBRules,
                             cls
@@ -294,6 +298,7 @@ class TestVPCNetworkLBRules(cloudstackTestCase):
 
     def start_VPC_VRouter(self, router):
         # Start the VPC Router
+        self.debug("Starting router ID: %s" % router.id)
         cmd = startRouter.startRouterCmd()
         cmd.id = router.id
         self.apiclient.startRouter(cmd)
@@ -665,7 +670,7 @@ class TestVPCNetworkLBRules(cloudstackTestCase):
         self.debug('lb_rule_http=%s' % lb_rule_http.__dict__)
         self.check_wget_from_vm(vm_1, public_ip_1, testnegative=False)
         self.check_ssh_into_vm(vm_1, public_ip_1, testnegative=False)
-        lb_rule_nat.delete()
+        lb_rule_nat.delete(self.apiclient)
         self.check_ssh_into_vm(vm_1, public_ip_1, testnegative=True)
         return
 
@@ -696,7 +701,7 @@ class TestVPCNetworkLBRules(cloudstackTestCase):
         self.debug('lb_rule_http=%s' % lb_rule_http.__dict__)
         self.check_wget_from_vm(vm_1, public_ip_1, testnegative=False)
         self.check_ssh_into_vm(vm_1, public_ip_1, testnegative=False)
-        lb_rule_nat.delete()
+        lb_rule_nat.delete(self.apiclient)
         self.check_ssh_into_vm(vm_1, public_ip_1, testnegative=True)
         return    
 
@@ -727,8 +732,8 @@ class TestVPCNetworkLBRules(cloudstackTestCase):
         self.debug('lb_rule_http=%s' % lb_rule_http.__dict__)
         self.check_wget_from_vm(vm_1, public_ip_1, testnegative=False)
         self.check_ssh_into_vm(vm_1, public_ip_1, testnegative=False)
-        lb_rule_nat.delete()
-        lb_rule_http.delete()
+        lb_rule_nat.delete(self.apiclient)
+        lb_rule_http.delete(self.apiclient)
         self.check_ssh_into_vm(vm_1, public_ip_1, testnegative=True)
         self.check_wget_from_vm(vm_1, public_ip_1, testnegative=True)
         return
@@ -760,8 +765,8 @@ class TestVPCNetworkLBRules(cloudstackTestCase):
         self.debug('lb_rule_http=%s' % lb_rule_http.__dict__)
         self.check_wget_from_vm(vm_1, public_ip_1, testnegative=False)
         self.check_ssh_into_vm(vm_1, public_ip_1, testnegative=False)
-        lb_rule_nat.delete()
-        lb_rule_http.delete()
+        lb_rule_nat.delete(self.apiclient)
+        lb_rule_http.delete(self.apiclient)
         self.check_ssh_into_vm(vm_1, public_ip_1, testnegative=True)
         self.check_wget_from_vm(vm_1, public_ip_1, testnegative=True)
         return

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/9f15779f/test/integration/component/test_vpc_network_pfrules.py
----------------------------------------------------------------------
diff --git a/test/integration/component/test_vpc_network_pfrules.py b/test/integration/component/test_vpc_network_pfrules.py
index 64a6aa2..d9a045c 100644
--- a/test/integration/component/test_vpc_network_pfrules.py
+++ b/test/integration/component/test_vpc_network_pfrules.py
@@ -38,6 +38,7 @@ from marvin.integration.lib.common import (get_domain,
                                                         get_template,
                                                         cleanup_resources,
                                                         list_routers)
+import socket
 
 
 class Services:
@@ -179,6 +180,9 @@ class TestVPCNetworkPFRules(cloudstackTestCase):
 
     @classmethod
     def setUpClass(cls):
+        # We want to fail quicker if it's failure
+        socket.setdefaulttimeout(60)
+
         cls.api_client = super(
                                         TestVPCNetworkPFRules,
                                         cls
@@ -294,6 +298,7 @@ class TestVPCNetworkPFRules(cloudstackTestCase):
 
     def start_vpcrouter(self, router):
         # Start the VPC Router
+        self.debug("Starting router ID: %s" % router.id)
         cmd = startRouter.startRouterCmd()
         cmd.id = router.id
         self.apiclient.startRouter(cmd)
@@ -634,7 +639,7 @@ class TestVPCNetworkPFRules(cloudstackTestCase):
         self.check_ssh_into_vm(vm_1, public_ip_1, testnegative=False)
         self.check_wget_from_vm(vm_1, public_ip_1, testnegative=False)
         router = self.stop_vpcrouter()
-        http_rule.delete()
+        http_rule.delete(self.apiclient)
         self.start_vpcrouter(router)
         self.check_wget_from_vm(vm_1, public_ip_1, testnegative=True)
         return
@@ -663,7 +668,7 @@ class TestVPCNetworkPFRules(cloudstackTestCase):
         #http_rule = self.create_egress_Internet_Rule(network_1)
         self.check_ssh_into_vm(vm_1, public_ip_1, testnegative=False)
         self.check_wget_from_vm(vm_1, public_ip_1, testnegative=False)
-        http_rule.delete()
+        http_rule.delete(self.apiclient)
         self.check_wget_from_vm(vm_1, public_ip_1, testnegative=True)
         return
 
@@ -695,8 +700,8 @@ class TestVPCNetworkPFRules(cloudstackTestCase):
         self.check_ssh_into_vm(vm_1, public_ip_1, testnegative=False)
         self.check_wget_from_vm(vm_1, public_ip_1, testnegative=False)
         router = self.stop_vpcrouter()
-        http_rule.delete()
-        nat_rule.delete()
+        http_rule.delete(self.apiclient)
+        nat_rule.delete(self.apiclient)
         self.start_vpcrouter(router)
         self.check_ssh_into_vm(vm_1, public_ip_1, testnegative=True)
         self.check_wget_from_vm(vm_1, public_ip_1, testnegative=True)
@@ -727,8 +732,8 @@ class TestVPCNetworkPFRules(cloudstackTestCase):
         #http_rule = self.create_egress_Internet_Rule(network_1)
         self.check_ssh_into_vm(vm_1, public_ip_1, testnegative=False)
         self.check_wget_from_vm(vm_1, public_ip_1, testnegative=False)
-        http_rule.delete()
-        nat_rule.delete()
+        http_rule.delete(self.apiclient)
+        nat_rule.delete(self.apiclient)
         self.check_ssh_into_vm(vm_1, public_ip_1, testnegative=True)
         self.check_wget_from_vm(vm_1, public_ip_1, testnegative=True)
         return
@@ -764,34 +769,40 @@ class TestVPCNetworkPFRules(cloudstackTestCase):
         public_ip_2 = self.acquire_publicip(network_1)
         nat_rule1  = self.create_natrule(vm_1, public_ip_1, network_1)
         nat_rule2  = self.create_natrule(vm_2, public_ip_2, network_1)
-        http_rule1 = self.open_egress_to_world(network_1)
-        nat_rule3  = self.create_natrule(vm_3, public_ip_1, network_2)
-        nat_rule4  = self.create_natrule(vm_4, public_ip_2, network_2)
-        http_rule2 = self.open_egress_to_world(network_2)
+        http_rule1 = self.create_natrule(vm_1, public_ip_1, network_1, self.services["http_rule"])
+        http_rule2 = self.create_natrule(vm_2, public_ip_2, network_1, self.services["http_rule"])
+        public_ip_3 = self.acquire_publicip(network_2)
+        public_ip_4 = self.acquire_publicip(network_2)
+        nat_rule3  = self.create_natrule(vm_3, public_ip_3, network_2)
+        nat_rule4  = self.create_natrule(vm_4, public_ip_4, network_2)
+        http_rule3 = self.create_natrule(vm_3, public_ip_3, network_2, self.services["http_rule"])
+        http_rule4 = self.create_natrule(vm_4, public_ip_4, network_2, self.services["http_rule"])
         self.check_ssh_into_vm(vm_1, public_ip_1, testnegative=False)
         self.check_ssh_into_vm(vm_2, public_ip_2, testnegative=False)
-        self.check_ssh_into_vm(vm_3, public_ip_1, testnegative=False)
-        self.check_ssh_into_vm(vm_4, public_ip_2, testnegative=False)
+        self.check_ssh_into_vm(vm_3, public_ip_3, testnegative=False)
+        self.check_ssh_into_vm(vm_4, public_ip_4, testnegative=False)
         self.check_wget_from_vm(vm_1, public_ip_1, testnegative=False)
         self.check_wget_from_vm(vm_2, public_ip_2, testnegative=False)
-        self.check_wget_from_vm(vm_3, public_ip_1, testnegative=False)
-        self.check_wget_from_vm(vm_4, public_ip_2, testnegative=False)
+        self.check_wget_from_vm(vm_3, public_ip_3, testnegative=False)
+        self.check_wget_from_vm(vm_4, public_ip_4, testnegative=False)
         router = self.stop_vpcrouter()
-        nat_rule1.delete()
-        nat_rule2.delete()
-        nat_rule3.delete()
-        nat_rule4.delete()
-        http_rule1.delete()
-        http_rule2.delete()
+        nat_rule1.delete(self.apiclient)
+        nat_rule2.delete(self.apiclient)
+        nat_rule3.delete(self.apiclient)
+        nat_rule4.delete(self.apiclient)
+        http_rule1.delete(self.apiclient)
+        http_rule2.delete(self.apiclient)
+        http_rule3.delete(self.apiclient)
+        http_rule4.delete(self.apiclient)
         self.start_vpcrouter(router)
         self.check_ssh_into_vm(vm_1, public_ip_1, testnegative=True)
         self.check_ssh_into_vm(vm_2, public_ip_2, testnegative=True)
-        self.check_ssh_into_vm(vm_3, public_ip_1, testnegative=True)
-        self.check_ssh_into_vm(vm_4, public_ip_2, testnegative=True)
+        self.check_ssh_into_vm(vm_3, public_ip_3, testnegative=True)
+        self.check_ssh_into_vm(vm_4, public_ip_4, testnegative=True)
         self.check_wget_from_vm(vm_1, public_ip_1, testnegative=True)
         self.check_wget_from_vm(vm_2, public_ip_2, testnegative=True)
-        self.check_wget_from_vm(vm_3, public_ip_1, testnegative=True)
-        self.check_wget_from_vm(vm_4, public_ip_2, testnegative=True)
+        self.check_wget_from_vm(vm_3, public_ip_3, testnegative=True)
+        self.check_wget_from_vm(vm_4, public_ip_4, testnegative=True)
         return
 
     @attr(tags=["advanced", "intervlan"])
@@ -822,30 +833,36 @@ class TestVPCNetworkPFRules(cloudstackTestCase):
         public_ip_2 = self.acquire_publicip(network_1)
         nat_rule1  = self.create_natrule(vm_1, public_ip_1, network_1)
         nat_rule2  = self.create_natrule(vm_2, public_ip_2, network_1)
-        http_rule1 = self.open_egress_to_world(network_1)
-        nat_rule3  = self.create_natrule(vm_3, public_ip_1, network_2)
-        nat_rule4  = self.create_natrule(vm_4, public_ip_2, network_2)
-        http_rule2 = self.open_egress_to_world(network_2)
+        http_rule1 = self.create_natrule(vm_1, public_ip_1, network_1, self.services["http_rule"])
+        http_rule2 = self.create_natrule(vm_2, public_ip_2, network_1, self.services["http_rule"])
+        public_ip_3 = self.acquire_publicip(network_2)
+        public_ip_4 = self.acquire_publicip(network_2)
+        nat_rule3  = self.create_natrule(vm_3, public_ip_3, network_2)
+        nat_rule4  = self.create_natrule(vm_4, public_ip_4, network_2)
+        http_rule3 = self.create_natrule(vm_3, public_ip_3, network_2, self.services["http_rule"])
+        http_rule4 = self.create_natrule(vm_4, public_ip_4, network_2, self.services["http_rule"])
         self.check_ssh_into_vm(vm_1, public_ip_1, testnegative=False)
         self.check_ssh_into_vm(vm_2, public_ip_2, testnegative=False)
-        self.check_ssh_into_vm(vm_3, public_ip_1, testnegative=False)
-        self.check_ssh_into_vm(vm_4, public_ip_2, testnegative=False)
+        self.check_ssh_into_vm(vm_3, public_ip_3, testnegative=False)
+        self.check_ssh_into_vm(vm_4, public_ip_4, testnegative=False)
         self.check_wget_from_vm(vm_1, public_ip_1, testnegative=False)
         self.check_wget_from_vm(vm_2, public_ip_2, testnegative=False)
-        self.check_wget_from_vm(vm_3, public_ip_1, testnegative=False)
-        self.check_wget_from_vm(vm_4, public_ip_2, testnegative=False)
-        nat_rule1.delete()
-        nat_rule2.delete()
-        nat_rule3.delete()
-        nat_rule4.delete()
-        http_rule1.delete()
-        http_rule2.delete()
+        self.check_wget_from_vm(vm_3, public_ip_3, testnegative=False)
+        self.check_wget_from_vm(vm_4, public_ip_4, testnegative=False)
+        nat_rule1.delete(self.apiclient)
+        nat_rule2.delete(self.apiclient)
+        nat_rule3.delete(self.apiclient)
+        nat_rule4.delete(self.apiclient)
+        http_rule1.delete(self.apiclient)
+        http_rule2.delete(self.apiclient)
+        http_rule3.delete(self.apiclient)
+        http_rule4.delete(self.apiclient)
         self.check_ssh_into_vm(vm_1, public_ip_1, testnegative=True)
         self.check_ssh_into_vm(vm_2, public_ip_2, testnegative=True)
-        self.check_ssh_into_vm(vm_3, public_ip_1, testnegative=True)
-        self.check_ssh_into_vm(vm_4, public_ip_2, testnegative=True)
+        self.check_ssh_into_vm(vm_3, public_ip_3, testnegative=True)
+        self.check_ssh_into_vm(vm_4, public_ip_4, testnegative=True)
         self.check_wget_from_vm(vm_1, public_ip_1, testnegative=True)
         self.check_wget_from_vm(vm_2, public_ip_2, testnegative=True)
-        self.check_wget_from_vm(vm_3, public_ip_1, testnegative=True)
-        self.check_wget_from_vm(vm_4, public_ip_2, testnegative=True)
+        self.check_wget_from_vm(vm_3, public_ip_3, testnegative=True)
+        self.check_wget_from_vm(vm_4, public_ip_4, testnegative=True)
         return

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/9f15779f/test/integration/component/test_vpc_network_staticnatrule.py
----------------------------------------------------------------------
diff --git a/test/integration/component/test_vpc_network_staticnatrule.py b/test/integration/component/test_vpc_network_staticnatrule.py
index 80e8477..0d23d03 100644
--- a/test/integration/component/test_vpc_network_staticnatrule.py
+++ b/test/integration/component/test_vpc_network_staticnatrule.py
@@ -38,6 +38,7 @@ from marvin.integration.lib.common import (get_domain,
                                                         get_template,
                                                         cleanup_resources,
                                                         list_routers)
+import socket
 
 
 class Services:
@@ -178,6 +179,9 @@ class TestVPCNetworkPFRules(cloudstackTestCase):
 
     @classmethod
     def setUpClass(cls):
+        # We want to fail quicker if it's failure
+        socket.setdefaulttimeout(60)
+
         cls.api_client = super(
                                         TestVPCNetworkPFRules,
                                         cls
@@ -634,8 +638,8 @@ class TestVPCNetworkPFRules(cloudstackTestCase):
         http_rule = self.create_NatRule_For_VM(vm_1, public_ip_1, network_1, self.services["http_rule"])
         self.check_ssh_into_vm(vm_1, public_ip_1, testnegative=False)
         self.check_wget_from_vm(vm_1, public_ip_1, testnegative=False)
-        http_rule.delete()
-        nat_rule.delete()
+        http_rule.delete(self.apiclient)
+        nat_rule.delete(self.apiclient)
         self.check_ssh_into_vm(vm_1, public_ip_1, testnegative=True)
         self.check_wget_from_vm(vm_1, public_ip_1, testnegative=True)
         return
@@ -682,12 +686,12 @@ class TestVPCNetworkPFRules(cloudstackTestCase):
         self.check_wget_from_vm(vm_2, public_ip_2, testnegative=False)
         self.check_wget_from_vm(vm_3, public_ip_1, testnegative=False)
         self.check_wget_from_vm(vm_4, public_ip_2, testnegative=False)
-        nat_rule1.delete()
-        nat_rule2.delete()
-        nat_rule3.delete()
-        nat_rule4.delete()
-        http_rule1.delete()
-        http_rule2.delete()
+        nat_rule1.delete(self.apiclient)
+        nat_rule2.delete(self.apiclient)
+        nat_rule3.delete(self.apiclient)
+        nat_rule4.delete(self.apiclient)
+        http_rule1.delete(self.apiclient)
+        http_rule2.delete(self.apiclient)
         self.check_ssh_into_vm(vm_1, public_ip_1, testnegative=True)
         self.check_ssh_into_vm(vm_2, public_ip_2, testnegative=True)
         self.check_ssh_into_vm(vm_3, public_ip_1, testnegative=True)