summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGreg Farnum <greg@inktank.com>2013-02-06 10:22:06 -0800
committerGreg Farnum <greg@inktank.com>2013-02-06 10:22:06 -0800
commitc0e1070f2f54bcd592a731c9b912669e6c7ca4ee (patch)
treed72dff059bdd48242268862677e4a66ad931b03c
parent1948a02bc888fadafc29cf2e6f0a92129c68fd4c (diff)
downloadceph-c0e1070f2f54bcd592a731c9b912669e6c7ca4ee.tar.gz
test: fix Throttle unit test.
A bunch of these are slightly racy so they're enclosed in loops. This particular one, though, changes the Throttle state in ways that invalidate the asserts. To fix, reset the state before commencing a rerun. Signed-off-by: Greg Farnum <greg@inktank.com>
-rw-r--r--src/test/common/Throttle.cc7
1 files changed, 5 insertions, 2 deletions
diff --git a/src/test/common/Throttle.cc b/src/test/common/Throttle.cc
index f50ef2e1b7b..60d7daebdac 100644
--- a/src/test/common/Throttle.cc
+++ b/src/test/common/Throttle.cc
@@ -193,10 +193,13 @@ TEST_F(ThrottleTest, wait) {
t.join();
- if (!(waited = t.waited))
+ if (!(waited = t.waited)) {
delay *= 2;
+ // undo the changes we made
+ throttle.put(throttle_max / 2);
+ throttle.wait(throttle_max);
+ }
} while(!waited);
-
}
TEST_F(ThrottleTest, destructor) {