Skip to content

Commit

Permalink
Shared::with_temp_db should create db in a non-exist path
Browse files Browse the repository at this point in the history
Signed-off-by: Eval EXEC <[email protected]>
  • Loading branch information
eval-exec committed Mar 5, 2024
1 parent 0e1e2b1 commit 2a306be
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions shared/src/shared_builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -180,6 +180,18 @@ impl SharedBuilder {
.unwrap()
.path()
.to_path_buf();

if std::fs::read_dir(&db_base_dir)
.expect("read db_base_dir must be ok")
.count()
!= 0
{
panic!(
"In test code, Shared::with_temp_db created a db path should be empty: {}, db_id: {}",
db_base_dir.display(), db_id,
);
}

let db_dir = db_base_dir.join(format!("db_{db_id}"));
RocksDB::open_in(db_dir, COLUMNS)
};
Expand Down

0 comments on commit 2a306be

Please sign in to comment.