@@ -72,6 +72,32 @@ TEST_F(wal_history_test, append_and_list) {
7272 EXPECT_EQ (records[1 ].epoch , 200u );
7373}
7474
75+ TEST_F (wal_history_test, write_record_and_list_consistency) {
76+ wal_history_testable wh (test_dir);
77+ boost::filesystem::path file_path = test_dir / " wal_history" ;
78+
79+ auto ofs = std::ofstream (file_path.string (), std::ios::binary);
80+ std::vector<epoch_id_type> epochs = {42 , 43 , 44 };
81+ std::vector<boost::uuids::uuid> uuids;
82+ std::vector<std::int64_t > timestamps;
83+ for (size_t i = 0 ; i < epochs.size (); ++i) {
84+ boost::uuids::uuid uuid = {};
85+ std::int64_t timestamp = 1234567890 + i;
86+ wh.write_record (ofs, epochs[i], uuid, timestamp);
87+ uuids.push_back (uuid);
88+ timestamps.push_back (timestamp);
89+ }
90+ ofs.close ();
91+
92+ auto records = wh.list ();
93+ ASSERT_EQ (records.size (), epochs.size ());
94+ for (size_t i = 0 ; i < epochs.size (); ++i) {
95+ EXPECT_EQ (records[i].epoch , epochs[i]);
96+ EXPECT_EQ (records[i].uuid , uuids[i]);
97+ EXPECT_EQ (records[i].timestamp , timestamps[i]);
98+ }
99+ }
100+
75101TEST_F (wal_history_test, check_and_recover_tmp_only) {
76102 wal_history wh (test_dir);
77103 wh.append (1 );
0 commit comments