mirror of
https://github.com/comit-network/xmr-btc-swap.git
synced 2025-02-22 23:59:49 -05:00
Generate temp dir for db
This commit is contained in:
parent
3e82211a82
commit
03dee7a3ea
@ -11,7 +11,6 @@ mod tests {
|
|||||||
harness::{
|
harness::{
|
||||||
init_bitcoind, init_test,
|
init_bitcoind, init_test,
|
||||||
node::{run_alice_until, run_bob_until},
|
node::{run_alice_until, run_bob_until},
|
||||||
ALICE_TEST_DB_FOLDER, BOB_TEST_DB_FOLDER,
|
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
use futures::future;
|
use futures::future;
|
||||||
@ -19,7 +18,7 @@ mod tests {
|
|||||||
use rand::rngs::OsRng;
|
use rand::rngs::OsRng;
|
||||||
|
|
||||||
use crate::harness::storage::Database;
|
use crate::harness::storage::Database;
|
||||||
use std::{convert::TryInto, path::Path};
|
use std::convert::TryInto;
|
||||||
use testcontainers::clients::Cli;
|
use testcontainers::clients::Cli;
|
||||||
use tracing_subscriber::util::SubscriberInitExt;
|
use tracing_subscriber::util::SubscriberInitExt;
|
||||||
use xmr_btc::{
|
use xmr_btc::{
|
||||||
@ -252,10 +251,13 @@ mod tests {
|
|||||||
let cli = Cli::default();
|
let cli = Cli::default();
|
||||||
let (monero, _container) = Monero::new(&cli);
|
let (monero, _container) = Monero::new(&cli);
|
||||||
let bitcoind = init_bitcoind(&cli).await;
|
let bitcoind = init_bitcoind(&cli).await;
|
||||||
|
|
||||||
|
let alice_db_dir = tempfile::tempdir().unwrap();
|
||||||
let alice_db: Database<alice::State> =
|
let alice_db: Database<alice::State> =
|
||||||
harness::storage::Database::open(Path::new(ALICE_TEST_DB_FOLDER)).unwrap();
|
harness::storage::Database::open(alice_db_dir.path()).unwrap();
|
||||||
|
let bob_db_dir = tempfile::tempdir().unwrap();
|
||||||
let bob_db: Database<bob::State> =
|
let bob_db: Database<bob::State> =
|
||||||
harness::storage::Database::open(Path::new(BOB_TEST_DB_FOLDER)).unwrap();
|
harness::storage::Database::open(bob_db_dir.path()).unwrap();
|
||||||
|
|
||||||
let (
|
let (
|
||||||
alice_state0,
|
alice_state0,
|
||||||
|
@ -105,7 +105,8 @@ mod tests {
|
|||||||
|
|
||||||
#[tokio::test]
|
#[tokio::test]
|
||||||
async fn recover_state_from_db() {
|
async fn recover_state_from_db() {
|
||||||
let db = Database::open(Path::new("../target/test_recover.db")).unwrap();
|
let db_dir = tempfile::tempdir().unwrap();
|
||||||
|
let db = Database::open(db_dir.path()).unwrap();
|
||||||
|
|
||||||
let a = xmr_btc::bitcoin::SecretKey::new_random(&mut OsRng);
|
let a = xmr_btc::bitcoin::SecretKey::new_random(&mut OsRng);
|
||||||
let s_a = cross_curve_dleq::Scalar::random(&mut OsRng);
|
let s_a = cross_curve_dleq::Scalar::random(&mut OsRng);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user