]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
test: fix Throttle unit test.
authorGreg Farnum <greg@inktank.com>
Wed, 6 Feb 2013 18:22:06 +0000 (10:22 -0800)
committerGreg Farnum <greg@inktank.com>
Wed, 6 Feb 2013 18:22:06 +0000 (10:22 -0800)
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>
src/test/common/Throttle.cc

index f50ef2e1b7b98742d5d8274d388724b4cd3664f8..60d7daebdac214c2d9ad07172e804523eb4ce8c8 100644 (file)
@@ -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) {