You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudstack.apache.org by ts...@apache.org on 2013/07/19 14:15:50 UTC

[2/4] git commit: updated refs/heads/4.2 to 19bdef0

CLOUDSTACK-3655: RvR tests fail when handling switchover

During switchover of master->backup->master, the rvr goes through
UNKNOWN, FAULT, MASTER/BACKUP. In case of improper transition the state
is FAULT. Include additional state check in the tests.


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

Branch: refs/heads/4.2
Commit: ea5d487f50c6c472d5a15d218f52e3a0eaa86aca
Parents: 62bf808
Author: Prasanna Santhanam <ts...@apache.org>
Authored: Fri Jul 19 17:34:26 2013 +0530
Committer: Prasanna Santhanam <ts...@apache.org>
Committed: Fri Jul 19 17:45:38 2013 +0530

----------------------------------------------------------------------
 .../component/test_redundant_router.py          | 88 +++++++++-----------
 ...test_redundant_router_deployment_planning.py | 14 ++--
 2 files changed, 45 insertions(+), 57 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/ea5d487f/test/integration/component/test_redundant_router.py
----------------------------------------------------------------------
diff --git a/test/integration/component/test_redundant_router.py b/test/integration/component/test_redundant_router.py
index 82400f1..8414d2f 100644
--- a/test/integration/component/test_redundant_router.py
+++ b/test/integration/component/test_redundant_router.py
@@ -1051,7 +1051,6 @@ class TestRvRRedundancy(cloudstackTestCase):
         self.debug("Listing routers for network: %s" % self.network.name)
         routers = Router.list(
                               self.apiclient,
-                              networkid=self.network.id,
                               id=master_router.id,
                               listall=True
                               )
@@ -1060,28 +1059,27 @@ class TestRvRRedundancy(cloudstackTestCase):
                     True,
                     "list router should return Master and backup routers"
                     )
-        self.assertEqual(
-                    routers[0].redundantstate,
-                    'UNKNOWN',
-                    "Redundant state of the router should be UNKNOWN"
-                    )
+        self.assertIn(
+            routers[0].redundantstate,
+            ['UNKNOWN', 'FAULT'],
+            "Redundant state of the master router should be UNKNOWN/FAULT but is %s" % routers[0].redundantstate
+        )
 
-        self.debug("Listing routers for network: %s" % self.network.name)
+        self.debug("Checking state of the backup router in %s" % self.network.name)
         routers = Router.list(
                               self.apiclient,
-                              networkid=self.network.id,
                               id=backup_router.id,
                               listall=True
                               )
         self.assertEqual(
                     isinstance(routers, list),
                     True,
-                    "list router should return Master and backup routers"
+                    "list router should return backup router"
                     )
         self.assertEqual(
                     routers[0].redundantstate,
                     'MASTER',
-                    "Redundant state of the router should be MASTER"
+                    "Redundant state of the router should be MASTER but is %s" % routers[0].redundantstate
                     )
 
         self.debug("Starting the old MASTER router")
@@ -1089,12 +1087,11 @@ class TestRvRRedundancy(cloudstackTestCase):
             Router.start(self.apiclient, id=master_router.id)
             self.debug("old MASTER router started")
         except Exception as e:
-            self.fail("Failed to stop master router: %s" % e)
+            self.fail("Failed to start master router: %s" % e)
 
-        self.debug("Listing routers for network: %s" % self.network.name)
+        self.debug("Checking state of the master router in %s" % self.network.name)
         routers = Router.list(
                               self.apiclient,
-                              networkid=self.network.id,
                               id=master_router.id,
                               listall=True
                               )
@@ -1106,7 +1103,7 @@ class TestRvRRedundancy(cloudstackTestCase):
         self.assertEqual(
                     routers[0].redundantstate,
                     'BACKUP',
-                    "Redundant state of the router should be BACKUP"
+                    "Redundant state of the router should be BACKUP but is %s" % routers[0].redundantstate
                     )
         self.assertEqual(
                          master_router.publicip,
@@ -1171,10 +1168,9 @@ class TestRvRRedundancy(cloudstackTestCase):
         except Exception as e:
             self.fail("Failed to stop backup router: %s" % e)
 
-        self.debug("Listing routers for network: %s" % self.network.name)
+        self.debug("Checking state of the backup router in %s" % self.network.name)
         routers = Router.list(
                               self.apiclient,
-                              networkid=self.network.id,
                               id=backup_router.id,
                               listall=True
                               )
@@ -1183,16 +1179,15 @@ class TestRvRRedundancy(cloudstackTestCase):
                     True,
                     "list router should return Master and backup routers"
                     )
-        self.assertEqual(
-                    routers[0].redundantstate,
-                    'UNKNOWN',
-                    "Redundant state of the router should be UNKNOWN"
-                    )
+        self.assertIn(
+            routers[0].redundantstate,
+            ['UNKNOWN', 'FAULT'],
+            "Redundant state of the backup router should be UNKNOWN/FAULT but is %s" % routers[0].redundantstate
+        )
 
-        self.debug("Listing routers for network: %s" % self.network.name)
+        self.debug("Checking state of the master router in %s" % self.network.name)
         routers = Router.list(
                               self.apiclient,
-                              networkid=self.network.id,
                               id=master_router.id,
                               listall=True
                               )
@@ -1204,7 +1199,7 @@ class TestRvRRedundancy(cloudstackTestCase):
         self.assertEqual(
                     routers[0].redundantstate,
                     'MASTER',
-                    "Redundant state of the router should be MASTER"
+                    "Redundant state of the router should be MASTER but is %s" % routers[0].redundantstate
                     )
 
         self.debug("Starting the old BACKUP router")
@@ -1214,10 +1209,9 @@ class TestRvRRedundancy(cloudstackTestCase):
         except Exception as e:
             self.fail("Failed to stop master router: %s" % e)
 
-        self.debug("Listing routers for network: %s" % self.network.name)
+        self.debug("Checking state of the backup router in %s" % self.network.name)
         routers = Router.list(
                               self.apiclient,
-                              networkid=self.network.id,
                               id=backup_router.id,
                               listall=True
                               )
@@ -1229,7 +1223,7 @@ class TestRvRRedundancy(cloudstackTestCase):
         self.assertEqual(
                     routers[0].redundantstate,
                     'BACKUP',
-                    "Redundant state of the router should be BACKUP"
+                    "Redundant state of the router should be BACKUP but is %s" % routers[0].redundantstate
                     )
         self.assertEqual(
                          backup_router.publicip,
@@ -1288,10 +1282,9 @@ class TestRvRRedundancy(cloudstackTestCase):
         except Exception as e:
             self.fail("Failed to reboot MASTER router: %s" % e)
 
-        self.debug("Listing routers for network: %s" % self.network.name)
+        self.debug("Checking state of the master router in %s" % self.network.name)
         routers = Router.list(
                               self.apiclient,
-                              networkid=self.network.id,
                               id=master_router.id,
                               listall=True
                               )
@@ -1303,13 +1296,12 @@ class TestRvRRedundancy(cloudstackTestCase):
         self.assertEqual(
                     routers[0].redundantstate,
                     'BACKUP',
-                    "Redundant state of the router should be BACKUP"
+                    "Redundant state of the router should be BACKUP but is %s" % routers[0].redundantstate
                     )
 
-        self.debug("Listing routers for network: %s" % self.network.name)
+        self.debug("Checking state of the backup router in %s" % self.network.name)
         routers = Router.list(
                               self.apiclient,
-                              networkid=self.network.id,
                               id=backup_router.id,
                               listall=True
                               )
@@ -1321,7 +1313,7 @@ class TestRvRRedundancy(cloudstackTestCase):
         self.assertEqual(
                     routers[0].redundantstate,
                     'MASTER',
-                    "Redundant state of the router should be MASTER"
+                    "Redundant state of the router should be MASTER but is %s" % routers[0].redundantstate
                     )
         self.assertEqual(
                          master_router.publicip,
@@ -1374,16 +1366,15 @@ class TestRvRRedundancy(cloudstackTestCase):
             master_router = routers[1]
             backup_router = routers[0]
 
-        self.debug("Rebooting the backuo router")
+        self.debug("Rebooting the backup router")
         try:
             Router.reboot(self.apiclient, id=backup_router.id)
         except Exception as e:
             self.fail("Failed to reboot BACKUP router: %s" % e)
 
-        self.debug("Listing routers for network: %s" % self.network.name)
+        self.debug("Checking state of the backup router in %s" % self.network.name)
         routers = Router.list(
                               self.apiclient,
-                              networkid=self.network.id,
                               id=backup_router.id,
                               listall=True
                               )
@@ -1395,13 +1386,12 @@ class TestRvRRedundancy(cloudstackTestCase):
         self.assertEqual(
                     routers[0].redundantstate,
                     'BACKUP',
-                    "Redundant state of the router should be BACKUP"
+                    "Redundant state of the router should be BACKUP but is %s" % routers[0].redundantstate
                     )
 
-        self.debug("Listing routers for network: %s" % self.network.name)
+        self.debug("Checking state of the master router in %s" % self.network.name)
         routers = Router.list(
                               self.apiclient,
-                              networkid=self.network.id,
                               id=master_router.id,
                               listall=True
                               )
@@ -1413,7 +1403,7 @@ class TestRvRRedundancy(cloudstackTestCase):
         self.assertEqual(
                     routers[0].redundantstate,
                     'MASTER',
-                    "Redundant state of the router should be MASTER"
+                    "Redundant state of the router should be MASTER but is %s" % routers[0].redundantstate
                     )
         self.assertEqual(
                          master_router.publicip,
@@ -1472,10 +1462,9 @@ class TestRvRRedundancy(cloudstackTestCase):
         except Exception as e:
             self.fail("Failed to stop BACKUP router: %s" % e)
 
-        self.debug("Listing routers for network: %s" % self.network.name)
+        self.debug("Checking state of the backup router in %s" % self.network.name)
         routers = Router.list(
                               self.apiclient,
-                              networkid=self.network.id,
                               id=backup_router.id,
                               listall=True
                               )
@@ -1484,11 +1473,11 @@ class TestRvRRedundancy(cloudstackTestCase):
                     True,
                     "list router should return Master and backup routers"
                     )
-        self.assertEqual(
-                    routers[0].redundantstate,
-                    'UNKNOWN',
-                    "Redundant state of the router should be UNKNOWN"
-                    )
+        self.assertIn(
+            routers[0].redundantstate,
+            ['UNKNOWN', 'FAULT'],
+            "Redundant state of the backup router should be UNKNOWN/FAULT but is %s" % routers[0].redundantstate
+        )
 
         # Spawn an instance in that network
         vm_2 = VirtualMachine.create(
@@ -1518,10 +1507,9 @@ class TestRvRRedundancy(cloudstackTestCase):
                          "Vm should be in running state after deployment"
                          )
 
-        self.debug("Listing routers for network: %s" % self.network.name)
+        self.debug("Checking state of the backup router in %s" % self.network.name)
         routers = Router.list(
                               self.apiclient,
-                              networkid=self.network.id,
                               id=backup_router.id,
                               listall=True
                               )
@@ -1533,6 +1521,6 @@ class TestRvRRedundancy(cloudstackTestCase):
         self.assertEqual(
                     routers[0].redundantstate,
                     'BACKUP',
-                    "Redundant state of the router should be BACKUP"
+                    "Redundant state of the router should be BACKUP but is %s" % routers[0].redundantstate
                     )
         return

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/ea5d487f/test/integration/component/test_redundant_router_deployment_planning.py
----------------------------------------------------------------------
diff --git a/test/integration/component/test_redundant_router_deployment_planning.py b/test/integration/component/test_redundant_router_deployment_planning.py
index 5f06794..cd37fa6 100644
--- a/test/integration/component/test_redundant_router_deployment_planning.py
+++ b/test/integration/component/test_redundant_router_deployment_planning.py
@@ -191,9 +191,9 @@ class TestRvRDeploymentPlanning(cloudstackTestCase):
         self._cleanup.insert(0, self.account)
         return
 
-    @attr(tags=["advanced", "advancedns", "ssh"])
+    @attr(tags=["advanced", "advancedns"])
     def test_RvR_multipods(self):
-        """Test RvR with muti pods
+        """Test RvR with multi pods
         """
 
         # Steps to validate
@@ -323,9 +323,9 @@ class TestRvRDeploymentPlanning(cloudstackTestCase):
                             )
         return
 
-    @attr(tags=["advanced", "advancedns", "ssh"])
+    @attr(tags=["advanced", "advancedns"])
     def test_RvR_multicluster(self):
-        """Test RvR with muti clusters
+        """Test RvR with multi clusters
         """
 
         # Steps to validate
@@ -526,9 +526,9 @@ class TestRvRDeploymentPlanning(cloudstackTestCase):
             self.apiclient.updatePod(cmd)
         return
 
-    @attr(tags=["advanced", "advancedns", "ssh"])
+    @attr(tags=["advanced", "advancedns"])
     def test_RvR_multiprimarystorage(self):
-        """Test RvR with muti primary storage
+        """Test RvR with multi primary storage
         """
 
         # Steps to validate
@@ -770,7 +770,7 @@ class TestRvRDeploymentPlanning(cloudstackTestCase):
 
     @attr(tags=["advanced", "advancedns", "ssh"])
     def test_RvR_multihosts(self):
-        """Test RvR with muti hosts
+        """Test RvR with multi hosts
         """
 
         # Steps to validate