mirror of
https://github.com/comit-network/xmr-btc-swap.git
synced 2024-10-01 01:45:40 -04:00
Inline tracing initialization
This code snippet is so short, it might as well be inlined to give the test more control over what it wants to log.
This commit is contained in:
parent
96c87bca71
commit
908dae3442
@ -1,15 +1,15 @@
|
||||
use crate::testutils::init_tracing;
|
||||
use monero_harness::Monero;
|
||||
use spectral::prelude::*;
|
||||
use std::time::Duration;
|
||||
use testcontainers::clients::Cli;
|
||||
use tokio::time;
|
||||
|
||||
mod testutils;
|
||||
use tracing_subscriber::util::SubscriberInitExt;
|
||||
|
||||
#[tokio::test]
|
||||
async fn init_miner_and_mine_to_miner_address() {
|
||||
let _guard = init_tracing();
|
||||
let _guard = tracing_subscriber::fmt()
|
||||
.with_env_filter("warn,test=debug,monero_harness=debug,monero_rpc=debug")
|
||||
.set_default();
|
||||
|
||||
let tc = Cli::default();
|
||||
let (monero, _monerod_container) = Monero::new(&tc, vec![]).await.unwrap();
|
||||
|
@ -1,14 +0,0 @@
|
||||
use tracing::subscriber::DefaultGuard;
|
||||
|
||||
/// Utility function to initialize logging in the test environment.
|
||||
/// Note that you have to keep the `_guard` in scope after calling in test:
|
||||
///
|
||||
/// ```rust
|
||||
/// let _guard = init_tracing();
|
||||
/// ```
|
||||
pub fn init_tracing() -> DefaultGuard {
|
||||
use tracing_subscriber::util::SubscriberInitExt as _;
|
||||
tracing_subscriber::fmt()
|
||||
.with_env_filter("warn,test=debug,monero_harness=debug,monero_rpc=debug")
|
||||
.set_default()
|
||||
}
|
@ -1,15 +1,15 @@
|
||||
use crate::testutils::init_tracing;
|
||||
use monero_harness::{Monero, MoneroWalletRpc};
|
||||
use spectral::prelude::*;
|
||||
use std::time::Duration;
|
||||
use testcontainers::clients::Cli;
|
||||
use tokio::time::sleep;
|
||||
|
||||
mod testutils;
|
||||
use tracing_subscriber::util::SubscriberInitExt;
|
||||
|
||||
#[tokio::test]
|
||||
async fn fund_transfer_and_check_tx_key() {
|
||||
let _guard = init_tracing();
|
||||
let _guard = tracing_subscriber::fmt()
|
||||
.with_env_filter("warn,test=debug,monero_harness=debug,monero_rpc=debug")
|
||||
.set_default();
|
||||
|
||||
let fund_alice: u64 = 1_000_000_000_000;
|
||||
let fund_bob = 0;
|
||||
|
@ -28,7 +28,7 @@ use testcontainers::{Container, Docker, RunArgs};
|
||||
use tokio::sync::mpsc;
|
||||
use tokio::task::JoinHandle;
|
||||
use tokio::time::interval;
|
||||
use tracing::dispatcher::DefaultGuard;
|
||||
use tracing_subscriber::util::SubscriberInitExt;
|
||||
use url::Url;
|
||||
use uuid::Uuid;
|
||||
|
||||
@ -319,7 +319,9 @@ where
|
||||
{
|
||||
let cli = Cli::default();
|
||||
|
||||
let _guard = init_tracing();
|
||||
let _guard = tracing_subscriber::fmt()
|
||||
.with_env_filter("warn,swap=debug,monero_harness=debug,monero_rpc=info,bitcoin_harness=info,testcontainers=info")
|
||||
.set_default();
|
||||
|
||||
let env_config = C::get_config();
|
||||
|
||||
@ -658,19 +660,6 @@ struct Containers<'a> {
|
||||
electrs: Container<'a, Cli, electrs::Electrs>,
|
||||
}
|
||||
|
||||
/// Utility function to initialize logging in the test environment.
|
||||
/// Note that you have to keep the `_guard` in scope after calling in test:
|
||||
///
|
||||
/// ```rust
|
||||
/// let _guard = init_tracing();
|
||||
/// ```
|
||||
pub fn init_tracing() -> DefaultGuard {
|
||||
use tracing_subscriber::util::SubscriberInitExt as _;
|
||||
tracing_subscriber::fmt()
|
||||
.with_env_filter("warn,swap=debug,monero_harness=debug,monero_rpc=info,bitcoin_harness=info,testcontainers=info")
|
||||
.set_default()
|
||||
}
|
||||
|
||||
pub mod alice_run_until {
|
||||
use swap::protocol::alice::AliceState;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user