Skip to content

Commit a539ad0

Browse files
committed
fix tests
1 parent e8dafb2 commit a539ad0

File tree

2 files changed

+10
-16
lines changed

2 files changed

+10
-16
lines changed

libsql-wal/tests/flaky_fs.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -181,8 +181,8 @@ fn enable_libsql_logging() {
181181
});
182182
}
183183

184-
#[test]
185-
fn flaky_fs() {
184+
#[tokio::test]
185+
async fn flaky_fs() {
186186
enable_libsql_logging();
187187
let seed = rand::thread_rng().gen();
188188
println!("seed: {seed}");

libsql-wal/tests/oracle.rs

Lines changed: 8 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,8 @@ use tempfile::tempdir;
2626

2727
type Result = std::result::Result<(), Box<dyn std::error::Error>>;
2828

29-
#[test]
30-
fn test_oracle() {
29+
#[tokio::test]
30+
async fn test_oracle() {
3131
let manifest_path: &Path = env!("CARGO_MANIFEST_DIR").as_ref();
3232
let test_samples_path = manifest_path.join("tests/assets/fixtures");
3333

@@ -41,12 +41,12 @@ fn test_oracle() {
4141
}
4242
}
4343
if entry.file_type().is_file() {
44-
run_test_sample(entry.path()).unwrap();
44+
run_test_sample(entry.path()).await.unwrap();
4545
}
4646
}
4747
}
4848

49-
fn run_test_sample(path: &Path) -> Result {
49+
async fn run_test_sample(path: &Path) -> Result {
5050
println!("test: {:?}", path.file_name().unwrap());
5151
let curdir = std::env::current_dir().unwrap();
5252
let tmp = tempdir()?;
@@ -123,14 +123,8 @@ fn run_test_sample(path: &Path) -> Result {
123123
drop(libsql_conn);
124124

125125
let shared = registry.clone().open(&db_path, &"test".into()).unwrap();
126-
let rt = tokio::runtime::Builder::new_current_thread()
127-
.enable_all()
128-
.build()
129-
.unwrap();
130126
seal_current_segment(&shared);
131-
rt.block_on(async {
132-
shared.checkpoint().await.unwrap();
133-
});
127+
shared.checkpoint().await.unwrap();
134128

135129
std::env::set_current_dir(curdir).unwrap();
136130
match std::panic::catch_unwind(|| {
@@ -168,9 +162,9 @@ impl Display for PrintScript {
168162
}
169163
}
170164

171-
fn compare_db_files(db1: &Path, db2: &Path) {
172-
let db1 = std::fs::File::open(db1).unwrap();
173-
let db2 = std::fs::File::open(db2).unwrap();
165+
fn compare_db_files(sqlite: &Path, libsql: &Path) {
166+
let db1 = std::fs::File::open(sqlite).unwrap();
167+
let db2 = std::fs::File::open(libsql).unwrap();
174168

175169
let len1 = db1.metadata().unwrap().len();
176170
let len2 = db2.metadata().unwrap().len();

0 commit comments

Comments
 (0)