diff options
author | Tor Egge <Tor.Egge@online.no> | 2022-11-25 14:03:28 +0100 |
---|---|---|
committer | Tor Egge <Tor.Egge@online.no> | 2022-11-25 14:03:28 +0100 |
commit | e032c412d80cd303c00b3875c5609b24bd2d9be9 (patch) | |
tree | 54a84b2154b388ea5995195d3aeb3b80edc10683 /searchcore | |
parent | d9d7d10db229ccc24e11333aae1d08070a534bf5 (diff) |
Update unit test for handling removes in attribute writer.
Diffstat (limited to 'searchcore')
-rw-r--r-- | searchcore/src/tests/proton/attribute/attribute_test.cpp | 26 |
1 files changed, 10 insertions, 16 deletions
diff --git a/searchcore/src/tests/proton/attribute/attribute_test.cpp b/searchcore/src/tests/proton/attribute/attribute_test.cpp index c1f2e9c897d..75d9c78d07e 100644 --- a/searchcore/src/tests/proton/attribute/attribute_test.cpp +++ b/searchcore/src/tests/proton/attribute/attribute_test.cpp @@ -354,23 +354,17 @@ TEST_F(AttributeWriterTest, handles_remove) { auto a1 = addAttribute("a1"); auto a2 = addAttribute("a2"); + constexpr SerialNum fill_serial_num = 2; allocAttributeWriter(); - fillAttribute(a1, 1, 10, 1); - fillAttribute(a2, 1, 20, 1); - - remove(2, 0); - - assertUndefined(*a1, 0); - assertUndefined(*a2, 0); - - remove(2, 0); // same sync token as previous - try { - remove(1, 0); // lower sync token than previous - EXPECT_TRUE(true); // update is ignored - } catch (vespalib::IllegalStateException & e) { - LOG(info, "Got expected exception: '%s'", e.getMessage().c_str()); - EXPECT_TRUE(true); - } + fillAttribute(a1, 1, 10, fill_serial_num); + fillAttribute(a2, 1, 20, fill_serial_num); + remove(fill_serial_num - 1, 1); // lower sync token than during fill => ignored + remove(fill_serial_num, 1); // same sync token as during fill => ignored + EXPECT_EQ(10, a1->getInt(1)); + EXPECT_EQ(20, a2->getInt(1)); + remove(fill_serial_num + 1, 1); // newer sync token => not ignored + assertUndefined(*a1, 1); + assertUndefined(*a2, 1); } TEST_F(AttributeWriterTest, handles_batch_remove) |