Permalink
Browse files

MB-100: wait_for_ns_servers_or_assert with wait_if_warmup param

wait_if_warmup=True is useful in tearDown method for (auto)failover tests to track warmup stats

Change-Id: I24b04c1b08a75670b8eaaf1309c9a14d607fad4c
Reviewed-on: http://review.couchbase.org/22611
Tested-by: buildbot <build@couchbase.com>
Reviewed-by: Andrei Baranouski <andrei.baranouski@gmail.com>
  • Loading branch information...
andreibaranouski committed Nov 18, 2012
1 parent 3666b7a commit 43b622de24697288f03d25488d2405110017e340
Showing with 13 additions and 4 deletions.
  1. +13 −4 lib/membase/helper/cluster_helper.py
@@ -75,15 +75,24 @@ def add_all_nodes_or_assert(master, all_servers, rest_settings, test_case):
log.error("unable to add all the nodes to the cluster")
return otpNodes
-
+ #wait_if_warmup=True is useful in tearDown method for (auto)failover tests
@staticmethod
- def wait_for_ns_servers_or_assert(servers, testcase):
+ def wait_for_ns_servers_or_assert(servers, testcase, wait_time=360, wait_if_warmup=False):
for server in servers:
rest = RestConnection(server)
log = logger.Logger.get_logger()
log.info("waiting for ns_server @ {0}:{1}".format(server.ip, server.port))
- testcase.assertTrue(RestHelper(rest).is_ns_server_running(),
- "ns_server is not running in {0}".format(server.ip))
+ if RestHelper(rest).is_ns_server_running(wait_time):
+ log.info("ns_server @ {0}:{1} is running".format(server.ip, server.port))
+ elif wait_if_warmup:
+ # wait when warmup completed
+ buckets = rest.get_buckets()
+ for bucket in buckets:
+ testcase.assertTrue(ClusterOperationHelper._wait_warmup_completed(testcase, \
+ [server], bucket.name, wait_time), "warmup was not completed!")
+
+ else:
+ testcase.fail("ns_server {0} is not running in {1} sec".format(server.ip, wait_time))
#returns true if warmup is completed in wait_time sec
#otherwise return false

0 comments on commit 43b622d

Please sign in to comment.