From 615ccf6789b2a99fbdc18981a3d720ad0bbced23 Mon Sep 17 00:00:00 2001 From: Jussi Saurio Date: Mon, 14 Jul 2025 12:30:17 +0300 Subject: [PATCH] test/fuzz: fix rowid_seek_fuzz The original `rowid_seek_fuzz` test had a design flaw: it inserted contiguous integers, which prevented issues such as the one fixed in #2065 from being discovered. Further, the test has at some point also been neutered a bit by only inserting 100 values which makes the btree very small, hiding interactions between interior pages and neighboring leaf pages. This should not be merged until #2065 is merged. --- tests/integration/fuzz/mod.rs | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/tests/integration/fuzz/mod.rs b/tests/integration/fuzz/mod.rs index 0387563c7..571985ffb 100644 --- a/tests/integration/fuzz/mod.rs +++ b/tests/integration/fuzz/mod.rs @@ -64,9 +64,19 @@ mod tests { let db = TempDatabase::new_with_rusqlite("CREATE TABLE t(x INTEGER PRIMARY KEY)", false); // INTEGER PRIMARY KEY is a rowid alias, so an index is not created let sqlite_conn = rusqlite::Connection::open(db.path.clone()).unwrap(); + let (mut rng, _seed) = rng_from_time_or_env(); + + let mut values: Vec = Vec::with_capacity(3000); + while values.len() < 3000 { + let val = rng.random_range(-100000..100000); + if !values.contains(&val) { + values.push(val); + } + } let insert = format!( "INSERT INTO t VALUES {}", - (1..100) + values + .iter() .map(|x| format!("({x})")) .collect::>() .join(", ")