diff options
author | Tor Egge <Tor.Egge@broadpark.no> | 2020-09-23 16:54:17 +0200 |
---|---|---|
committer | Tor Egge <Tor.Egge@broadpark.no> | 2020-09-23 16:54:17 +0200 |
commit | 6be01d9580160c186b9a4435258dfdf4fa788691 (patch) | |
tree | 360f579201376e98664489117bf994fedcba7646 /searchcore/src/tests/proton/attribute | |
parent | 4f2572fa8b1e50ca7e36b3a0fdf2baac59c6cbec (diff) |
Ignore force commit with serial number not greater than attribute vector create serial number.
Diffstat (limited to 'searchcore/src/tests/proton/attribute')
-rw-r--r-- | searchcore/src/tests/proton/attribute/attribute_test.cpp | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/searchcore/src/tests/proton/attribute/attribute_test.cpp b/searchcore/src/tests/proton/attribute/attribute_test.cpp index 41de6827244..8711a21e5e6 100644 --- a/searchcore/src/tests/proton/attribute/attribute_test.cpp +++ b/searchcore/src/tests/proton/attribute/attribute_test.cpp @@ -192,6 +192,11 @@ public: void assertExecuteHistory(std::vector<uint32_t> expExecuteHistory) { EXPECT_EQ(expExecuteHistory, _attributeFieldWriter->getExecuteHistory()); } + SerialNum test_force_commit(AttributeVector &attr, SerialNum serialNum) { + commit(serialNum); + _attributeFieldWriter->sync(); + return attr.getStatus().getLastSyncToken(); + } }; AttributeWriterTest::~AttributeWriterTest() = default; @@ -975,6 +980,15 @@ TEST_F(AttributeWriterTest, forceCommit_clears_search_cache_in_imported_attribut EXPECT_EQ(0u, _mgr->getImportedAttributes()->get("imported_b")->getSearchCache()->size()); } +TEST_F(AttributeWriterTest, ignores_force_commit_serial_not_greater_than_create_serial) +{ + auto a1 = addAttribute("a1"); + a1->setCreateSerialNum(100); + EXPECT_EQ(0u, test_force_commit(*a1, 50u)); + EXPECT_EQ(0u, test_force_commit(*a1, 100u)); + EXPECT_EQ(150u, test_force_commit(*a1, 150u)); +} + class StructWriterTestBase : public AttributeWriterTest { public: DocumentType _type; |