diff options
author | Greg Farnum <greg@inktank.com> | 2013-02-06 10:22:06 -0800 |
---|---|---|
committer | Greg Farnum <greg@inktank.com> | 2013-02-06 10:22:06 -0800 |
commit | c0e1070f2f54bcd592a731c9b912669e6c7ca4ee (patch) | |
tree | d72dff059bdd48242268862677e4a66ad931b03c | |
parent | 1948a02bc888fadafc29cf2e6f0a92129c68fd4c (diff) | |
download | ceph-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.cc | 7 |
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) { |