diff --git a/tests/fuzz/mod.rs b/tests/fuzz/mod.rs index 9f06f20fc..e49e2a3c4 100644 --- a/tests/fuzz/mod.rs +++ b/tests/fuzz/mod.rs @@ -23,7 +23,7 @@ mod fuzz_tests { /// [See this issue for more info](https://github.com/tursodatabase/turso/issues/1763) #[test] pub fn fuzz_failure_issue_1763() { - let db = TempDatabase::new_empty(false); + let db = TempDatabase::new_empty(); let limbo_conn = db.connect_limbo(); let sqlite_conn = rusqlite::Connection::open_in_memory().unwrap(); let offending_query = "SELECT ((ceil(pow((((2.0))), (-2.0 - -1.0) / log(0.5)))) - -2.0)"; @@ -37,7 +37,7 @@ mod fuzz_tests { #[test] pub fn arithmetic_expression_fuzz_ex1() { - let db = TempDatabase::new_empty(false); + let db = TempDatabase::new_empty(); let limbo_conn = db.connect_limbo(); let sqlite_conn = rusqlite::Connection::open_in_memory().unwrap(); @@ -56,10 +56,8 @@ mod fuzz_tests { #[test] pub fn rowid_seek_fuzz() { - let db = TempDatabase::new_with_rusqlite( - "CREATE TABLE t (x INTEGER PRIMARY KEY autoincrement)", - false, - ); // INTEGER PRIMARY KEY is a rowid alias, so an index is not created + let db = + TempDatabase::new_with_rusqlite("CREATE TABLE t (x INTEGER PRIMARY KEY autoincrement)"); // 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(); @@ -173,7 +171,7 @@ mod fuzz_tests { #[test] pub fn index_scan_fuzz() { - let db = TempDatabase::new_with_rusqlite("CREATE TABLE t (x PRIMARY KEY)", true); + let db = TempDatabase::new_with_rusqlite("CREATE TABLE t (x PRIMARY KEY)"); let sqlite_conn = rusqlite::Connection::open(db.path.clone()).unwrap(); let insert = format!( @@ -234,14 +232,14 @@ mod fuzz_tests { ]; // Create all different 3-column primary key permutations let dbs = [ - TempDatabase::new_with_rusqlite(table_defs[0], true), - TempDatabase::new_with_rusqlite(table_defs[1], true), - TempDatabase::new_with_rusqlite(table_defs[2], true), - TempDatabase::new_with_rusqlite(table_defs[3], true), - TempDatabase::new_with_rusqlite(table_defs[4], true), - TempDatabase::new_with_rusqlite(table_defs[5], true), - TempDatabase::new_with_rusqlite(table_defs[6], true), - TempDatabase::new_with_rusqlite(table_defs[7], true), + TempDatabase::new_with_rusqlite(table_defs[0]), + TempDatabase::new_with_rusqlite(table_defs[1]), + TempDatabase::new_with_rusqlite(table_defs[2]), + TempDatabase::new_with_rusqlite(table_defs[3]), + TempDatabase::new_with_rusqlite(table_defs[4]), + TempDatabase::new_with_rusqlite(table_defs[5]), + TempDatabase::new_with_rusqlite(table_defs[6]), + TempDatabase::new_with_rusqlite(table_defs[7]), ]; let mut pk_tuples = HashSet::new(); while pk_tuples.len() < 100000 { @@ -565,7 +563,7 @@ mod fuzz_tests { // Create databases for each variant using rusqlite, then open limbo on the same file. let dbs: Vec = table_defs .iter() - .map(|ddl| TempDatabase::new_with_rusqlite(ddl, true)) + .map(|ddl| TempDatabase::new_with_rusqlite(ddl)) .collect(); // Seed data focuses on case and trailing spaces to exercise NOCASE and RTRIM semantics. @@ -664,8 +662,8 @@ mod fuzz_tests { for outer in 0..OUTER_ITERS { println!("fk_deferred_constraints_fuzz {}/{}", outer + 1, OUTER_ITERS); - let limbo_db = TempDatabase::new_empty(true); - let sqlite_db = TempDatabase::new_empty(true); + let limbo_db = TempDatabase::new_empty(); + let sqlite_db = TempDatabase::new_empty(); let limbo = limbo_db.connect_limbo(); let sqlite = rusqlite::Connection::open(sqlite_db.path.clone()).unwrap(); @@ -1003,8 +1001,8 @@ mod fuzz_tests { for outer in 0..OUTER_ITERS { println!("fk_single_pk_mutation_fuzz {}/{}", outer + 1, OUTER_ITERS); - let limbo_db = TempDatabase::new_empty(true); - let sqlite_db = TempDatabase::new_empty(true); + let limbo_db = TempDatabase::new_empty(); + let sqlite_db = TempDatabase::new_empty(); let limbo = limbo_db.connect_limbo(); let sqlite = rusqlite::Connection::open(sqlite_db.path.clone()).unwrap(); @@ -1314,8 +1312,8 @@ mod fuzz_tests { // parent rowid, child textified integers -> MustBeInt coercion path for outer in 0..OUTER_ITERS { - let limbo_db = TempDatabase::new_empty(true); - let sqlite_db = TempDatabase::new_empty(true); + let limbo_db = TempDatabase::new_empty(); + let sqlite_db = TempDatabase::new_empty(); let limbo = limbo_db.connect_limbo(); let sqlite = rusqlite::Connection::open(sqlite_db.path.clone()).unwrap(); @@ -1380,8 +1378,8 @@ mod fuzz_tests { // slf-referential rowid FK for outer in 0..OUTER_ITERS { - let limbo_db = TempDatabase::new_empty(true); - let sqlite_db = TempDatabase::new_empty(true); + let limbo_db = TempDatabase::new_empty(); + let sqlite_db = TempDatabase::new_empty(); let limbo = limbo_db.connect_limbo(); let sqlite = rusqlite::Connection::open(sqlite_db.path.clone()).unwrap(); @@ -1443,8 +1441,8 @@ mod fuzz_tests { // self-referential UNIQUE(u,v) parent (fast-path for composite) for outer in 0..OUTER_ITERS { - let limbo_db = TempDatabase::new_empty(true); - let sqlite_db = TempDatabase::new_empty(true); + let limbo_db = TempDatabase::new_empty(); + let sqlite_db = TempDatabase::new_empty(); let limbo = limbo_db.connect_limbo(); let sqlite = rusqlite::Connection::open(sqlite_db.path.clone()).unwrap(); @@ -1523,8 +1521,8 @@ mod fuzz_tests { // parent TEXT UNIQUE(u,v), child types differ; rely on parent-index affinities for outer in 0..OUTER_ITERS { - let limbo_db = TempDatabase::new_empty(true); - let sqlite_db = TempDatabase::new_empty(true); + let limbo_db = TempDatabase::new_empty(); + let sqlite_db = TempDatabase::new_empty(); let limbo = limbo_db.connect_limbo(); let sqlite = rusqlite::Connection::open(sqlite_db.path.clone()).unwrap(); @@ -1650,8 +1648,8 @@ mod fuzz_tests { OUTER_ITERS ); - let limbo_db = TempDatabase::new_empty(true); - let sqlite_db = TempDatabase::new_empty(true); + let limbo_db = TempDatabase::new_empty(); + let sqlite_db = TempDatabase::new_empty(); let limbo = limbo_db.connect_limbo(); let sqlite = rusqlite::Connection::open(sqlite_db.path.clone()).unwrap(); @@ -1860,8 +1858,8 @@ mod fuzz_tests { i + 1, OUTER_ITERATIONS ); - let limbo_db = TempDatabase::new_empty(true); - let sqlite_db = TempDatabase::new_empty(true); + let limbo_db = TempDatabase::new_empty(); + let sqlite_db = TempDatabase::new_empty(); let num_cols = rng.random_range(1..=10); let mut table_cols = vec!["id INTEGER PRIMARY KEY AUTOINCREMENT".to_string()]; table_cols.extend( @@ -2088,8 +2086,8 @@ mod fuzz_tests { ); // Columns: id (rowid PK), plus a few data columns we can reference in predicates/keys. - let limbo_db = TempDatabase::new_empty(true); - let sqlite_db = TempDatabase::new_empty(true); + let limbo_db = TempDatabase::new_empty(); + let sqlite_db = TempDatabase::new_empty(); let limbo_conn = limbo_db.connect_limbo(); let sqlite = rusqlite::Connection::open(sqlite_db.path.clone()).unwrap(); @@ -2431,7 +2429,7 @@ mod fuzz_tests { const MAX_SELECTS_IN_UNION_EXTRA: usize = 2; const MAX_LIMIT_VALUE: usize = 50; - let db = TempDatabase::new_empty(true); + let db = TempDatabase::new_empty(); let limbo_conn = db.connect_limbo(); let sqlite_conn = rusqlite::Connection::open_in_memory().unwrap(); @@ -2557,7 +2555,7 @@ mod fuzz_tests { let (mut rng, seed) = rng_from_time_or_env(); const ITERATIONS: usize = 1000; for i in 0..ITERATIONS { - let db = TempDatabase::new_empty(true); + let db = TempDatabase::new_empty(); let conn = db.connect_limbo(); let num_cols = rng.random_range(1..=5); let col_names: Vec = (0..num_cols).map(|c| format!("c{c}")).collect(); @@ -2719,7 +2717,7 @@ mod fuzz_tests { let sql = g.create().concat(" ").push_str("SELECT").push(expr).build(); - let db = TempDatabase::new_empty(false); + let db = TempDatabase::new_empty(); let limbo_conn = db.connect_limbo(); let sqlite_conn = rusqlite::Connection::open_in_memory().unwrap(); @@ -2739,7 +2737,7 @@ mod fuzz_tests { #[test] pub fn fuzz_ex() { let _ = env_logger::try_init(); - let db = TempDatabase::new_empty(false); + let db = TempDatabase::new_empty(); let limbo_conn = db.connect_limbo(); let sqlite_conn = rusqlite::Connection::open_in_memory().unwrap(); @@ -2838,7 +2836,7 @@ mod fuzz_tests { let sql = g.create().concat(" ").push_str("SELECT").push(expr).build(); - let db = TempDatabase::new_empty(false); + let db = TempDatabase::new_empty(); let limbo_conn = db.connect_limbo(); let sqlite_conn = rusqlite::Connection::open_in_memory().unwrap(); @@ -2998,7 +2996,7 @@ mod fuzz_tests { let sql = g.create().concat(" ").push_str("SELECT").push(expr).build(); - let db = TempDatabase::new_empty(false); + let db = TempDatabase::new_empty(); let limbo_conn = db.connect_limbo(); let sqlite_conn = rusqlite::Connection::open_in_memory().unwrap(); @@ -3367,7 +3365,7 @@ mod fuzz_tests { .push(expr) .build(); - let db = TempDatabase::new_empty(false); + let db = TempDatabase::new_empty(); let limbo_conn = db.connect_limbo(); let sqlite_conn = rusqlite::Connection::open_in_memory().unwrap(); @@ -3401,7 +3399,7 @@ mod fuzz_tests { "SELECT * FROM t", ], ] { - let db = TempDatabase::new_empty(false); + let db = TempDatabase::new_empty(); let limbo_conn = db.connect_limbo(); let sqlite_conn = rusqlite::Connection::open_in_memory().unwrap(); for query in queries.iter() { @@ -3428,7 +3426,7 @@ mod fuzz_tests { let datatype = datatypes[rng.random_range(0..datatypes.len())]; let create_table = format!("CREATE TABLE t (x {datatype})"); - let db = TempDatabase::new_empty(false); + let db = TempDatabase::new_empty(); let limbo_conn = db.connect_limbo(); let sqlite_conn = rusqlite::Connection::open_in_memory().unwrap(); @@ -3479,7 +3477,7 @@ mod fuzz_tests { log::info!("affinity_fuzz seed: {seed}"); for iteration in 0..500 { - let db = TempDatabase::new_empty(false); + let db = TempDatabase::new_empty(); let limbo_conn = db.connect_limbo(); let sqlite_conn = rusqlite::Connection::open_in_memory().unwrap(); @@ -3580,7 +3578,7 @@ mod fuzz_tests { log::info!("seed: {seed}"); for _ in 0..100 { - let db = TempDatabase::new_empty(false); + let db = TempDatabase::new_empty(); let limbo_conn = db.connect_limbo(); let sqlite_conn = rusqlite::Connection::open_in_memory().unwrap(); @@ -3626,7 +3624,7 @@ mod fuzz_tests { log::info!("seed: {seed}"); for _ in 0..100 { - let db = TempDatabase::new_empty(false); + let db = TempDatabase::new_empty(); let limbo_conn = db.connect_limbo(); let sqlite_conn = rusqlite::Connection::open_in_memory().unwrap(); @@ -3670,7 +3668,7 @@ mod fuzz_tests { log::info!("seed: {seed}"); for _ in 0..100 { - let db = TempDatabase::new_empty(false); + let db = TempDatabase::new_empty(); let limbo_conn = db.connect_limbo(); let sqlite_conn = rusqlite::Connection::open_in_memory().unwrap(); @@ -3716,7 +3714,7 @@ mod fuzz_tests { log::info!("seed: {seed}"); for _ in 0..100 { - let db = TempDatabase::new_empty(false); + let db = TempDatabase::new_empty(); let limbo_conn = db.connect_limbo(); let sqlite_conn = rusqlite::Connection::open_in_memory().unwrap(); @@ -3764,7 +3762,7 @@ mod fuzz_tests { let predicate = predicate_builders(&g, Some(&tables)); let expr = build_logical_expr(&g, &builders, Some(&predicate)); - let db = TempDatabase::new_empty(true); + let db = TempDatabase::new_empty(); let limbo_conn = db.connect_limbo(); let sqlite_conn = rusqlite::Connection::open_in_memory().unwrap(); for table in tables.iter() { @@ -3855,7 +3853,7 @@ mod fuzz_tests { #[test] pub fn fuzz_distinct() { - let db = TempDatabase::new_empty(true); + let db = TempDatabase::new_empty(); let limbo_conn = db.connect_limbo(); let sqlite_conn = rusqlite::Connection::open_in_memory().unwrap(); @@ -4174,7 +4172,7 @@ mod fuzz_tests { let db_path = tempfile::NamedTempFile::new()?; { - let db = TempDatabase::new_with_existent(db_path.path(), true); + let db = TempDatabase::new_with_existent(db_path.path()); let prev_pending_byte = TempDatabase::get_pending_byte(); tracing::debug!(prev_pending_byte); diff --git a/tests/fuzz/rowid_alias.rs b/tests/fuzz/rowid_alias.rs index 28c08a074..4d5659c34 100644 --- a/tests/fuzz/rowid_alias.rs +++ b/tests/fuzz/rowid_alias.rs @@ -79,8 +79,8 @@ pub fn rowid_alias_differential_fuzz() { }; // Create two Limbo databases with indexes enabled - let db_with_alias = TempDatabase::new_empty(true); - let db_without_alias = TempDatabase::new_empty(true); + let db_with_alias = TempDatabase::new_empty(); + let db_without_alias = TempDatabase::new_empty(); // Connect to both databases let conn_with_alias = db_with_alias.connect_limbo(); diff --git a/tests/integration/common.rs b/tests/integration/common.rs index 65e171d1a..a8a37077a 100644 --- a/tests/integration/common.rs +++ b/tests/integration/common.rs @@ -17,15 +17,15 @@ unsafe impl Send for TempDatabase {} #[allow(dead_code, clippy::arc_with_non_send_sync)] impl TempDatabase { - pub fn new_empty(enable_indexes: bool) -> Self { - Self::new(&format!("test-{}.db", rng().next_u32()), enable_indexes) + pub fn new_empty() -> Self { + Self::new(&format!("test-{}.db", rng().next_u32())) } - pub fn new(db_name: &str, enable_indexes: bool) -> Self { + pub fn new(db_name: &str) -> Self { let mut path = TempDir::new().unwrap().keep(); path.push(db_name); - Self::new_with_existent(&path, enable_indexes) + Self::new_with_existent(&path) } pub fn new_with_opts(db_name: &str, opts: turso_core::DatabaseOpts) -> Self { @@ -47,12 +47,8 @@ impl TempDatabase { } } - pub fn new_with_existent(db_path: &Path, enable_indexes: bool) -> Self { - Self::new_with_existent_with_flags( - db_path, - turso_core::OpenFlags::default(), - enable_indexes, - ) + pub fn new_with_existent(db_path: &Path) -> Self { + Self::new_with_existent_with_flags(db_path, turso_core::OpenFlags::default()) } pub fn new_with_existent_with_opts(db_path: &Path, opts: turso_core::DatabaseOpts) -> Self { @@ -72,18 +68,14 @@ impl TempDatabase { } } - pub fn new_with_existent_with_flags( - db_path: &Path, - flags: turso_core::OpenFlags, - enable_indexes: bool, - ) -> Self { + pub fn new_with_existent_with_flags(db_path: &Path, flags: turso_core::OpenFlags) -> Self { let io: Arc = Arc::new(turso_core::PlatformIO::new().unwrap()); let db = Database::open_file_with_flags( io.clone(), db_path.to_str().unwrap(), flags, turso_core::DatabaseOpts::new() - .with_indexes(enable_indexes) + .with_indexes(true) .with_encryption(true), None, ) @@ -95,7 +87,7 @@ impl TempDatabase { } } - pub fn new_with_rusqlite(table_sql: &str, enable_indexes: bool) -> Self { + pub fn new_with_rusqlite(table_sql: &str) -> Self { let mut path = TempDir::new().unwrap().keep(); path.push("test.db"); { @@ -110,7 +102,9 @@ impl TempDatabase { io.clone(), path.to_str().unwrap(), turso_core::OpenFlags::default(), - turso_core::DatabaseOpts::new().with_indexes(enable_indexes), + turso_core::DatabaseOpts::new() + .with_indexes(true) + .with_index_method(true), None, ) .unwrap(); @@ -439,7 +433,6 @@ mod tests { let _ = env_logger::try_init(); let tmp_db = TempDatabase::new_with_rusqlite( "create table test (foo integer, bar integer, baz integer);", - false, ); let conn = tmp_db.connect_limbo(); @@ -477,11 +470,8 @@ mod tests { fn test_limbo_open_read_only() -> anyhow::Result<()> { let path = TempDir::new().unwrap().keep().join("temp_read_only"); { - let db = TempDatabase::new_with_existent_with_flags( - &path, - turso_core::OpenFlags::default(), - false, - ); + let db = + TempDatabase::new_with_existent_with_flags(&path, turso_core::OpenFlags::default()); let conn = db.connect_limbo(); let ret = limbo_exec_rows(&db, &conn, "CREATE table t (a)"); assert!(ret.is_empty(), "{ret:?}"); @@ -493,7 +483,6 @@ mod tests { let db = TempDatabase::new_with_existent_with_flags( &path, turso_core::OpenFlags::default() | turso_core::OpenFlags::ReadOnly, - false, ); let conn = db.connect_limbo(); let ret = limbo_exec_rows(&db, &conn, "SELECT * from t"); @@ -509,7 +498,7 @@ mod tests { fn test_unique_index_ordering() -> anyhow::Result<()> { use rand::Rng; - let db = TempDatabase::new_empty(true); + let db = TempDatabase::new_empty(); let conn = db.connect_limbo(); let _ = limbo_exec_rows(&db, &conn, "CREATE TABLE t (x INTEGER UNIQUE)"); @@ -550,7 +539,7 @@ mod tests { #[test] fn test_large_unique_blobs() -> anyhow::Result<()> { let path = TempDir::new().unwrap().keep().join("temp_read_only"); - let db = TempDatabase::new_with_existent(&path, true); + let db = TempDatabase::new_with_existent(&path); let conn = db.connect_limbo(); let _ = limbo_exec_rows(&db, &conn, "CREATE TABLE t (x BLOB UNIQUE)"); @@ -580,7 +569,7 @@ mod tests { .unwrap() .keep() .join("temp_transaction_isolation"); - let db = TempDatabase::new_with_existent(&path, true); + let db = TempDatabase::new_with_existent(&path); // Create two separate connections let conn1 = db.connect_limbo(); @@ -611,7 +600,7 @@ mod tests { .unwrap() .keep() .join("temp_transaction_isolation"); - let db = TempDatabase::new_with_existent(&path, true); + let db = TempDatabase::new_with_existent(&path); // Create two separate connections let conn1 = db.connect_limbo(); @@ -648,7 +637,7 @@ mod tests { .unwrap() .keep() .join("temp_transaction_isolation"); - let db = TempDatabase::new_with_existent(&path, true); + let db = TempDatabase::new_with_existent(&path); let conn = db.connect_limbo(); @@ -667,7 +656,7 @@ mod tests { let _ = limbo_exec_rows(&db, &conn, "INSERT INTO t VALUES (69)"); // Reopen the database - let db = TempDatabase::new_with_existent(&path, true); + let db = TempDatabase::new_with_existent(&path); let conn = db.connect_limbo(); // Should only see the last committed value @@ -688,7 +677,7 @@ mod tests { .unwrap() .keep() .join("temp_transaction_isolation"); - let db = TempDatabase::new_with_existent(&path, true); + let db = TempDatabase::new_with_existent(&path); let conn = db.connect_limbo(); @@ -703,7 +692,7 @@ mod tests { do_flush(&conn, &db)?; // Reopen the database without committing - let db = TempDatabase::new_with_existent(&path, true); + let db = TempDatabase::new_with_existent(&path); let conn = db.connect_limbo(); // Should see no rows since transaction was never committed diff --git a/tests/integration/functions/test_cdc.rs b/tests/integration/functions/test_cdc.rs index 28606eca3..01d4b23e9 100644 --- a/tests/integration/functions/test_cdc.rs +++ b/tests/integration/functions/test_cdc.rs @@ -16,7 +16,7 @@ fn replace_column_with_null(rows: Vec>, column: usize) -> Vec(values: [Value; N]) -> Vec { #[test] fn test_cdc_simple_before() { - let db = TempDatabase::new_empty(false); + let db = TempDatabase::new_empty(); let conn = db.connect_limbo(); conn.execute("CREATE TABLE t (x INTEGER PRIMARY KEY, y)") .unwrap(); @@ -149,7 +149,7 @@ fn test_cdc_simple_before() { #[test] fn test_cdc_simple_after() { - let db = TempDatabase::new_empty(false); + let db = TempDatabase::new_empty(); let conn = db.connect_limbo(); conn.execute("CREATE TABLE t (x INTEGER PRIMARY KEY, y)") .unwrap(); @@ -220,7 +220,7 @@ fn test_cdc_simple_after() { #[test] fn test_cdc_simple_full() { - let db = TempDatabase::new_empty(false); + let db = TempDatabase::new_empty(); let conn = db.connect_limbo(); conn.execute("CREATE TABLE t (x INTEGER PRIMARY KEY, y)") .unwrap(); @@ -296,7 +296,7 @@ fn test_cdc_simple_full() { #[test] fn test_cdc_crud() { - let db = TempDatabase::new_empty(false); + let db = TempDatabase::new_empty(); let conn = db.connect_limbo(); conn.execute("CREATE TABLE t (x INTEGER PRIMARY KEY, y)") .unwrap(); @@ -417,7 +417,7 @@ fn test_cdc_crud() { #[test] fn test_cdc_failed_op() { - let db = TempDatabase::new_empty(true); + let db = TempDatabase::new_empty(); let conn = db.connect_limbo(); conn.execute("CREATE TABLE t (x INTEGER PRIMARY KEY, y UNIQUE)") .unwrap(); @@ -491,7 +491,7 @@ fn test_cdc_failed_op() { #[test] fn test_cdc_uncaptured_connection() { - let db = TempDatabase::new_empty(true); + let db = TempDatabase::new_empty(); let conn1 = db.connect_limbo(); conn1 .execute("CREATE TABLE t (x INTEGER PRIMARY KEY, y UNIQUE)") @@ -571,7 +571,7 @@ fn test_cdc_uncaptured_connection() { #[test] fn test_cdc_custom_table() { - let db = TempDatabase::new_empty(true); + let db = TempDatabase::new_empty(); let conn1 = db.connect_limbo(); conn1 .execute("CREATE TABLE t (x INTEGER PRIMARY KEY, y UNIQUE)") @@ -620,7 +620,7 @@ fn test_cdc_custom_table() { #[test] fn test_cdc_ignore_changes_in_cdc_table() { - let db = TempDatabase::new_empty(true); + let db = TempDatabase::new_empty(); let conn1 = db.connect_limbo(); conn1 .execute("CREATE TABLE t (x INTEGER PRIMARY KEY, y UNIQUE)") @@ -660,7 +660,7 @@ fn test_cdc_ignore_changes_in_cdc_table() { #[test] fn test_cdc_transaction() { - let db = TempDatabase::new_empty(true); + let db = TempDatabase::new_empty(); let conn1 = db.connect_limbo(); conn1 .execute("CREATE TABLE t (x INTEGER PRIMARY KEY, y UNIQUE)") @@ -743,7 +743,7 @@ fn test_cdc_transaction() { #[test] fn test_cdc_independent_connections() { - let db = TempDatabase::new_empty(true); + let db = TempDatabase::new_empty(); let conn1 = db.connect_limbo(); let conn2 = db.connect_limbo(); conn1 @@ -799,7 +799,7 @@ fn test_cdc_independent_connections() { #[test] fn test_cdc_independent_connections_different_cdc_not_ignore() { - let db = TempDatabase::new_empty(true); + let db = TempDatabase::new_empty(); let conn1 = db.connect_limbo(); let conn2 = db.connect_limbo(); conn1 @@ -889,7 +889,7 @@ fn test_cdc_independent_connections_different_cdc_not_ignore() { #[test] fn test_cdc_table_columns() { - let db = TempDatabase::new_empty(true); + let db = TempDatabase::new_empty(); let conn = db.connect_limbo(); conn.execute("CREATE TABLE t (a INTEGER PRIMARY KEY, b, c UNIQUE)") .unwrap(); @@ -905,7 +905,7 @@ fn test_cdc_table_columns() { #[test] fn test_cdc_bin_record() { - let db = TempDatabase::new_empty(true); + let db = TempDatabase::new_empty(); let conn = db.connect_limbo(); let record = record([ Value::Null, @@ -934,7 +934,7 @@ fn test_cdc_bin_record() { #[test] fn test_cdc_schema_changes() { - let db = TempDatabase::new_empty(true); + let db = TempDatabase::new_empty(); let conn = db.connect_limbo(); conn.execute("PRAGMA unstable_capture_data_changes_conn('full')") .unwrap(); @@ -1056,7 +1056,7 @@ fn test_cdc_schema_changes() { #[test] fn test_cdc_schema_changes_alter_table() { - let db = TempDatabase::new_empty(true); + let db = TempDatabase::new_empty(); let conn = db.connect_limbo(); conn.execute("PRAGMA unstable_capture_data_changes_conn('full')") .unwrap(); diff --git a/tests/integration/functions/test_function_rowid.rs b/tests/integration/functions/test_function_rowid.rs index 661a35314..a5c085189 100644 --- a/tests/integration/functions/test_function_rowid.rs +++ b/tests/integration/functions/test_function_rowid.rs @@ -6,7 +6,6 @@ fn test_last_insert_rowid_basic() -> anyhow::Result<()> { let _ = env_logger::try_init(); let tmp_db = TempDatabase::new_with_rusqlite( "CREATE TABLE test_rowid (id INTEGER PRIMARY KEY, val TEXT);", - false, ); let conn = tmp_db.connect_limbo(); @@ -91,7 +90,7 @@ fn test_last_insert_rowid_basic() -> anyhow::Result<()> { fn test_integer_primary_key() -> anyhow::Result<()> { let _ = env_logger::try_init(); let tmp_db = - TempDatabase::new_with_rusqlite("CREATE TABLE test_rowid (id INTEGER PRIMARY KEY);", false); + TempDatabase::new_with_rusqlite("CREATE TABLE test_rowid (id INTEGER PRIMARY KEY);"); let conn = tmp_db.connect_limbo(); for query in &[ diff --git a/tests/integration/functions/test_sum.rs b/tests/integration/functions/test_sum.rs index 0b03a14c7..1df9e7106 100644 --- a/tests/integration/functions/test_sum.rs +++ b/tests/integration/functions/test_sum.rs @@ -5,7 +5,7 @@ use turso_core::LimboError; fn sum_errors_on_integer_overflow() { let _ = env_logger::try_init(); - let tmp_db = TempDatabase::new_empty(false); + let tmp_db = TempDatabase::new_empty(); let conn = tmp_db.connect_limbo(); let sqlite_conn = rusqlite::Connection::open_in_memory().unwrap(); diff --git a/tests/integration/functions/test_wal_api.rs b/tests/integration/functions/test_wal_api.rs index 72855f2ed..20ec76e30 100644 --- a/tests/integration/functions/test_wal_api.rs +++ b/tests/integration/functions/test_wal_api.rs @@ -13,7 +13,7 @@ use crate::common::{limbo_exec_rows, rng_from_time, TempDatabase}; #[test] fn test_wal_frame_count() { - let db = TempDatabase::new_empty(false); + let db = TempDatabase::new_empty(); let conn = db.connect_limbo(); assert_eq!(conn.wal_state().unwrap().max_frame, 0); conn.execute("CREATE TABLE t(x INTEGER PRIMARY KEY, y)") @@ -29,9 +29,9 @@ fn test_wal_frame_count() { #[test] fn test_wal_frame_transfer_no_schema_changes() { - let db1 = TempDatabase::new_empty(false); + let db1 = TempDatabase::new_empty(); let conn1 = db1.connect_limbo(); - let db2 = TempDatabase::new_empty(false); + let db2 = TempDatabase::new_empty(); let conn2 = db2.connect_limbo(); conn1 .execute("CREATE TABLE t(x INTEGER PRIMARY KEY, y)") @@ -68,9 +68,9 @@ fn test_wal_frame_transfer_no_schema_changes() { #[test] fn test_wal_frame_transfer_various_schema_changes() { - let db1 = TempDatabase::new_empty(false); + let db1 = TempDatabase::new_empty(); let conn1 = db1.connect_limbo(); - let db2 = TempDatabase::new_empty(false); + let db2 = TempDatabase::new_empty(); let conn2 = db2.connect_limbo(); let conn3 = db2.connect_limbo(); conn1 @@ -127,9 +127,9 @@ fn test_wal_frame_transfer_various_schema_changes() { #[test] fn test_wal_frame_transfer_schema_changes() { - let db1 = TempDatabase::new_empty(false); + let db1 = TempDatabase::new_empty(); let conn1 = db1.connect_limbo(); - let db2 = TempDatabase::new_empty(false); + let db2 = TempDatabase::new_empty(); let conn2 = db2.connect_limbo(); conn1 .execute("CREATE TABLE t(x INTEGER PRIMARY KEY, y)") @@ -166,9 +166,9 @@ fn test_wal_frame_transfer_schema_changes() { #[test] fn test_wal_frame_transfer_no_schema_changes_rollback() { - let db1 = TempDatabase::new_empty(false); + let db1 = TempDatabase::new_empty(); let conn1 = db1.connect_limbo(); - let db2 = TempDatabase::new_empty(false); + let db2 = TempDatabase::new_empty(); let conn2 = db2.connect_limbo(); conn1 .execute("CREATE TABLE t(x INTEGER PRIMARY KEY, y)") @@ -205,9 +205,9 @@ fn test_wal_frame_transfer_no_schema_changes_rollback() { #[test] fn test_wal_frame_transfer_schema_changes_rollback() { - let db1 = TempDatabase::new_empty(false); + let db1 = TempDatabase::new_empty(); let conn1 = db1.connect_limbo(); - let db2 = TempDatabase::new_empty(false); + let db2 = TempDatabase::new_empty(); let conn2 = db2.connect_limbo(); conn1 .execute("CREATE TABLE t(x INTEGER PRIMARY KEY, y)") @@ -240,9 +240,9 @@ fn test_wal_frame_transfer_schema_changes_rollback() { #[test] fn test_wal_frame_conflict() { - let db1 = TempDatabase::new_empty(false); + let db1 = TempDatabase::new_empty(); let conn1 = db1.connect_limbo(); - let db2 = TempDatabase::new_empty(false); + let db2 = TempDatabase::new_empty(); let conn2 = db2.connect_limbo(); conn1 .execute("CREATE TABLE t(x INTEGER PRIMARY KEY, y)") @@ -259,9 +259,9 @@ fn test_wal_frame_conflict() { #[test] fn test_wal_frame_far_away_write() { - let db1 = TempDatabase::new_empty(false); + let db1 = TempDatabase::new_empty(); let conn1 = db1.connect_limbo(); - let db2 = TempDatabase::new_empty(false); + let db2 = TempDatabase::new_empty(); let conn2 = db2.connect_limbo(); conn1 .execute("CREATE TABLE t(x INTEGER PRIMARY KEY, y)") @@ -287,9 +287,9 @@ fn test_wal_frame_far_away_write() { fn test_wal_frame_api_no_schema_changes_fuzz() { let (mut rng, _) = rng_from_time(); for _ in 0..4 { - let db1 = TempDatabase::new_empty(false); + let db1 = TempDatabase::new_empty(); let conn1 = db1.connect_limbo(); - let db2 = TempDatabase::new_empty(false); + let db2 = TempDatabase::new_empty(); let conn2 = db2.connect_limbo(); conn1 .execute("CREATE TABLE t(x INTEGER PRIMARY KEY, y)") @@ -342,7 +342,7 @@ fn test_wal_frame_api_no_schema_changes_fuzz() { #[test] fn test_wal_api_changed_pages() { - let db1 = TempDatabase::new_empty(false); + let db1 = TempDatabase::new_empty(); let conn1 = db1.connect_limbo(); conn1 .execute("CREATE TABLE t(x INTEGER PRIMARY KEY, y)") @@ -421,7 +421,7 @@ fn revert_to(conn: &Arc, frame_watermark: u64) -> turso_ #[test] fn test_wal_api_revert_pages() { - let db1 = TempDatabase::new_empty(false); + let db1 = TempDatabase::new_empty(); let conn1 = db1.connect_limbo(); conn1 .execute("CREATE TABLE t(x INTEGER PRIMARY KEY, y)") @@ -465,7 +465,7 @@ fn test_wal_api_revert_pages() { #[test] fn test_wal_upper_bound_passive() { - let db = TempDatabase::new_empty(false); + let db = TempDatabase::new_empty(); let writer = db.connect_limbo(); writer @@ -499,7 +499,7 @@ fn test_wal_upper_bound_passive() { let db_path_copy = format!("{}-{}-copy", db.path.to_str().unwrap(), watermark); std::fs::copy(&db.path, db_path_copy.clone()).unwrap(); - let db_copy = TempDatabase::new_with_existent(&PathBuf::from(db_path_copy), false); + let db_copy = TempDatabase::new_with_existent(&PathBuf::from(db_path_copy)); let conn = db_copy.connect_limbo(); let mut stmt = conn.prepare("select * from test").unwrap(); let mut rows: Vec> = Vec::new(); @@ -520,7 +520,7 @@ fn test_wal_upper_bound_passive() { #[test] fn test_wal_upper_bound_truncate() { - let db = TempDatabase::new_empty(false); + let db = TempDatabase::new_empty(); let writer = db.connect_limbo(); writer @@ -548,7 +548,7 @@ fn test_wal_upper_bound_truncate() { #[test] fn test_wal_state_checkpoint_seq() { - let db = TempDatabase::new_empty(false); + let db = TempDatabase::new_empty(); let writer = db.connect_limbo(); writer @@ -586,7 +586,7 @@ fn test_wal_state_checkpoint_seq() { #[test] fn test_wal_checkpoint_no_work() { - let db = TempDatabase::new_empty(false); + let db = TempDatabase::new_empty(); let writer = db.connect_limbo(); let reader = db.connect_limbo(); @@ -631,7 +631,7 @@ fn test_wal_checkpoint_no_work() { #[test] fn test_wal_revert_change_db_size() { - let db = TempDatabase::new_empty(false); + let db = TempDatabase::new_empty(); let writer = db.connect_limbo(); writer.execute("create table t(x, y)").unwrap(); @@ -678,7 +678,7 @@ fn test_wal_revert_change_db_size() { #[test] fn test_wal_api_exec_commit() { - let db = TempDatabase::new_empty(false); + let db = TempDatabase::new_empty(); let writer = db.connect_limbo(); writer @@ -725,7 +725,7 @@ fn test_wal_api_exec_commit() { #[test] fn test_wal_api_exec_rollback() { - let db = TempDatabase::new_empty(false); + let db = TempDatabase::new_empty(); let writer = db.connect_limbo(); writer @@ -760,7 +760,7 @@ fn test_wal_api_exec_rollback() { #[test] fn test_wal_api_insert_exec_mix() { - let db = TempDatabase::new_empty(false); + let db = TempDatabase::new_empty(); let conn = db.connect_limbo(); conn.execute("create table a(x, y)").unwrap(); @@ -928,9 +928,9 @@ fn test_db_share_same_file() { #[test] fn test_wal_api_simulate_spilled_frames() { let (mut rng, _) = rng_from_time(); - let db1 = TempDatabase::new_empty(false); + let db1 = TempDatabase::new_empty(); let conn1 = db1.connect_limbo(); - let db2 = TempDatabase::new_empty(false); + let db2 = TempDatabase::new_empty(); let conn2 = db2.connect_limbo(); conn1 .execute("CREATE TABLE t(x INTEGER PRIMARY KEY, y)") diff --git a/tests/integration/pragma.rs b/tests/integration/pragma.rs index cb22bb2cd..c9c7c4524 100644 --- a/tests/integration/pragma.rs +++ b/tests/integration/pragma.rs @@ -3,7 +3,7 @@ use turso_core::{StepResult, Value}; #[test] fn test_pragma_module_list_returns_list() { - let db = TempDatabase::new_empty(false); + let db = TempDatabase::new_empty(); let conn = db.connect_limbo(); let mut module_list = conn.query("PRAGMA module_list;").unwrap(); @@ -21,7 +21,7 @@ fn test_pragma_module_list_returns_list() { #[test] fn test_pragma_module_list_generate_series() { - let db = TempDatabase::new_empty(false); + let db = TempDatabase::new_empty(); let conn = db.connect_limbo(); let mut rows = conn @@ -61,7 +61,7 @@ fn test_pragma_module_list_generate_series() { #[test] fn test_pragma_page_sizes_without_writes_persists() { for test_page_size in [512, 1024, 2048, 4096, 8192, 16384, 32768, 65536] { - let db = TempDatabase::new_empty(false); + let db = TempDatabase::new_empty(); { let conn = db.connect_limbo(); let pragma_query = format!("PRAGMA page_size={test_page_size}"); @@ -81,7 +81,7 @@ fn test_pragma_page_sizes_without_writes_persists() { assert_eq!(*page_size, test_page_size); // Reopen database and verify page size - let db = TempDatabase::new_with_existent(&db.path, false); + let db = TempDatabase::new_with_existent(&db.path); let conn = db.connect_limbo(); let mut rows = conn.query("PRAGMA page_size").unwrap().unwrap(); let StepResult::Row = rows.step().unwrap() else { @@ -98,7 +98,7 @@ fn test_pragma_page_sizes_without_writes_persists() { #[test] fn test_pragma_page_sizes_with_writes_persists() { for test_page_size in [512, 1024, 2048, 4096, 8192, 16384, 32768, 65536] { - let db = TempDatabase::new_empty(false); + let db = TempDatabase::new_empty(); { { let conn = db.connect_limbo(); @@ -153,7 +153,7 @@ fn test_pragma_page_sizes_with_writes_persists() { } // Drop the db and reopen it, and verify the same - let db = TempDatabase::new_with_existent(&db.path, false); + let db = TempDatabase::new_with_existent(&db.path); let conn = db.connect_limbo(); let mut page_size = conn.pragma_query("page_size").unwrap(); let mut page_size = page_size.pop().unwrap(); diff --git a/tests/integration/query_processing/encryption.rs b/tests/integration/query_processing/encryption.rs index 980443ea0..de6aa012b 100644 --- a/tests/integration/query_processing/encryption.rs +++ b/tests/integration/query_processing/encryption.rs @@ -9,7 +9,7 @@ const ENABLE_ENCRYPTION: bool = true; fn test_per_page_encryption() -> anyhow::Result<()> { let _ = env_logger::try_init(); let db_name = format!("test-{}.db", rng().next_u32()); - let tmp_db = TempDatabase::new(&db_name, false); + let tmp_db = TempDatabase::new(&db_name); let db_path = tmp_db.path.clone(); { @@ -199,7 +199,7 @@ fn test_per_page_encryption() -> anyhow::Result<()> { fn test_non_4k_page_size_encryption() -> anyhow::Result<()> { let _ = env_logger::try_init(); let db_name = format!("test-8k-{}.db", rng().next_u32()); - let tmp_db = TempDatabase::new(&db_name, false); + let tmp_db = TempDatabase::new(&db_name); let db_path = tmp_db.path.clone(); { @@ -261,7 +261,7 @@ fn test_non_4k_page_size_encryption() -> anyhow::Result<()> { fn test_corruption_turso_magic_bytes() -> anyhow::Result<()> { let _ = env_logger::try_init(); let db_name = format!("test-corruption-magic-{}.db", rng().next_u32()); - let tmp_db = TempDatabase::new(&db_name, false); + let tmp_db = TempDatabase::new(&db_name); let db_path = tmp_db.path.clone(); { @@ -331,7 +331,7 @@ fn test_corruption_turso_magic_bytes() -> anyhow::Result<()> { fn test_corruption_associated_data_bytes() -> anyhow::Result<()> { let _ = env_logger::try_init(); let db_name = format!("test-corruption-ad-{}.db", rng().next_u32()); - let tmp_db = TempDatabase::new(&db_name, false); + let tmp_db = TempDatabase::new(&db_name); let db_path = tmp_db.path.clone(); { @@ -365,7 +365,7 @@ fn test_corruption_associated_data_bytes() -> anyhow::Result<()> { corrupt_pos, rng().next_u32() ); - let test_tmp_db = TempDatabase::new(&test_db_name, false); + let test_tmp_db = TempDatabase::new(&test_db_name); let test_db_path = test_tmp_db.path.clone(); std::fs::copy(&db_path, &test_db_path)?; @@ -509,7 +509,7 @@ fn test_turso_header_structure() -> anyhow::Result<()> { for (cipher_name, expected_id, description, hexkey) in test_cases { let db_name = format!("test-header-{}-{}.db", cipher_name, rng().next_u32()); - let tmp_db = TempDatabase::new(&db_name, false); + let tmp_db = TempDatabase::new(&db_name); let db_path = tmp_db.path.clone(); { diff --git a/tests/integration/query_processing/test_btree.rs b/tests/integration/query_processing/test_btree.rs index c24d025d6..1e972df7e 100644 --- a/tests/integration/query_processing/test_btree.rs +++ b/tests/integration/query_processing/test_btree.rs @@ -448,7 +448,6 @@ fn test_btree() { for attempt in 0..16 { let db = TempDatabase::new_with_rusqlite( "create table test (k INTEGER PRIMARY KEY, b BLOB);", - false, ); log::info!( "depth: {}, attempt: {}, path: {:?}", diff --git a/tests/integration/query_processing/test_ddl.rs b/tests/integration/query_processing/test_ddl.rs index 990101973..fcd11192f 100644 --- a/tests/integration/query_processing/test_ddl.rs +++ b/tests/integration/query_processing/test_ddl.rs @@ -3,7 +3,7 @@ use crate::common::TempDatabase; #[test] fn test_fail_drop_indexed_column() -> anyhow::Result<()> { let _ = env_logger::try_init(); - let tmp_db = TempDatabase::new_with_rusqlite("CREATE TABLE t (a, b);", true); + let tmp_db = TempDatabase::new_with_rusqlite("CREATE TABLE t (a, b);"); let conn = tmp_db.connect_limbo(); conn.execute("CREATE INDEX i ON t (a)")?; @@ -15,7 +15,7 @@ fn test_fail_drop_indexed_column() -> anyhow::Result<()> { #[test] fn test_fail_drop_unique_column() -> anyhow::Result<()> { let _ = env_logger::try_init(); - let tmp_db = TempDatabase::new_with_rusqlite("CREATE TABLE t (a UNIQUE, b);", true); + let tmp_db = TempDatabase::new_with_rusqlite("CREATE TABLE t (a UNIQUE, b);"); let conn = tmp_db.connect_limbo(); let res = conn.execute("ALTER TABLE t DROP COLUMN a"); @@ -26,7 +26,7 @@ fn test_fail_drop_unique_column() -> anyhow::Result<()> { #[test] fn test_fail_drop_compound_unique_column() -> anyhow::Result<()> { let _ = env_logger::try_init(); - let tmp_db = TempDatabase::new_with_rusqlite("CREATE TABLE t (a, b, UNIQUE(a, b));", true); + let tmp_db = TempDatabase::new_with_rusqlite("CREATE TABLE t (a, b, UNIQUE(a, b));"); let conn = tmp_db.connect_limbo(); let res = conn.execute("ALTER TABLE t DROP COLUMN a"); @@ -40,7 +40,7 @@ fn test_fail_drop_compound_unique_column() -> anyhow::Result<()> { #[test] fn test_fail_drop_primary_key_column() -> anyhow::Result<()> { let _ = env_logger::try_init(); - let tmp_db = TempDatabase::new_with_rusqlite("CREATE TABLE t (a PRIMARY KEY, b);", true); + let tmp_db = TempDatabase::new_with_rusqlite("CREATE TABLE t (a PRIMARY KEY, b);"); let conn = tmp_db.connect_limbo(); let res = conn.execute("ALTER TABLE t DROP COLUMN a"); @@ -54,7 +54,7 @@ fn test_fail_drop_primary_key_column() -> anyhow::Result<()> { #[test] fn test_fail_drop_compound_primary_key_column() -> anyhow::Result<()> { let _ = env_logger::try_init(); - let tmp_db = TempDatabase::new_with_rusqlite("CREATE TABLE t (a, b, PRIMARY KEY(a, b));", true); + let tmp_db = TempDatabase::new_with_rusqlite("CREATE TABLE t (a, b, PRIMARY KEY(a, b));"); let conn = tmp_db.connect_limbo(); let res = conn.execute("ALTER TABLE t DROP COLUMN a"); @@ -68,7 +68,7 @@ fn test_fail_drop_compound_primary_key_column() -> anyhow::Result<()> { #[test] fn test_fail_drop_partial_index_column() -> anyhow::Result<()> { let _ = env_logger::try_init(); - let tmp_db = TempDatabase::new_with_rusqlite("CREATE TABLE t (a, b);", true); + let tmp_db = TempDatabase::new_with_rusqlite("CREATE TABLE t (a, b);"); let conn = tmp_db.connect_limbo(); conn.execute("CREATE INDEX i ON t (b) WHERE a > 0")?; @@ -83,7 +83,7 @@ fn test_fail_drop_partial_index_column() -> anyhow::Result<()> { #[test] fn test_fail_drop_view_column() -> anyhow::Result<()> { let _ = env_logger::try_init(); - let tmp_db = TempDatabase::new_with_rusqlite("CREATE TABLE t (a, b);", true); + let tmp_db = TempDatabase::new_with_rusqlite("CREATE TABLE t (a, b);"); let conn = tmp_db.connect_limbo(); conn.execute("CREATE VIEW v AS SELECT a, b FROM t")?; @@ -99,7 +99,7 @@ fn test_fail_drop_view_column() -> anyhow::Result<()> { #[test] fn test_fail_rename_view_column() -> anyhow::Result<()> { let _ = env_logger::try_init(); - let tmp_db = TempDatabase::new_with_rusqlite("CREATE TABLE t (a, b);", true); + let tmp_db = TempDatabase::new_with_rusqlite("CREATE TABLE t (a, b);"); let conn = tmp_db.connect_limbo(); conn.execute("CREATE VIEW v AS SELECT a, b FROM t")?; @@ -116,7 +116,6 @@ fn test_allow_drop_unreferenced_columns() -> anyhow::Result<()> { let _ = env_logger::try_init(); let tmp_db = TempDatabase::new_with_rusqlite( "CREATE TABLE t (pk INTEGER PRIMARY KEY, indexed INTEGER, viewed INTEGER, partial INTEGER, compound1 INTEGER, compound2 INTEGER, unused1 INTEGER, unused2 INTEGER, unused3 INTEGER);", - true ); let conn = tmp_db.connect_limbo(); diff --git a/tests/integration/query_processing/test_multi_thread.rs b/tests/integration/query_processing/test_multi_thread.rs index 4f09a0f94..2d3b848dd 100644 --- a/tests/integration/query_processing/test_multi_thread.rs +++ b/tests/integration/query_processing/test_multi_thread.rs @@ -6,7 +6,7 @@ use crate::common::{maybe_setup_tracing, TempDatabase}; #[test] fn test_schema_reprepare() { - let tmp_db = TempDatabase::new_empty(false); + let tmp_db = TempDatabase::new_empty(); let conn1 = tmp_db.connect_limbo(); conn1.execute("CREATE TABLE t(x, y, z)").unwrap(); conn1 @@ -55,7 +55,7 @@ fn test_create_multiple_connections() -> anyhow::Result<()> { maybe_setup_tracing(); let tries = 1; for _ in 0..tries { - let tmp_db = Arc::new(TempDatabase::new_empty(false)); + let tmp_db = Arc::new(TempDatabase::new_empty()); { let conn = tmp_db.connect_limbo(); conn.execute("CREATE TABLE t (x)").unwrap(); @@ -134,7 +134,7 @@ fn test_create_multiple_connections() -> anyhow::Result<()> { fn test_reader_writer() -> anyhow::Result<()> { let tries = 10; for _ in 0..tries { - let tmp_db = Arc::new(TempDatabase::new_empty(false)); + let tmp_db = Arc::new(TempDatabase::new_empty()); { let conn = tmp_db.connect_limbo(); conn.execute("CREATE TABLE t (x)").unwrap(); @@ -206,7 +206,7 @@ fn test_reader_writer() -> anyhow::Result<()> { #[test] fn test_schema_reprepare_write() { maybe_setup_tracing(); - let tmp_db = TempDatabase::new_empty(false); + let tmp_db = TempDatabase::new_empty(); let conn1 = tmp_db.connect_limbo(); conn1.execute("CREATE TABLE t(x, y, z)").unwrap(); let conn2 = tmp_db.connect_limbo(); @@ -253,7 +253,7 @@ fn advance(stmt: &mut Statement) -> anyhow::Result<()> { #[test] fn test_interleaved_transactions() -> anyhow::Result<()> { maybe_setup_tracing(); - let tmp_db = TempDatabase::new_empty(true); + let tmp_db = TempDatabase::new_empty(); { let bootstrap_conn = tmp_db.connect_limbo(); bootstrap_conn.execute("CREATE TABLE table_0 (id INTEGER,col_1 REAL,col_2 INTEGER,col_3 REAL,col_4 TEXT,col_5 REAL,col_6 TEXT)")?; diff --git a/tests/integration/query_processing/test_read_path.rs b/tests/integration/query_processing/test_read_path.rs index 4b08df3b1..1d41a9e71 100644 --- a/tests/integration/query_processing/test_read_path.rs +++ b/tests/integration/query_processing/test_read_path.rs @@ -3,7 +3,7 @@ use turso_core::{LimboError, StepResult, Value}; #[test] fn test_statement_reset_bind() -> anyhow::Result<()> { - let tmp_db = TempDatabase::new_with_rusqlite("create table test (i integer);", false); + let tmp_db = TempDatabase::new_with_rusqlite("create table test (i integer);"); let conn = tmp_db.connect_limbo(); let mut stmt = conn.prepare("select ?")?; @@ -47,7 +47,7 @@ fn test_statement_reset_bind() -> anyhow::Result<()> { #[test] fn test_statement_bind() -> anyhow::Result<()> { - let tmp_db = TempDatabase::new_with_rusqlite("create table test (i integer);", false); + let tmp_db = TempDatabase::new_with_rusqlite("create table test (i integer);"); let conn = tmp_db.connect_limbo(); let mut stmt = conn.prepare("select ?, ?1, :named, ?3, ?4")?; @@ -112,7 +112,6 @@ fn test_insert_parameter_remap() -> anyhow::Result<()> { let tmp_db = TempDatabase::new_with_rusqlite( "create table test (a integer, b integer, c integer, d integer);", - false, ); let conn = tmp_db.connect_limbo(); @@ -177,7 +176,6 @@ fn test_insert_parameter_remap_all_params() -> anyhow::Result<()> { let tmp_db = TempDatabase::new_with_rusqlite( "create table test (a integer, b integer, c integer, d integer);", - false, ); let conn = tmp_db.connect_limbo(); let mut ins = conn.prepare("insert into test (d, a, c, b) values (?, ?, ?, ?);")?; @@ -245,7 +243,6 @@ fn test_insert_parameter_multiple_remap_backwards() -> anyhow::Result<()> { let tmp_db = TempDatabase::new_with_rusqlite( "create table test (a integer, b integer, c integer, d integer);", - false, ); let conn = tmp_db.connect_limbo(); let mut ins = conn.prepare("insert into test (d,c,b,a) values (?, ?, ?, ?);")?; @@ -312,7 +309,6 @@ fn test_insert_parameter_multiple_no_remap() -> anyhow::Result<()> { let tmp_db = TempDatabase::new_with_rusqlite( "create table test (a integer, b integer, c integer, d integer);", - false, ); let conn = tmp_db.connect_limbo(); let mut ins = conn.prepare("insert into test (a,b,c,d) values (?, ?, ?, ?);")?; @@ -379,7 +375,6 @@ fn test_insert_parameter_multiple_row() -> anyhow::Result<()> { let tmp_db = TempDatabase::new_with_rusqlite( "create table test (a integer, b integer, c integer, d integer);", - false, ); let conn = tmp_db.connect_limbo(); let mut ins = conn.prepare("insert into test (b,a,d,c) values (?, ?, ?, ?), (?, ?, ?, ?);")?; @@ -445,7 +440,7 @@ fn test_insert_parameter_multiple_row() -> anyhow::Result<()> { #[test] fn test_bind_parameters_update_query() -> anyhow::Result<()> { - let tmp_db = TempDatabase::new_with_rusqlite("create table test (a integer, b text);", false); + let tmp_db = TempDatabase::new_with_rusqlite("create table test (a integer, b text);"); let conn = tmp_db.connect_limbo(); let mut ins = conn.prepare("insert into test (a, b) values (3, 'test1');")?; loop { @@ -489,7 +484,6 @@ fn test_bind_parameters_update_query() -> anyhow::Result<()> { fn test_bind_parameters_update_query_multiple_where() -> anyhow::Result<()> { let tmp_db = TempDatabase::new_with_rusqlite( "create table test (a integer, b text, c integer, d integer);", - false, ); let conn = tmp_db.connect_limbo(); let mut ins = conn.prepare("insert into test (a, b, c, d) values (3, 'test1', 4, 5);")?; @@ -535,10 +529,8 @@ fn test_bind_parameters_update_query_multiple_where() -> anyhow::Result<()> { #[test] fn test_bind_parameters_update_rowid_alias() -> anyhow::Result<()> { - let tmp_db = TempDatabase::new_with_rusqlite( - "CREATE TABLE test (id INTEGER PRIMARY KEY, name TEXT);", - false, - ); + let tmp_db = + TempDatabase::new_with_rusqlite("CREATE TABLE test (id INTEGER PRIMARY KEY, name TEXT);"); let conn = tmp_db.connect_limbo(); let mut ins = conn.prepare("insert into test (id, name) values (1, 'test');")?; loop { @@ -596,7 +588,6 @@ fn test_bind_parameters_update_rowid_alias() -> anyhow::Result<()> { fn test_bind_parameters_update_rowid_alias_seek_rowid() -> anyhow::Result<()> { let tmp_db = TempDatabase::new_with_rusqlite( "CREATE TABLE test (id INTEGER PRIMARY KEY, name TEXT, age integer);", - false, ); let conn = tmp_db.connect_limbo(); conn.execute("insert into test (id, name, age) values (1, 'test', 4);")?; @@ -664,7 +655,6 @@ fn test_bind_parameters_update_rowid_alias_seek_rowid() -> anyhow::Result<()> { fn test_bind_parameters_delete_rowid_alias_seek_out_of_order() -> anyhow::Result<()> { let tmp_db = TempDatabase::new_with_rusqlite( "CREATE TABLE test (id INTEGER PRIMARY KEY, name TEXT, age integer);", - false, ); let conn = tmp_db.connect_limbo(); conn.execute("insert into test (id, name, age) values (1, 'correct', 4);")?; @@ -706,10 +696,8 @@ fn test_bind_parameters_delete_rowid_alias_seek_out_of_order() -> anyhow::Result #[test] fn test_cte_alias() -> anyhow::Result<()> { - let tmp_db = TempDatabase::new_with_rusqlite( - "CREATE TABLE test (id INTEGER PRIMARY KEY, name TEXT);", - false, - ); + let tmp_db = + TempDatabase::new_with_rusqlite("CREATE TABLE test (id INTEGER PRIMARY KEY, name TEXT);"); let conn = tmp_db.connect_limbo(); conn.execute("INSERT INTO test (id, name) VALUES (1, 'Limbo');")?; conn.execute("INSERT INTO test (id, name) VALUES (2, 'Turso');")?; @@ -753,7 +741,7 @@ fn test_cte_alias() -> anyhow::Result<()> { #[test] fn test_avg_agg() -> anyhow::Result<()> { - let tmp_db = TempDatabase::new_with_rusqlite("create table t (x, y);", false); + let tmp_db = TempDatabase::new_with_rusqlite("create table t (x, y);"); let conn = tmp_db.connect_limbo(); conn.execute("insert into t values (1, null), (2, null), (3, null), (null, null), (4, null)")?; let mut rows = Vec::new(); @@ -787,7 +775,7 @@ fn test_avg_agg() -> anyhow::Result<()> { #[test] fn test_offset_limit_bind() -> anyhow::Result<()> { - let tmp_db = TempDatabase::new_with_rusqlite("CREATE TABLE test (i INTEGER);", false); + let tmp_db = TempDatabase::new_with_rusqlite("CREATE TABLE test (i INTEGER);"); let conn = tmp_db.connect_limbo(); conn.execute("INSERT INTO test VALUES (5), (4), (3), (2), (1)")?; @@ -830,10 +818,8 @@ fn test_offset_limit_bind() -> anyhow::Result<()> { #[test] fn test_upsert_parameters_order() -> anyhow::Result<()> { - let tmp_db = TempDatabase::new_with_rusqlite( - "CREATE TABLE test (k INTEGER PRIMARY KEY, v INTEGER);", - false, - ); + let tmp_db = + TempDatabase::new_with_rusqlite("CREATE TABLE test (k INTEGER PRIMARY KEY, v INTEGER);"); let conn = tmp_db.connect_limbo(); conn.execute("INSERT INTO test VALUES (1, 2), (3, 4)")?; @@ -879,10 +865,8 @@ fn test_upsert_parameters_order() -> anyhow::Result<()> { #[test] fn test_multiple_connections_visibility() -> anyhow::Result<()> { - let tmp_db = TempDatabase::new_with_rusqlite( - "CREATE TABLE test (k INTEGER PRIMARY KEY, v INTEGER);", - false, - ); + let tmp_db = + TempDatabase::new_with_rusqlite("CREATE TABLE test (k INTEGER PRIMARY KEY, v INTEGER);"); let conn1 = tmp_db.connect_limbo(); let conn2 = tmp_db.connect_limbo(); conn1.execute("BEGIN")?; @@ -901,7 +885,7 @@ fn test_multiple_connections_visibility() -> anyhow::Result<()> { #[test] /// Test that we can only join up to 63 tables, and trying to join more should fail with an error instead of panicing. fn test_max_joined_tables_limit() { - let tmp_db = TempDatabase::new("test_max_joined_tables_limit", false); + let tmp_db = TempDatabase::new("test_max_joined_tables_limit"); let conn = tmp_db.connect_limbo(); // Create 64 tables @@ -934,7 +918,7 @@ fn test_many_columns() { } create_sql.push(')'); - let tmp_db = TempDatabase::new("test_many_columns", false); + let tmp_db = TempDatabase::new("test_many_columns"); let conn = tmp_db.connect_limbo(); conn.execute(&create_sql).unwrap(); diff --git a/tests/integration/query_processing/test_transactions.rs b/tests/integration/query_processing/test_transactions.rs index 81b104788..540c0d727 100644 --- a/tests/integration/query_processing/test_transactions.rs +++ b/tests/integration/query_processing/test_transactions.rs @@ -14,7 +14,7 @@ use crate::common::TempDatabase; // was still fresh (no reads or writes happened). #[test] fn test_deferred_transaction_restart() { - let tmp_db = TempDatabase::new("test_deferred_tx.db", true); + let tmp_db = TempDatabase::new("test_deferred_tx.db"); let conn1 = tmp_db.connect_limbo(); let conn2 = tmp_db.connect_limbo(); @@ -57,7 +57,7 @@ fn test_deferred_transaction_restart() { // because it has performed reads and has a committed snapshot. #[test] fn test_deferred_transaction_no_restart() { - let tmp_db = TempDatabase::new("test_deferred_tx_no_restart.db", true); + let tmp_db = TempDatabase::new("test_deferred_tx_no_restart.db"); let conn1 = tmp_db.connect_limbo(); let conn2 = tmp_db.connect_limbo(); @@ -106,7 +106,7 @@ fn test_deferred_transaction_no_restart() { #[test] fn test_txn_error_doesnt_rollback_txn() -> Result<()> { - let tmp_db = TempDatabase::new_with_rusqlite("create table t (x);", false); + let tmp_db = TempDatabase::new_with_rusqlite("create table t (x);"); let conn = tmp_db.connect_limbo(); conn.execute("begin")?; @@ -131,7 +131,7 @@ fn test_txn_error_doesnt_rollback_txn() -> Result<()> { /// Connection 2 should see the initial data (table 'test' in schema + 2 rows). Regression test for #2997 /// It should then see another created table 'test2' in schema, as well. fn test_transaction_visibility() { - let tmp_db = TempDatabase::new("test_transaction_visibility.db", true); + let tmp_db = TempDatabase::new("test_transaction_visibility.db"); let conn1 = tmp_db.connect_limbo(); let conn2 = tmp_db.connect_limbo(); @@ -179,10 +179,8 @@ fn test_transaction_visibility() { #[test] /// A constraint error does not rollback the transaction, it rolls back the statement. fn test_constraint_error_aborts_only_stmt_not_entire_transaction() { - let tmp_db = TempDatabase::new( - "test_constraint_error_aborts_only_stmt_not_entire_transaction.db", - true, - ); + let tmp_db = + TempDatabase::new("test_constraint_error_aborts_only_stmt_not_entire_transaction.db"); let conn = tmp_db.connect_limbo(); // Create table succeeds @@ -224,7 +222,7 @@ fn test_constraint_error_aborts_only_stmt_not_entire_transaction() { /// violations being persisted to the database, even though the transaction was aborted. /// This test ensures that dirty pages are not flushed to WAL until after deferred violations are checked. fn test_deferred_fk_violation_rollback_in_autocommit() { - let tmp_db = TempDatabase::new("test_deferred_fk_violation_rollback.db", true); + let tmp_db = TempDatabase::new("test_deferred_fk_violation_rollback.db"); let conn = tmp_db.connect_limbo(); // Enable foreign keys @@ -579,7 +577,7 @@ fn test_mvcc_checkpoint_works() { conn.execute("PRAGMA wal_checkpoint(TRUNCATE)").unwrap(); // Verify all rows after reopening database - let tmp_db = TempDatabase::new_with_existent(&tmp_db.path, true); + let tmp_db = TempDatabase::new_with_existent(&tmp_db.path); let conn = tmp_db.connect_limbo(); let stmt = conn .query("SELECT * FROM test ORDER BY id, value") @@ -723,7 +721,7 @@ fn test_mvcc_recovery_of_both_checkpointed_and_noncheckpointed_tables_works() { #[test] fn test_non_mvcc_to_mvcc() { // Create non-mvcc database - let tmp_db = TempDatabase::new("test_non_mvcc_to_mvcc.db", false); + let tmp_db = TempDatabase::new("test_non_mvcc_to_mvcc.db"); let conn = tmp_db.connect_limbo(); // Create table and insert data diff --git a/tests/integration/query_processing/test_write_path.rs b/tests/integration/query_processing/test_write_path.rs index b9384cdc3..e3bddb095 100644 --- a/tests/integration/query_processing/test_write_path.rs +++ b/tests/integration/query_processing/test_write_path.rs @@ -27,10 +27,8 @@ macro_rules! change_state { #[ignore] fn test_simple_overflow_page() -> anyhow::Result<()> { let _ = env_logger::try_init(); - let tmp_db = TempDatabase::new_with_rusqlite( - "CREATE TABLE test (x INTEGER PRIMARY KEY, t TEXT);", - false, - ); + let tmp_db = + TempDatabase::new_with_rusqlite("CREATE TABLE test (x INTEGER PRIMARY KEY, t TEXT);"); let conn = tmp_db.connect_limbo(); let mut huge_text = String::new(); @@ -91,10 +89,8 @@ fn test_simple_overflow_page() -> anyhow::Result<()> { fn test_sequential_overflow_page() -> anyhow::Result<()> { let _ = env_logger::try_init(); maybe_setup_tracing(); - let tmp_db = TempDatabase::new_with_rusqlite( - "CREATE TABLE test (x INTEGER PRIMARY KEY, t TEXT);", - false, - ); + let tmp_db = + TempDatabase::new_with_rusqlite("CREATE TABLE test (x INTEGER PRIMARY KEY, t TEXT);"); let conn = tmp_db.connect_limbo(); let iterations = 10_usize; @@ -163,8 +159,7 @@ fn test_sequential_write() -> anyhow::Result<()> { let _ = env_logger::try_init(); maybe_setup_tracing(); - let tmp_db = - TempDatabase::new_with_rusqlite("CREATE TABLE test (x INTEGER PRIMARY KEY);", false); + let tmp_db = TempDatabase::new_with_rusqlite("CREATE TABLE test (x INTEGER PRIMARY KEY);"); let conn = tmp_db.connect_limbo(); let list_query = "SELECT * FROM test"; @@ -199,7 +194,7 @@ fn test_sequential_write() -> anyhow::Result<()> { /// https://github.com/tursodatabase/turso/pull/679 fn test_regression_multi_row_insert() -> anyhow::Result<()> { let _ = env_logger::try_init(); - let tmp_db = TempDatabase::new_with_rusqlite("CREATE TABLE test (x REAL);", false); + let tmp_db = TempDatabase::new_with_rusqlite("CREATE TABLE test (x REAL);"); let conn = tmp_db.connect_limbo(); let insert_query = "INSERT INTO test VALUES (-2), (-3), (-1)"; @@ -232,7 +227,7 @@ fn test_regression_multi_row_insert() -> anyhow::Result<()> { #[test] fn test_statement_reset() -> anyhow::Result<()> { let _ = env_logger::try_init(); - let tmp_db = TempDatabase::new_with_rusqlite("create table test (i integer);", false); + let tmp_db = TempDatabase::new_with_rusqlite("create table test (i integer);"); let conn = tmp_db.connect_limbo(); conn.execute("insert into test values (1)")?; @@ -278,8 +273,7 @@ fn test_statement_reset() -> anyhow::Result<()> { #[test] fn test_wal_checkpoint() -> anyhow::Result<()> { let _ = env_logger::try_init(); - let tmp_db = - TempDatabase::new_with_rusqlite("CREATE TABLE test (x INTEGER PRIMARY KEY);", false); + let tmp_db = TempDatabase::new_with_rusqlite("CREATE TABLE test (x INTEGER PRIMARY KEY);"); // threshold is 1000 by default let iterations = 1001_usize; let conn = tmp_db.connect_limbo(); @@ -309,8 +303,7 @@ fn test_wal_checkpoint() -> anyhow::Result<()> { #[test] fn test_wal_restart() -> anyhow::Result<()> { let _ = env_logger::try_init(); - let tmp_db = - TempDatabase::new_with_rusqlite("CREATE TABLE test (x INTEGER PRIMARY KEY);", false); + let tmp_db = TempDatabase::new_with_rusqlite("CREATE TABLE test (x INTEGER PRIMARY KEY);"); // threshold is 1000 by default fn insert(i: usize, conn: &Arc, tmp_db: &TempDatabase) -> anyhow::Result<()> { @@ -355,7 +348,7 @@ fn test_wal_restart() -> anyhow::Result<()> { #[test] fn test_insert_after_big_blob() -> anyhow::Result<()> { let _ = env_logger::try_init(); - let tmp_db = TempDatabase::new_with_rusqlite("CREATE TABLE temp (t1 BLOB, t2 INTEGER)", false); + let tmp_db = TempDatabase::new_with_rusqlite("CREATE TABLE temp (t1 BLOB, t2 INTEGER)"); let conn = tmp_db.connect_limbo(); conn.execute("insert into temp(t1) values (zeroblob (262144))")?; @@ -371,7 +364,7 @@ fn test_write_delete_with_index() -> anyhow::Result<()> { maybe_setup_tracing(); - let tmp_db = TempDatabase::new_with_rusqlite("CREATE TABLE test (x PRIMARY KEY);", false); + let tmp_db = TempDatabase::new_with_rusqlite("CREATE TABLE test (x PRIMARY KEY);"); let conn = tmp_db.connect_limbo(); let list_query = "SELECT * FROM test"; @@ -425,8 +418,7 @@ fn test_update_with_index() -> anyhow::Result<()> { maybe_setup_tracing(); - let tmp_db = - TempDatabase::new_with_rusqlite("CREATE TABLE test (x REAL PRIMARY KEY, y TEXT);", true); + let tmp_db = TempDatabase::new_with_rusqlite("CREATE TABLE test (x REAL PRIMARY KEY, y TEXT);"); let conn = tmp_db.connect_limbo(); common::run_query(&tmp_db, &conn, "INSERT INTO test VALUES (1.0, 'foo')")?; @@ -462,7 +454,7 @@ fn test_delete_with_index() -> anyhow::Result<()> { maybe_setup_tracing(); - let tmp_db = TempDatabase::new_with_rusqlite("CREATE TABLE t (x UNIQUE)", true); + let tmp_db = TempDatabase::new_with_rusqlite("CREATE TABLE t (x UNIQUE)"); let conn = tmp_db.connect_limbo(); common::run_query(&tmp_db, &conn, "INSERT INTO t VALUES (1), (2)")?; @@ -478,7 +470,7 @@ fn test_delete_with_index() -> anyhow::Result<()> { #[test] fn test_update_regression() -> anyhow::Result<()> { let _ = env_logger::try_init(); - let tmp_db = TempDatabase::new_with_rusqlite("CREATE TABLE imaginative_baroja (blithesome_hall BLOB,remarkable_lester INTEGER,generous_balagun TEXT,ample_earth INTEGER,marvelous_khadzhiev BLOB,glowing_parissi TEXT,insightful_ryner BLOB)", false); + let tmp_db = TempDatabase::new_with_rusqlite("CREATE TABLE imaginative_baroja (blithesome_hall BLOB,remarkable_lester INTEGER,generous_balagun TEXT,ample_earth INTEGER,marvelous_khadzhiev BLOB,glowing_parissi TEXT,insightful_ryner BLOB)"); let conn = tmp_db.connect_limbo(); conn.execute("INSERT INTO imaginative_baroja VALUES (X'617070726F61636861626C655F6F6D6164', 5581285929211692372, 'approachable_podur', -4145754929970306534, X'666F72747569746F75735F7368617270', 'sensible_amesly', X'636F6D70657469746976655F6669746368'), (X'6D6972746866756C5F686F6673746565', -8554670009677647372, 'shimmering_modkraftdk', 4993627046425025026, X'636F6E73696465726174655F63616765', 'breathtaking_boggs', X'616D617A696E675F73696D6F6E65'), (X'7669766163696F75735F7363687761727A', 5860599187854155616, 'sparkling_aurora', 3757552048117668067, X'756E697175655F6769617A', 'lovely_leroy', X'68617264776F726B696E675F6D696C6C6572'), (X'677265676172696F75735F7061657065', -488992130149088413, 'focused_brinker', 4503849242092922100, X'66756E6E795F6A616B736963', 'competitive_communications', X'657863656C6C656E745F7873696C656E74'), (X'7374756E6E696E675F74616E6E656E6261756D', -5634782647279946253, 'fabulous_crute', -3978009805517476564, X'72656C617865645F63617272796F7574', 'spellbinding_erkan', X'66756E6E795F646F626273'), (X'696D6167696E61746976655F746F6C6F6B6F6E6E696B6F7661', 4236471363502323025, 'excellent_wolke', 7606168469334609395, X'736C65656B5F6D6361666565', 'magnificent_riley', X'616D6961626C655F706173736164616B6973'), (X'77696C6C696E675F736872657665', 5048296470820985219, 'ambitious_jeppesen', 6961857167361512834, X'70617469656E745F6272696E6B6572', 'giving_kramm', X'726573706F6E7369626C655F7363686D696474'), (X'73656E7369626C655F6D757865726573', -5519194136843846790, 'frank_ruggero', 4354855935194921345, X'76697669645F63617365', 'focused_lovecruft', X'6D61676E69666963656E745F736B79')")?; @@ -635,7 +627,7 @@ fn test_rollback_on_foreign_key_constraint_violation() -> anyhow::Result<()> { #[test] fn test_multiple_statements() -> anyhow::Result<()> { let _ = env_logger::try_init(); - let tmp_db = TempDatabase::new_with_rusqlite("CREATE TABLE t (x)", false); + let tmp_db = TempDatabase::new_with_rusqlite("CREATE TABLE t (x)"); let conn = tmp_db.connect_limbo(); conn.execute("INSERT INTO t values(1); insert into t values(2);")?; @@ -729,7 +721,7 @@ fn test_write_concurrent_connections() -> anyhow::Result<()> { maybe_setup_tracing(); - let tmp_db = TempDatabase::new_with_rusqlite("CREATE TABLE t (x)", false); + let tmp_db = TempDatabase::new_with_rusqlite("CREATE TABLE t (x)"); let num_connections = 4; let num_inserts_per_connection = 100; let mut connections = vec![]; @@ -780,7 +772,7 @@ fn test_wal_bad_frame() -> anyhow::Result<()> { maybe_setup_tracing(); let _ = env_logger::try_init(); let db_path = { - let tmp_db = TempDatabase::new_with_rusqlite("CREATE TABLE t1 (x)", false); + let tmp_db = TempDatabase::new_with_rusqlite("CREATE TABLE t1 (x)"); let db_path = tmp_db.path.clone(); let conn = tmp_db.connect_limbo(); conn.execute("BEGIN")?; @@ -872,20 +864,20 @@ fn test_read_wal_dumb_no_frames() -> anyhow::Result<()> { maybe_setup_tracing(); let _ = env_logger::try_init(); let db_path = { - let tmp_db = TempDatabase::new_empty(false); + let tmp_db = TempDatabase::new_empty(); let conn = tmp_db.connect_limbo(); conn.close()?; tmp_db.path.clone() }; // Second connection must recover from the WAL file. Last checksum should be filled correctly. { - let tmp_db = TempDatabase::new_with_existent(&db_path, false); + let tmp_db = TempDatabase::new_with_existent(&db_path); let conn = tmp_db.connect_limbo(); conn.execute("CREATE TABLE t0 (x)")?; conn.close()?; } { - let tmp_db = TempDatabase::new_with_existent(&db_path, false); + let tmp_db = TempDatabase::new_with_existent(&db_path); let conn = tmp_db.connect_limbo(); conn.execute("INSERT INTO t0(x) VALUES (1)")?; conn.close()?; @@ -896,7 +888,7 @@ fn test_read_wal_dumb_no_frames() -> anyhow::Result<()> { #[test] fn test_insert_with_column_names() -> anyhow::Result<()> { - let tmp_db = TempDatabase::new_with_rusqlite("CREATE TABLE a(z)", false); + let tmp_db = TempDatabase::new_with_rusqlite("CREATE TABLE a(z)"); let conn = tmp_db.connect_limbo(); let result = conn.execute("INSERT INTO a VALUES (b.x)"); @@ -917,7 +909,7 @@ fn test_insert_with_column_names() -> anyhow::Result<()> { #[test] pub fn delete_search_op_ignore_nulls() { - let limbo = TempDatabase::new_empty(true); + let limbo = TempDatabase::new_empty(); let conn = limbo.db.connect().unwrap(); for sql in [ "CREATE TABLE t (id INTEGER PRIMARY KEY AUTOINCREMENT, c INT);", @@ -938,7 +930,7 @@ pub fn delete_search_op_ignore_nulls() { #[test] pub fn delete_eq_correct() { - let limbo = TempDatabase::new_empty(true); + let limbo = TempDatabase::new_empty(); let conn = limbo.db.connect().unwrap(); for sql in [ "CREATE TABLE t (id INTEGER PRIMARY KEY AUTOINCREMENT, c INT);", @@ -966,7 +958,7 @@ pub fn delete_eq_correct() { #[test] pub fn upsert_conflict() { - let limbo = TempDatabase::new_empty(true); + let limbo = TempDatabase::new_empty(); let conn = limbo.db.connect().unwrap(); for sql in [ "CREATE TABLE t (id INTEGER PRIMARY KEY AUTOINCREMENT, c INT UNIQUE, value INT);", diff --git a/tests/integration/storage/checksum.rs b/tests/integration/storage/checksum.rs index 0935a4d8f..8fb3e42c5 100644 --- a/tests/integration/storage/checksum.rs +++ b/tests/integration/storage/checksum.rs @@ -7,7 +7,7 @@ use turso_core::Row; fn test_per_page_checksum() -> anyhow::Result<()> { let _ = env_logger::try_init(); let db_name = format!("test-{}.db", rng().next_u32()); - let tmp_db = TempDatabase::new(&db_name, false); + let tmp_db = TempDatabase::new(&db_name); let db_path = tmp_db.path.clone(); { @@ -65,7 +65,7 @@ fn test_per_page_checksum() -> anyhow::Result<()> { fn test_checksum_detects_corruption() { let _ = env_logger::try_init(); let db_name = format!("test-corruption-{}.db", rng().next_u32()); - let tmp_db = TempDatabase::new(&db_name, false); + let tmp_db = TempDatabase::new(&db_name); let db_path = tmp_db.path.clone(); // Create and populate the database @@ -98,7 +98,7 @@ fn test_checksum_detects_corruption() { } { - let existing_db = TempDatabase::new_with_existent(&db_path, false); + let existing_db = TempDatabase::new_with_existent(&db_path); // this query should fail and result in panic because db is now corrupted let should_panic = panic::catch_unwind(panic::AssertUnwindSafe(|| { let conn = existing_db.connect_limbo(); diff --git a/tests/integration/wal/test_wal.rs b/tests/integration/wal/test_wal.rs index 2ac4a1285..42e6261e4 100644 --- a/tests/integration/wal/test_wal.rs +++ b/tests/integration/wal/test_wal.rs @@ -9,7 +9,7 @@ use turso_core::{Connection, LimboError, Result, StepResult}; #[test] fn test_wal_checkpoint_result() -> Result<()> { maybe_setup_tracing(); - let tmp_db = TempDatabase::new("test_wal.db", false); + let tmp_db = TempDatabase::new("test_wal.db"); let conn = tmp_db.connect_limbo(); conn.execute("CREATE TABLE t1 (id text);")?; @@ -36,7 +36,7 @@ fn test_wal_checkpoint_result() -> Result<()> { #[ignore = "ignored for now because it's flaky"] fn test_wal_1_writer_1_reader() -> Result<()> { maybe_setup_tracing(); - let tmp_db = Arc::new(Mutex::new(TempDatabase::new("test_wal.db", false))); + let tmp_db = Arc::new(Mutex::new(TempDatabase::new("test_wal.db"))); let db = tmp_db.lock().unwrap().limbo_database(false); {