1 // Copyright 2020 The Pigweed Authors
3 // Licensed under the Apache License, Version 2.0 (the "License"); you may not
4 // use this file except in compliance with the License. You may obtain a copy of
7 // https://www.apache.org/licenses/LICENSE-2.0
9 // Unless required by applicable law or agreed to in writing, software
10 // distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
11 // WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
12 // License for the specific language governing permissions and limitations under
15 #include "pw_kvs/internal/entry.h"
18 #include <string_view>
20 #include "gtest/gtest.h"
21 #include "pw_bytes/array.h"
22 #include "pw_kvs/alignment.h"
23 #include "pw_kvs/checksum.h"
24 #include "pw_kvs/crc16_checksum.h"
25 #include "pw_kvs/fake_flash_memory.h"
26 #include "pw_kvs/flash_memory.h"
27 #include "pw_kvs/format.h"
29 namespace pw::kvs::internal {
33 using std::string_view;
35 // For magic value always use a random 32 bit integer rather than a human
36 // readable 4 bytes. See pw_kvs/format.h for more information.
37 constexpr EntryFormat kFormat{0x961c2ff9, nullptr};
39 TEST(Entry, Size_RoundsUpToAlignment) {
40 // Use FakeFlashMemory, rather than FakeFlashMemoryBuffer, so the class gets
41 // tested/used directly.
42 std::array<std::byte, 64 * 2> buffer;
44 // Flash alignment needs to be 1 due to how the partition is used in this
46 FakeFlashMemory flash(buffer, 64, 2, 1);
48 for (size_t alignment_bytes = 1; alignment_bytes <= 4096; ++alignment_bytes) {
49 FlashPartition partition(&flash, 0, flash.sector_count(), alignment_bytes);
50 const size_t align = AlignUp(alignment_bytes, Entry::kMinAlignmentBytes);
52 for (size_t value : {size_t(0), align - 1, align, align + 1, 2 * align}) {
54 Entry::Valid(partition, 0, kFormat, "k", {nullptr, value}, 0);
56 ASSERT_EQ(AlignUp(sizeof(EntryHeader) + 1 /* key */ + value, align),
60 Entry entry = Entry::Tombstone(partition, 0, kFormat, "k", 0);
61 ASSERT_EQ(AlignUp(sizeof(EntryHeader) + 1 /* key */, align), entry.size());
65 TEST(Entry, Construct_ValidEntry) {
66 FakeFlashMemoryBuffer<64, 2> flash(16);
67 FlashPartition partition(&flash, 0, flash.sector_count());
69 auto entry = Entry::Valid(
70 partition, 1, kFormat, "k", std::as_bytes(std::span("123")), 9876);
72 EXPECT_FALSE(entry.deleted());
73 EXPECT_EQ(entry.magic(), kFormat.magic);
74 EXPECT_EQ(entry.value_size(), sizeof("123"));
75 EXPECT_EQ(entry.transaction_id(), 9876u);
78 TEST(Entry, Construct_Tombstone) {
79 FakeFlashMemoryBuffer<64, 2> flash(16);
80 FlashPartition partition(&flash, 0, flash.sector_count());
82 auto entry = Entry::Tombstone(partition, 1, kFormat, "key", 123);
84 EXPECT_TRUE(entry.deleted());
85 EXPECT_EQ(entry.magic(), kFormat.magic);
86 EXPECT_EQ(entry.value_size(), 0u);
87 EXPECT_EQ(entry.transaction_id(), 123u);
90 // For magic value always use a unique random 32 bit integer rather than a human
91 // readable 4 bytes. See pw_kvs/format.h for more information.
92 constexpr uint32_t kMagicWithChecksum = 0xad165142;
93 constexpr uint32_t kTransactionId1 = 0x96979899;
95 constexpr auto kKey1 = bytes::String("key45");
96 constexpr auto kValue1 = bytes::String("VALUE!");
97 constexpr auto kPadding1 = bytes::String("\0\0\0\0\0");
99 constexpr auto kHeader1 = bytes::Concat(kMagicWithChecksum,
100 uint32_t(0x23aa), // checksum (CRC16)
101 uint8_t(1), // alignment (32 B)
102 uint8_t(kKey1.size()), // key length
103 uint16_t(kValue1.size()), // value size
104 kTransactionId1 // transaction ID
107 constexpr auto kEntryWithoutPadding1 = bytes::Concat(kHeader1, kKey1, kValue1);
108 constexpr auto kEntry1 = bytes::Concat(kEntryWithoutPadding1, kPadding1);
109 static_assert(kEntry1.size() == 32);
111 ChecksumCrc16 default_checksum;
112 constexpr EntryFormat kFormatWithChecksum{kMagicWithChecksum,
114 constexpr internal::EntryFormats kFormats(kFormatWithChecksum);
116 class ValidEntryInFlash : public ::testing::Test {
118 ValidEntryInFlash() : flash_(kEntry1), partition_(&flash_) {
119 EXPECT_EQ(OkStatus(), Entry::Read(partition_, 0, kFormats, &entry_));
122 FakeFlashMemoryBuffer<1024, 4> flash_;
123 FlashPartition partition_;
127 TEST_F(ValidEntryInFlash, PassesChecksumVerification) {
128 EXPECT_EQ(OkStatus(), entry_.VerifyChecksumInFlash());
129 EXPECT_EQ(OkStatus(), entry_.VerifyChecksum("key45", kValue1));
132 TEST_F(ValidEntryInFlash, HeaderContents) {
133 EXPECT_EQ(entry_.magic(), kMagicWithChecksum);
134 EXPECT_EQ(entry_.key_length(), 5u);
135 EXPECT_EQ(entry_.value_size(), 6u);
136 EXPECT_EQ(entry_.transaction_id(), kTransactionId1);
137 EXPECT_FALSE(entry_.deleted());
140 TEST_F(ValidEntryInFlash, ReadKey) {
141 Entry::KeyBuffer key = {};
142 auto result = entry_.ReadKey(key);
144 ASSERT_EQ(OkStatus(), result.status());
145 EXPECT_EQ(result.size(), entry_.key_length());
146 EXPECT_STREQ(key.data(), "key45");
149 TEST_F(ValidEntryInFlash, ReadValue) {
151 auto result = entry_.ReadValue(std::as_writable_bytes(std::span(value)));
153 ASSERT_EQ(OkStatus(), result.status());
154 EXPECT_EQ(result.size(), entry_.value_size());
155 EXPECT_STREQ(value, "VALUE!");
158 TEST_F(ValidEntryInFlash, ReadValue_BufferTooSmall) {
160 auto result = entry_.ReadValue(std::as_writable_bytes(std::span(value)));
162 ASSERT_EQ(Status::ResourceExhausted(), result.status());
163 EXPECT_EQ(3u, result.size());
164 EXPECT_EQ(value[0], 'V');
165 EXPECT_EQ(value[1], 'A');
166 EXPECT_EQ(value[2], 'L');
169 TEST_F(ValidEntryInFlash, ReadValue_WithOffset) {
171 auto result = entry_.ReadValue(std::as_writable_bytes(std::span(value)), 3);
173 ASSERT_EQ(OkStatus(), result.status());
174 EXPECT_EQ(3u, result.size());
175 EXPECT_EQ(value[0], 'U');
176 EXPECT_EQ(value[1], 'E');
177 EXPECT_EQ(value[2], '!');
180 TEST_F(ValidEntryInFlash, ReadValue_WithOffset_BufferTooSmall) {
182 auto result = entry_.ReadValue(std::as_writable_bytes(std::span(value)), 4);
184 ASSERT_EQ(Status::ResourceExhausted(), result.status());
185 EXPECT_EQ(1u, result.size());
186 EXPECT_EQ(value[0], 'E');
189 TEST_F(ValidEntryInFlash, ReadValue_WithOffset_EmptyRead) {
190 char value[16] = {'?'};
191 auto result = entry_.ReadValue(std::as_writable_bytes(std::span(value)), 6);
193 ASSERT_EQ(OkStatus(), result.status());
194 EXPECT_EQ(0u, result.size());
195 EXPECT_EQ(value[0], '?');
198 TEST_F(ValidEntryInFlash, ReadValue_WithOffset_PastEnd) {
200 auto result = entry_.ReadValue(std::as_writable_bytes(std::span(value)), 7);
202 EXPECT_EQ(Status::OutOfRange(), result.status());
203 EXPECT_EQ(0u, result.size());
206 TEST(ValidEntry, Write) {
207 FakeFlashMemoryBuffer<1024, 4> flash;
208 FlashPartition partition(&flash, 0, flash.sector_count(), 32);
210 Entry entry = Entry::Valid(
211 partition, 64, kFormatWithChecksum, "key45", kValue1, kTransactionId1);
213 auto result = entry.Write("key45", kValue1);
214 EXPECT_EQ(OkStatus(), result.status());
215 EXPECT_EQ(32u, result.size());
216 EXPECT_EQ(std::memcmp(&flash.buffer()[64], kEntry1.data(), kEntry1.size()),
220 constexpr auto kHeader2 = bytes::String(
221 "\x42\x51\x16\xad" // magic
222 "\xba\xb3\x00\x00" // checksum (CRC16)
225 "\xff\xff" // value size
226 "\x00\x01\x02\x03" // transaction ID
229 constexpr auto kKeyAndPadding2 =
230 bytes::String("K\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0");
232 class TombstoneEntryInFlash : public ::testing::Test {
234 TombstoneEntryInFlash()
235 : flash_(bytes::Concat(kHeader2, kKeyAndPadding2)), partition_(&flash_) {
236 EXPECT_EQ(OkStatus(), Entry::Read(partition_, 0, kFormats, &entry_));
239 FakeFlashMemoryBuffer<1024, 4> flash_;
240 FlashPartition partition_;
244 TEST_F(TombstoneEntryInFlash, PassesChecksumVerification) {
245 EXPECT_EQ(OkStatus(), entry_.VerifyChecksumInFlash());
246 EXPECT_EQ(OkStatus(), entry_.VerifyChecksum("K", {}));
249 TEST_F(TombstoneEntryInFlash, HeaderContents) {
250 EXPECT_EQ(entry_.magic(), kMagicWithChecksum);
251 EXPECT_EQ(entry_.key_length(), 1u);
252 EXPECT_EQ(entry_.value_size(), 0u);
253 EXPECT_EQ(entry_.transaction_id(), 0x03020100u);
254 EXPECT_TRUE(entry_.deleted());
257 TEST_F(TombstoneEntryInFlash, ReadKey) {
258 Entry::KeyBuffer key = {};
259 auto result = entry_.ReadKey(key);
261 ASSERT_EQ(OkStatus(), result.status());
262 EXPECT_EQ(result.size(), entry_.key_length());
263 EXPECT_STREQ(key.data(), "K");
266 TEST_F(TombstoneEntryInFlash, ReadValue) {
268 auto result = entry_.ReadValue(std::as_writable_bytes(std::span(value)));
270 ASSERT_EQ(OkStatus(), result.status());
271 EXPECT_EQ(0u, result.size());
274 TEST(TombstoneEntry, Write) {
275 FakeFlashMemoryBuffer<1024, 4> flash;
276 FlashPartition partition(&flash);
277 ChecksumCrc16 checksum;
280 Entry::Tombstone(partition, 16, kFormatWithChecksum, "K", 0x03020100);
282 auto result = entry.Write("K", {});
283 EXPECT_EQ(OkStatus(), result.status());
284 EXPECT_EQ(32u, result.size());
285 EXPECT_EQ(std::memcmp(&flash.buffer()[16],
286 bytes::Concat(kHeader2, kKeyAndPadding2).data(),
291 TEST(Entry, Checksum_NoChecksumRequiresZero) {
292 FakeFlashMemoryBuffer<1024, 4> flash(kEntry1);
293 FlashPartition partition(&flash);
296 const EntryFormat format{kMagicWithChecksum, nullptr};
297 const internal::EntryFormats formats(format);
299 ASSERT_EQ(OkStatus(), Entry::Read(partition, 0, formats, &entry));
301 EXPECT_EQ(Status::DataLoss(), entry.VerifyChecksumInFlash());
302 EXPECT_EQ(Status::DataLoss(), entry.VerifyChecksum({}, {}));
304 std::memset(&flash.buffer()[4], 0, 4); // set the checksum field to 0
305 ASSERT_EQ(OkStatus(), Entry::Read(partition, 0, formats, &entry));
306 EXPECT_EQ(OkStatus(), entry.VerifyChecksumInFlash());
307 EXPECT_EQ(OkStatus(), entry.VerifyChecksum({}, {}));
310 TEST(Entry, Checksum_ChecksPadding) {
311 FakeFlashMemoryBuffer<1024, 4> flash(
312 bytes::Concat(kHeader1, kKey1, kValue1, bytes::String("\0\0\0\0\1")));
313 FlashPartition partition(&flash);
315 ASSERT_EQ(OkStatus(), Entry::Read(partition, 0, kFormats, &entry));
317 // Last byte in padding is a 1; should fail.
318 EXPECT_EQ(Status::DataLoss(), entry.VerifyChecksumInFlash());
320 // The in-memory verification fills in 0s for the padding.
321 EXPECT_EQ(OkStatus(), entry.VerifyChecksum("key45", kValue1));
323 flash.buffer()[kEntry1.size() - 1] = byte{0};
324 EXPECT_EQ(OkStatus(), entry.VerifyChecksumInFlash());
327 TEST_F(ValidEntryInFlash, Update_SameFormat_TransactionIdIsUpdated) {
328 ASSERT_EQ(OkStatus(),
329 entry_.Update(kFormatWithChecksum, kTransactionId1 + 3));
331 EXPECT_EQ(kFormatWithChecksum.magic, entry_.magic());
332 EXPECT_EQ(0u, entry_.address());
333 EXPECT_EQ(kTransactionId1 + 3, entry_.transaction_id());
334 EXPECT_FALSE(entry_.deleted());
337 TEST_F(ValidEntryInFlash,
338 Update_DifferentFormat_MagicAndTransactionIdAreUpdated) {
339 ASSERT_EQ(OkStatus(), entry_.Update(kFormat, kTransactionId1 + 6));
341 EXPECT_EQ(kFormat.magic, entry_.magic());
342 EXPECT_EQ(0u, entry_.address());
343 EXPECT_EQ(kTransactionId1 + 6, entry_.transaction_id());
344 EXPECT_FALSE(entry_.deleted());
347 TEST_F(ValidEntryInFlash, Update_ReadError_WithChecksumIsError) {
348 flash_.InjectReadError(FlashError::Unconditional(Status::Aborted()));
350 EXPECT_EQ(Status::Aborted(),
351 entry_.Update(kFormatWithChecksum, kTransactionId1 + 1));
354 // For magic value always use a random 32 bit integer rather than a human
355 // readable 4 bytes. See pw_kvs/format.h for more information.
356 constexpr EntryFormat kNoChecksumFormat{.magic = 0x721bad24,
357 .checksum = nullptr};
359 TEST_F(ValidEntryInFlash, Update_ReadError_NoChecksumIsOkay) {
360 flash_.InjectReadError(FlashError::Unconditional(Status::Aborted()));
362 EXPECT_EQ(OkStatus(), entry_.Update(kNoChecksumFormat, kTransactionId1 + 1));
365 TEST_F(ValidEntryInFlash, Copy) {
366 auto result = entry_.Copy(123);
368 EXPECT_EQ(OkStatus(), result.status());
369 EXPECT_EQ(entry_.size(), result.size());
372 &flash_.buffer().data()[123], kEntry1.data(), kEntry1.size()));
375 TEST_F(ValidEntryInFlash, Copy_ReadError) {
376 flash_.InjectReadError(FlashError::Unconditional(Status::Unimplemented()));
377 auto result = entry_.Copy(kEntry1.size());
378 EXPECT_EQ(Status::Unimplemented(), result.status());
379 EXPECT_EQ(0u, result.size());
382 constexpr uint32_t ByteSum(std::span<const byte> bytes, uint32_t value = 0) {
383 for (byte b : bytes) {
384 value += unsigned(b);
389 // Sums the bytes, adding one to each byte so that zeroes change the checksum.
390 class ChecksumSummation final : public ChecksumAlgorithm {
393 : ChecksumAlgorithm(std::as_bytes(std::span(&sum_, 1))), sum_(0) {}
395 void Reset() override { sum_ = 0; }
397 void Update(std::span<const byte> data) override {
398 for (byte b : data) {
399 sum_ += unsigned(b) + 1; // Add 1 so zero-value bytes affect checksum.
407 // For magic value always use a random 32 bit integer rather than a human
408 // readable 4 bytes. See pw_kvs/format.h for more information.
409 constexpr uint32_t kMagicWithSum = 0x6093aadb;
410 constexpr EntryFormat kFormatWithSum{kMagicWithSum, &sum_checksum};
411 constexpr internal::EntryFormats kFormatsWithSum(kFormatWithSum);
413 template <size_t alignment>
414 constexpr auto MakeNewFormatWithSumEntry() {
415 constexpr uint8_t alignment_units = (alignment + 15) / 16 - 1;
416 constexpr size_t size = AlignUp(kEntryWithoutPadding1.size(), alignment);
418 constexpr uint32_t checksum =
419 ByteSum(bytes::Concat(kFormatWithSum.magic)) + 0 /* checksum */ +
420 alignment_units + kKey1.size() + kValue1.size() +
421 ByteSum(bytes::Concat(kTransactionId1 + 1)) + ByteSum(kKey1) +
422 ByteSum(kValue1) + size /* +1 for each byte in the checksum */;
424 constexpr auto kNewHeader1 =
425 bytes::Concat(kFormatWithSum.magic, // magic
426 checksum, // checksum (byte sum)
427 alignment_units, // alignment (in 16 B units)
428 uint8_t(kKey1.size()), // key length
429 uint16_t(kValue1.size()), // value size
430 kTransactionId1 + 1); // transaction ID
431 constexpr size_t padding = Padding(kEntryWithoutPadding1.size(), alignment);
432 return bytes::Concat(
433 kNewHeader1, kKey1, kValue1, bytes::Initialized<padding>(0));
436 TEST_F(ValidEntryInFlash, UpdateAndCopy_DifferentFormatSmallerAlignment) {
437 // Uses 16-bit alignment, smaller than the original entry's alignment.
438 ASSERT_EQ(OkStatus(), entry_.Update(kFormatWithSum, kTransactionId1 + 1));
440 StatusWithSize result = entry_.Copy(kEntry1.size());
441 ASSERT_EQ(OkStatus(), result.status());
442 EXPECT_EQ(kEntry1.size(), result.size());
444 constexpr auto new_data = MakeNewFormatWithSumEntry<16>();
445 static_assert(new_data.size() == 32);
450 &flash_.buffer()[kEntry1.size()], new_data.data(), new_data.size()));
452 ASSERT_EQ(OkStatus(),
453 Entry::Read(partition_, 32, kFormatsWithSum, &new_entry));
454 EXPECT_EQ(OkStatus(), new_entry.VerifyChecksumInFlash());
455 EXPECT_EQ(kFormatWithSum.magic, new_entry.magic());
456 EXPECT_EQ(kTransactionId1 + 1, new_entry.transaction_id());
459 TEST(ValidEntryInFlash, UpdateAndCopy_DifferentFormatSameAlignment) {
460 // Use 32-bit alignment, the same as the original entry's alignment.
461 FakeFlashMemoryBuffer<1024, 4> flash(kEntry1);
462 FlashPartition partition(&flash, 0, 4, 32);
464 ASSERT_EQ(OkStatus(), Entry::Read(partition, 0, kFormats, &entry));
466 ASSERT_EQ(OkStatus(), entry.Update(kFormatWithSum, kTransactionId1 + 1));
468 StatusWithSize result = entry.Copy(32);
469 ASSERT_EQ(OkStatus(), result.status());
470 EXPECT_EQ(AlignUp(kEntry1.size(), 32), result.size());
472 constexpr auto new_data = MakeNewFormatWithSumEntry<32>();
473 static_assert(new_data.size() == 32);
476 std::memcmp(&flash.buffer()[32], new_data.data(), new_data.size()));
479 ASSERT_EQ(OkStatus(),
480 Entry::Read(partition, 32, kFormatsWithSum, &new_entry));
481 EXPECT_EQ(OkStatus(), new_entry.VerifyChecksumInFlash());
482 EXPECT_EQ(kTransactionId1 + 1, new_entry.transaction_id());
485 TEST(ValidEntryInFlash, UpdateAndCopy_DifferentFormatLargerAlignment) {
486 // Use 64-bit alignment, larger than the original entry's alignment.
487 FakeFlashMemoryBuffer<1024, 4> flash(kEntry1);
488 FlashPartition partition(&flash, 0, 4, 64);
490 ASSERT_EQ(OkStatus(), Entry::Read(partition, 0, kFormats, &entry));
492 ASSERT_EQ(OkStatus(), entry.Update(kFormatWithSum, kTransactionId1 + 1));
494 StatusWithSize result = entry.Copy(64);
495 ASSERT_EQ(OkStatus(), result.status());
496 EXPECT_EQ(AlignUp(kEntry1.size(), 64), result.size());
498 constexpr auto new_data = MakeNewFormatWithSumEntry<64>();
499 static_assert(new_data.size() == 64);
502 std::memcmp(&flash.buffer()[64], new_data.data(), new_data.size()));
505 ASSERT_EQ(OkStatus(),
506 Entry::Read(partition, 64, kFormatsWithSum, &new_entry));
507 EXPECT_EQ(OkStatus(), new_entry.VerifyChecksumInFlash());
508 EXPECT_EQ(kTransactionId1 + 1, new_entry.transaction_id());
511 TEST_F(ValidEntryInFlash, UpdateAndCopy_NoChecksum_UpdatesToNewFormat) {
512 // For magic value always use a random 32 bit integer rather than a human
513 // readable 4 bytes. See pw_kvs/format.h for more information.
514 constexpr EntryFormat no_checksum{.magic = 0x43fae18f, .checksum = nullptr};
516 ASSERT_EQ(OkStatus(), entry_.Update(no_checksum, kTransactionId1 + 1));
518 auto result = entry_.Copy(kEntry1.size());
519 ASSERT_EQ(OkStatus(), result.status());
520 EXPECT_EQ(kEntry1.size(), result.size());
522 constexpr auto kNewHeader1 =
523 bytes::Concat(no_checksum.magic, // magic
524 uint32_t(0), // checksum (none)
525 uint8_t(0), // alignment (changed to 16 B from 32)
526 uint8_t(kKey1.size()), // key length
527 uint16_t(kValue1.size()), // value size
528 kTransactionId1 + 1); // transaction ID
529 constexpr auto kNewEntry1 =
530 bytes::Concat(kNewHeader1, kKey1, kValue1, kPadding1);
533 std::memcmp(&flash_.buffer()[kEntry1.size()],
538 TEST_F(ValidEntryInFlash, UpdateAndCopyMultple_DifferentFormat) {
539 ASSERT_EQ(OkStatus(), entry_.Update(kFormatWithSum, kTransactionId1 + 6));
541 FlashPartition::Address new_address = entry_.size();
543 for (int i = 0; i < 10; i++) {
544 StatusWithSize copy_result = entry_.Copy(new_address + (i * entry_.size()));
545 ASSERT_EQ(OkStatus(), copy_result.status());
546 ASSERT_EQ(kEntry1.size(), copy_result.size());
549 for (int j = 0; j < 10; j++) {
551 FlashPartition::Address read_address = (new_address + (j * entry_.size()));
552 ASSERT_EQ(OkStatus(),
553 Entry::Read(partition_, read_address, kFormatsWithSum, &entry));
555 EXPECT_EQ(OkStatus(), entry.VerifyChecksumInFlash());
556 EXPECT_EQ(kFormatWithSum.magic, entry.magic());
557 EXPECT_EQ(read_address, entry.address());
558 EXPECT_EQ(kTransactionId1 + 6, entry.transaction_id());
559 EXPECT_FALSE(entry.deleted());
563 TEST_F(ValidEntryInFlash, DifferentFormat_UpdatedCopy_FailsWithWrongMagic) {
564 ASSERT_EQ(OkStatus(), entry_.Update(kFormatWithSum, kTransactionId1 + 6));
566 FlashPartition::Address new_address = entry_.size();
568 StatusWithSize copy_result = entry_.Copy(new_address);
569 ASSERT_EQ(OkStatus(), copy_result.status());
570 ASSERT_EQ(kEntry1.size(), copy_result.size());
573 ASSERT_EQ(Status::DataLoss(),
574 Entry::Read(partition_, new_address, kFormats, &entry));
577 TEST_F(ValidEntryInFlash, UpdateAndCopy_WriteError) {
578 flash_.InjectWriteError(FlashError::Unconditional(Status::Cancelled()));
580 ASSERT_EQ(OkStatus(), entry_.Update(kNoChecksumFormat, kTransactionId1 + 1));
582 auto result = entry_.Copy(kEntry1.size());
583 EXPECT_EQ(Status::Cancelled(), result.status());
584 EXPECT_EQ(kEntry1.size(), result.size());
588 } // namespace pw::kvs::internal