mirror of https://github.com/facebook/rocksdb.git
fix rate limiter test flakiness
Summary: fix when elapsed time spans non-integral number of intervals since the rate limiter may still be drained during a partial interval. Closes https://github.com/facebook/rocksdb/pull/1948 Differential Revision: D4651304 Pulled By: ajkr fbshipit-source-id: b1f9e70
This commit is contained in:
parent
7c80a6d7d1
commit
4561275c2d
|
@ -2824,7 +2824,7 @@ TEST_F(DBTest, RateLimitingTest) {
|
|||
// Most intervals should've been drained (interval time is 100ms, elapsed is
|
||||
// micros)
|
||||
ASSERT_GT(rate_limiter_drains, elapsed / 100000 / 2);
|
||||
ASSERT_LE(rate_limiter_drains, elapsed / 100000);
|
||||
ASSERT_LE(rate_limiter_drains, elapsed / 100000 + 1);
|
||||
double ratio = env_->bytes_written_ * 1000000 / elapsed / raw_rate;
|
||||
fprintf(stderr, "write rate ratio = %.2lf, expected 0.7\n", ratio);
|
||||
ASSERT_TRUE(ratio < 0.8);
|
||||
|
@ -2850,7 +2850,7 @@ TEST_F(DBTest, RateLimitingTest) {
|
|||
// Most intervals should've been drained (interval time is 100ms, elapsed is
|
||||
// micros)
|
||||
ASSERT_GT(rate_limiter_drains, elapsed / 100000 / 2);
|
||||
ASSERT_LE(rate_limiter_drains, elapsed / 100000);
|
||||
ASSERT_LE(rate_limiter_drains, elapsed / 100000 + 1);
|
||||
ratio = env_->bytes_written_ * 1000000 / elapsed / raw_rate;
|
||||
fprintf(stderr, "write rate ratio = %.2lf, expected 0.5\n", ratio);
|
||||
ASSERT_LT(ratio, 0.6);
|
||||
|
|
Loading…
Reference in New Issue