From ec8610f7566b74ea36399db020007fb878d013eb Mon Sep 17 00:00:00 2001 From: Girish Shilamkar Date: Fri, 27 Dec 2013 10:53:42 +0530 Subject: [PATCH] CLOUDSTACK-5638: Fixed code to check router state --- test/integration/component/test_routers.py | 25 +++++++++++++++++----- 1 file changed, 20 insertions(+), 5 deletions(-) diff --git a/test/integration/component/test_routers.py b/test/integration/component/test_routers.py index 5f1ebc6b354..f8359f0e2c5 100644 --- a/test/integration/component/test_routers.py +++ b/test/integration/component/test_routers.py @@ -350,16 +350,31 @@ class TestRouterServices(cloudstackTestCase): "Check list router response" ) # Router associated with account should be in running state - for router in routers: - self.debug("Router ID: %s & Router state: %s" % ( + timeout = 180 + router = routers[0] + self.debug("Router ID: %s & Router state: %s" % ( router.id, router.state )) - self.assertEqual( + self.debug("Wait for %s secs max for router to reach Running state" % timeout) + while timeout: + time.sleep(60) + routers = list_routers( + self.apiclient, + account=self.account.name, + domainid=self.account.domainid, + id=router.id) + router = routers[0] + if router.state == 'Running': + break + + timeout = timeout - 60 + if timeout == 0: + self.assertEqual( router.state, 'Running', - "Check list router response for router state" - ) + "Router not in Running state") + # Network state associated with account should be 'Implemented' networks = list_networks(