A zippy change broke test assumptions about the size of compressed output.
Fix the tests by allowing more slop in zippy's behavior. ------------- Created by MOE: https://github.com/google/moe MOE_MIGRATED_REVID=123432472
This commit is contained in:
parent
06a191b8de
commit
fa6dc010a2
@ -853,12 +853,20 @@ TEST(TableTest, ApproximateOffsetOfCompressed) {
|
|||||||
options.compression = kSnappyCompression;
|
options.compression = kSnappyCompression;
|
||||||
c.Finish(options, &keys, &kvmap);
|
c.Finish(options, &keys, &kvmap);
|
||||||
|
|
||||||
ASSERT_TRUE(Between(c.ApproximateOffsetOf("abc"), 0, 0));
|
// Expected upper and lower bounds of space used by compressible strings.
|
||||||
ASSERT_TRUE(Between(c.ApproximateOffsetOf("k01"), 0, 0));
|
static const int kSlop = 1000; // Compressor effectiveness varies.
|
||||||
ASSERT_TRUE(Between(c.ApproximateOffsetOf("k02"), 0, 0));
|
const int expected = 2500; // 10000 * compression ratio (0.25)
|
||||||
ASSERT_TRUE(Between(c.ApproximateOffsetOf("k03"), 2000, 3000));
|
const int min_z = expected - kSlop;
|
||||||
ASSERT_TRUE(Between(c.ApproximateOffsetOf("k04"), 2000, 3000));
|
const int max_z = expected + kSlop;
|
||||||
ASSERT_TRUE(Between(c.ApproximateOffsetOf("xyz"), 4000, 6000));
|
|
||||||
|
ASSERT_TRUE(Between(c.ApproximateOffsetOf("abc"), 0, kSlop));
|
||||||
|
ASSERT_TRUE(Between(c.ApproximateOffsetOf("k01"), 0, kSlop));
|
||||||
|
ASSERT_TRUE(Between(c.ApproximateOffsetOf("k02"), 0, kSlop));
|
||||||
|
// Have now emitted a large compressible string, so adjust expected offset.
|
||||||
|
ASSERT_TRUE(Between(c.ApproximateOffsetOf("k03"), min_z, max_z));
|
||||||
|
ASSERT_TRUE(Between(c.ApproximateOffsetOf("k04"), min_z, max_z));
|
||||||
|
// Have now emitted two large compressible strings, so adjust expected offset.
|
||||||
|
ASSERT_TRUE(Between(c.ApproximateOffsetOf("xyz"), 2 * min_z, 2 * max_z));
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace leveldb
|
} // namespace leveldb
|
||||||
|
Loading…
Reference in New Issue
Block a user