Skip to content

Commit db10943

Browse files
committed
pass tmp to env
1 parent 3d5cc3d commit db10943

1 file changed

Lines changed: 9 additions & 4 deletions

File tree

libsql-wal/src/lib.rs

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ pub mod test {
3434
use crate::wal::{LibsqlWal, LibsqlWalManager};
3535

3636
pub struct TestEnv<IO: Io = StdIO> {
37-
pub tmp: TempDir,
37+
pub tmp: Arc<TempDir>,
3838
pub registry: Arc<WalRegistry<IO, TestStorage<IO>>>,
3939
pub wal: LibsqlWalManager<IO, TestStorage<IO>>,
4040
}
@@ -49,9 +49,13 @@ pub mod test {
4949
}
5050
}
5151

52-
impl<IO: Io> TestEnv<IO> {
52+
impl<IO: Io + Clone> TestEnv<IO> {
5353
pub fn new_io(io: IO, store: bool) -> Self {
5454
let tmp = tempdir().unwrap();
55+
Self::new_io_and_tmp(io, tmp.into(), store)
56+
}
57+
58+
pub fn new_io_and_tmp(io: IO, tmp: Arc<TempDir>, store: bool) -> Self {
5559
let resolver = |path: &Path| {
5660
let name = path
5761
.parent()
@@ -65,9 +69,10 @@ pub mod test {
6569

6670
let (sender, receiver) = mpsc::channel(128);
6771
let registry = Arc::new(
68-
WalRegistry::new(
72+
WalRegistry::new_with_io(
73+
io.clone(),
6974
tmp.path().join("test/wals"),
70-
TestStorage::new_io(store, StdIO(())),
75+
TestStorage::new_io(store, io),
7176
sender,
7277
)
7378
.unwrap(),

0 commit comments

Comments
 (0)