Skip to content

Commit 973e4ac

Browse files
committed
Adjust tests to match new behavior of chkpt on final connection Drop
1 parent 0cb1a07 commit 973e4ac

File tree

2 files changed

+7
-3
lines changed

2 files changed

+7
-3
lines changed

tests/integration/query_processing/test_write_path.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -781,6 +781,9 @@ fn test_wal_bad_frame() -> anyhow::Result<()> {
781781
conn.execute("INSERT INTO t2(x) VALUES (1)")?;
782782
conn.execute("INSERT INTO t3(x) VALUES (1)")?;
783783
conn.execute("COMMIT")?;
784+
// disalbe auto checkpoint so we keep the state of the WAL file on disk and prevent
785+
// truncate checkpoint automatically on connection drop
786+
conn.wal_auto_checkpoint_disable();
784787
common::run_query_on_row(&tmp_db, &conn, "SELECT count(1) from t2", |row| {
785788
let x = row.get::<i64>(0).unwrap();
786789
assert_eq!(x, 1);
@@ -791,6 +794,7 @@ fn test_wal_bad_frame() -> anyhow::Result<()> {
791794
assert_eq!(x, 1);
792795
})
793796
.unwrap();
797+
794798
// Now let's modify last frame record
795799
let path = tmp_db.path.clone();
796800
let path = path.with_extension("db-wal");

tests/integration/storage/checksum.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,21 +34,21 @@ fn test_per_page_checksum() -> anyhow::Result<()> {
3434

3535
{
3636
let metadata = std::fs::metadata(&db_path)?;
37-
assert_eq!(metadata.len(), 4096, "db file should be exactly 4096 bytes");
37+
assert_eq!(metadata.len(), 8192, "db file should be exactly 8kb");
3838
}
3939

4040
// let's test that page actually contains checksum bytes
4141
{
4242
let file_contents = std::fs::read(&db_path)?;
4343
assert_eq!(
4444
file_contents.len(),
45-
4096,
45+
8192,
4646
"file contents should be 4096 bytes"
4747
);
4848

4949
// split the page: first 4088 bytes are actual page, last 8 bytes are checksum
5050
let actual_page = &file_contents[..4096 - 8];
51-
let checksum_bytes = &file_contents[4096 - 8..];
51+
let checksum_bytes = &file_contents[4096 - 8..4096];
5252
let stored_checksum = u64::from_le_bytes(checksum_bytes.try_into().unwrap());
5353

5454
let expected_checksum = twox_hash::XxHash3_64::oneshot(actual_page);

0 commit comments

Comments
 (0)