From 16df5f9fe2e182ea77f6b1c70a1618b34eda0ccc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bartosz=20R=C3=B3=C5=BCa=C5=84ski?= Date: Wed, 2 Oct 2024 14:12:32 +0200 Subject: [PATCH] fix tests on windows --- src/partial_quicksync.rs | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/src/partial_quicksync.rs b/src/partial_quicksync.rs index 107e4b9..538623a 100644 --- a/src/partial_quicksync.rs +++ b/src/partial_quicksync.rs @@ -310,8 +310,10 @@ mod tests { fn partial_restore() { let dir = tempdir().unwrap(); let db_path = dir.path().join("state.db"); - let conn = create_test_db(Some(&db_path)); - insert_layer(&conn, 99, 100, &[0xBB, 0xBB]); + { + let conn = create_test_db(Some(&db_path)); + insert_layer(&conn, 99, 100, &[0xBB, 0xBB]); + } let mut server = mockito::Server::new(); let user_version = 0; @@ -377,6 +379,7 @@ mod tests { mock.assert(); } + let conn = Connection::open(&db_path).unwrap(); let latest = get_latest_from_db(&conn).unwrap(); assert_eq!(latest, points.last().unwrap().1.to - 1); @@ -388,8 +391,10 @@ mod tests { fn fails_on_hash_mismatch() { let dir = tempdir().unwrap(); let db_path = dir.path().join("state.db"); - let conn = create_test_db(Some(&db_path)); - insert_layer(&conn, 99, 100, &[0xFF, 0xFF]); + { + let conn = create_test_db(Some(&db_path)); + insert_layer(&conn, 99, 100, &[0xFF, 0xFF]); + } let mut server = mockito::Server::new(); let user_version = 0;