diff options
author | Tor Egge <Tor.Egge@yahoo-inc.com> | 2017-03-07 14:16:35 +0000 |
---|---|---|
committer | Tor Egge <Tor.Egge@yahoo-inc.com> | 2017-03-07 14:16:35 +0000 |
commit | c75dff6987de2e3fae07dd1ca6802f6525d70b0d (patch) | |
tree | 88b5e2769d376a8b24c362616da26f1e76a9a26f /searchcore/src/tests/proton/bucketdb | |
parent | a0128c5cf975ba9362169699700969cdf0e6a6a9 (diff) |
Test that bucket checksum ignore document sizes.
Use document size when converting from bucket state to bucket info.
Test that bucket info contains document sizes.
Diffstat (limited to 'searchcore/src/tests/proton/bucketdb')
-rw-r--r-- | searchcore/src/tests/proton/bucketdb/bucketdb/bucketdb_test.cpp | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/searchcore/src/tests/proton/bucketdb/bucketdb/bucketdb_test.cpp b/searchcore/src/tests/proton/bucketdb/bucketdb/bucketdb_test.cpp index 9a329f19a7f..b5fa3ae044e 100644 --- a/searchcore/src/tests/proton/bucketdb/bucketdb/bucketdb_test.cpp +++ b/searchcore/src/tests/proton/bucketdb/bucketdb/bucketdb_test.cpp @@ -24,6 +24,7 @@ const Timestamp TIME_1(1u); const Timestamp TIME_2(2u); const Timestamp TIME_3(3u); constexpr uint32_t DOCSIZE_1(4096u); +constexpr uint32_t DOCSIZE_2(10000u); typedef BucketInfo::ReadyState RS; typedef SubDbType SDT; @@ -51,6 +52,9 @@ assertDocSizes(size_t ready, EXPECT_EQUAL(ready, state.getReadyDocSizes()); EXPECT_EQUAL(notReady, state.getNotReadyDocSizes()); EXPECT_EQUAL(removed, state.getRemovedDocSizes()); + BucketInfo info = state; + EXPECT_EQUAL(ready + notReady, info.getDocumentSize()); + EXPECT_EQUAL(ready + notReady + removed, info.getUsedSize()); } void @@ -163,6 +167,16 @@ TEST_F("require that bucket can be cached", Fixture) f.remove(TIME_2, SDT::NOTREADY); } +TEST_F("require that bucket checksum ignores document sizes", Fixture) +{ + auto state1 = f.add(TIME_1, DOCSIZE_1, SDT::READY); + f.remove(TIME_1, DOCSIZE_1, SDT::READY); + auto state2 = f.add(TIME_1, DOCSIZE_2, SDT::READY); + f.remove(TIME_1, DOCSIZE_2, SDT::READY); + EXPECT_NOT_EQUAL(state1.getReadyDocSizes(), state2.getReadyDocSizes()); + EXPECT_EQUAL(state1.getChecksum(), state2.getChecksum()); +} + TEST("require that bucket db can be explored") { BucketDBOwner db; |