From c9a761726d141bcaa8ba7851150f71a8130b473a Mon Sep 17 00:00:00 2001 From: Martin Schwenke Date: Sun, 1 Aug 2010 11:39:30 +1000 Subject: [PATCH] Testing: In IP allocation simulation count total number of events. This starts at -1 because we always have to do the initial allocation. No longer print event number for each event by default, only when verbose is enabled. Signed-off-by: Martin Schwenke --- tests/takeover/ctdb_takeover.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/tests/takeover/ctdb_takeover.py b/tests/takeover/ctdb_takeover.py index a25ecee5..3c5a69da 100755 --- a/tests/takeover/ctdb_takeover.py +++ b/tests/takeover/ctdb_takeover.py @@ -119,6 +119,7 @@ class Cluster(object): self.ip_moves = [] self.grat_ip_moves = [] self.imbalance = [] + self.events = -1 def __str__(self): return "\n".join(["%2d %s %s" % @@ -130,6 +131,7 @@ class Cluster(object): def print_statistics(self): print_begin("STATISTICS") + print "Events: %6d" % self.events print "Total IP moves: %6d" % sum(self.ip_moves) print "Gratuitous IP moves: %6d" % sum(self.grat_ip_moves) print "Max imbalance: %6d" % max(self.imbalance) @@ -197,8 +199,8 @@ class Cluster(object): def random_iterations(self): i = 1 while i <= options.iterations: - print_begin("EVENT %d" % i) - print_end() + verbose_begin("EVENT %d" % i) + verbose_end() self.do_something_random() if self.recover() and options.exit > 0: break @@ -340,6 +342,8 @@ class Cluster(object): global options + self.events += 1 + # Don't bother with the num_healthy stuff. It is an # irrelevant detail. -- 2.34.1