Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions src/peer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,18 @@ impl PeerMap {
Ok(pm)
}

// Test-only: construct with an explicit DB path, bypassing DB_URL/get_arg_opt entirely.
// A test that instead did `std::env::set_var("DB_URL", ...)` before calling `new()` would
// be mutating process-global state with no isolation from other tests running in the same
// (by default parallel) test binary -- this constructor exists so tests never need to.
#[cfg(test)]
pub(crate) async fn new_with_db_url(url: &str) -> ResultType<Self> {
Ok(Self {
map: Default::default(),
db: database::Database::new(url).await?,
})
}

#[inline]
pub(crate) async fn update_pk(
&mut self,
Expand Down
Loading