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/26 05:46:50 UTC
git commit: updated refs/heads/4.2 to b539366
Updated Branches:
refs/heads/4.2 11e001d75 -> b53936622
Automation: Fix test_redundant_router.py
1. Many state check need to wait for while for status to update
2. BACKUP router would still have eth2 and IP, but it's not enabled. Fix the
case.
Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/b5393662
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/b5393662
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/b5393662
Branch: refs/heads/4.2
Commit: b539366229630c4d12a68e5353f73ac983aba099
Parents: 11e001d
Author: Sheng Yang <sh...@citrix.com>
Authored: Thu Jul 25 20:23:19 2013 -0700
Committer: Sheng Yang <sh...@citrix.com>
Committed: Thu Jul 25 20:46:26 2013 -0700
----------------------------------------------------------------------
.../component/test_redundant_router.py | 61 +++++++++++++-------
1 file changed, 39 insertions(+), 22 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/b5393662/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 b72a588..7466819 100644
--- a/test/integration/component/test_redundant_router.py
+++ b/test/integration/component/test_redundant_router.py
@@ -369,6 +369,9 @@ class TestCreateRvRNetwork(cloudstackTestCase):
)
self.debug("Deployed VM in network: %s" % network.id)
+ # wait for VR to update state
+ time.sleep(self.services["sleep"])
+
self.debug("Listing routers for network: %s" % network.name)
routers = Router.list(
self.apiclient,
@@ -581,6 +584,9 @@ class TestCreateRvRNetworkNonDefaultGuestCidr(cloudstackTestCase):
)
self.debug("Deployed VM in network: %s" % network.id)
+ # wait for VR to update state
+ time.sleep(self.services["sleep"])
+
self.debug("Listing routers for network: %s" % network.name)
routers = Router.list(
self.apiclient,
@@ -785,6 +791,9 @@ class TestRVRInternals(cloudstackTestCase):
)
self.debug("Deployed VM in network: %s" % network.id)
+ # wait for VR to update state
+ time.sleep(self.services["sleep"])
+
self.debug("Listing routers for network: %s" % network.name)
routers = Router.list(
self.apiclient,
@@ -848,7 +857,7 @@ class TestRVRInternals(cloudstackTestCase):
self.apiclient.connection.user,
self.apiclient.connection.passwd,
master_router.linklocalip,
- 'ifconfig eth2',
+ 'ip addr show eth2',
hypervisor=self.apiclient.hypervisor
)
else:
@@ -858,20 +867,20 @@ class TestRVRInternals(cloudstackTestCase):
self.services['host']["username"],
self.services['host']["password"],
master_router.linklocalip,
- 'ifconfig eth2'
+ 'ip addr show eth2'
)
res = str(result)
- self.debug("Command 'ifconfig eth2': %s" % result)
+ self.debug("Command 'ip addr show eth2': %s" % result)
self.debug("Router's public Ip: %s" % master_router.publicip)
self.assertEqual(
- res.count(master_router.publicip),
+ res.count("state UP"),
1,
- "master router should have the public IP configured"
+ "MASTER router's public interface should be UP"
)
self.assertEqual(
- result.count('Bcast:0.0.0.0'),
+ result.count('brd 0.0.0.0'),
0,
"Broadcast address of eth2 should not be 0.0.0.0"
)
@@ -884,7 +893,7 @@ class TestRVRInternals(cloudstackTestCase):
self.apiclient.connection.user,
self.apiclient.connction.passwd,
backup_router.linklocalip,
- 'ifconfig eth2',
+ 'ip addr show eth2',
hypervisor=self.apiclient.hypervisor
)
else:
@@ -894,16 +903,21 @@ class TestRVRInternals(cloudstackTestCase):
self.services['host']["username"],
self.services['host']["password"],
backup_router.linklocalip,
- 'ifconfig eth2'
+ 'ip addr show eth2',
)
res = str(result)
- self.debug("Command 'ifconfig eth2': %s" % result)
+ self.debug("Command 'ip addr show eth2': %s" % result)
self.assertEqual(
- res.count('Bcast:0.0.0.0'),
- 1,
- "backup router should NOT have the public IP configured"
- )
+ res.count("state DOWN"),
+ 1,
+ "BACKUP router's public interface should be DOWN"
+ )
+ self.assertEqual(
+ result.count('brd 0.0.0.0'),
+ 0,
+ "Broadcast address of eth2 should not be 0.0.0.0"
+ )
vms = VirtualMachine.list(
self.apiclient,
id=virtual_machine.id,
@@ -1011,9 +1025,12 @@ class TestRvRRedundancy(cloudstackTestCase):
networkids=[str(self.network.id)]
)
self.debug("Deployed VM in network: %s" % self.network.id)
+
+ # wait for VR to update state
+ time.sleep(self.services["sleep"])
+
self.cleanup = []
self.cleanup.insert(0, self.account)
- self.update_waiting_time = 60;
return
def tearDown(self):
@@ -1081,7 +1098,7 @@ class TestRvRRedundancy(cloudstackTestCase):
self.fail("Failed to stop master router: %s" % e)
# wait for VR to update state
- time.sleep(self.update_waiting_time)
+ time.sleep(self.services["sleep"])
self.debug("Listing routers for network: %s" % self.network.name)
routers = Router.list(
@@ -1125,7 +1142,7 @@ class TestRvRRedundancy(cloudstackTestCase):
self.fail("Failed to start master router: %s" % e)
# wait for VR to update state
- time.sleep(self.update_waiting_time)
+ time.sleep(self.services["sleep"])
self.debug("Checking state of the master router in %s" % self.network.name)
routers = Router.list(
@@ -1207,7 +1224,7 @@ class TestRvRRedundancy(cloudstackTestCase):
self.fail("Failed to stop backup router: %s" % e)
# wait for VR update state
- time.sleep(self.update_waiting_time)
+ time.sleep(self.services["sleep"])
self.debug("Checking state of the backup router in %s" % self.network.name)
routers = Router.list(
@@ -1251,7 +1268,7 @@ class TestRvRRedundancy(cloudstackTestCase):
self.fail("Failed to stop master router: %s" % e)
# wait for VR to start and update state
- time.sleep(self.update_waiting_time)
+ time.sleep(self.services["sleep"])
self.debug("Checking state of the backup router in %s" % self.network.name)
routers = Router.list(
@@ -1327,7 +1344,7 @@ class TestRvRRedundancy(cloudstackTestCase):
self.fail("Failed to reboot MASTER router: %s" % e)
# wait for VR to update state
- time.sleep(self.update_waiting_time)
+ time.sleep(self.services["sleep"])
self.debug("Checking state of the master router in %s" % self.network.name)
routers = Router.list(
@@ -1420,7 +1437,7 @@ class TestRvRRedundancy(cloudstackTestCase):
self.fail("Failed to reboot BACKUP router: %s" % e)
# wait for VR to update state
- time.sleep(self.update_waiting_time)
+ time.sleep(self.services["sleep"])
self.debug("Checking state of the backup router in %s" % self.network.name)
routers = Router.list(
@@ -1528,8 +1545,8 @@ class TestRvRRedundancy(cloudstackTestCase):
)
self.assertIn(
routers[0].redundantstate,
- ['UNKNOWN', 'FAULT'],
- "Redundant state of the backup router should be UNKNOWN/FAULT but is %s" % routers[0].redundantstate
+ 'UNKNOWN',
+ "Redundant state of the backup router should be UNKNOWN but is %s" % routers[0].redundantstate
)
# Spawn an instance in that network