mirror of
https://github.com/comit-network/xmr-btc-swap.git
synced 2024-12-24 06:59:36 -05:00
Enable tracing in monero-harness
This commit is contained in:
parent
664958939d
commit
bfc388d264
2
Cargo.lock
generated
2
Cargo.lock
generated
@ -1945,6 +1945,8 @@ dependencies = [
|
||||
"testcontainers",
|
||||
"tokio",
|
||||
"tracing",
|
||||
"tracing-log",
|
||||
"tracing-subscriber",
|
||||
"url",
|
||||
]
|
||||
|
||||
|
@ -17,4 +17,6 @@ spectral = "0.6"
|
||||
testcontainers = "0.11"
|
||||
tokio = { version = "0.2", default-features = false, features = ["blocking", "macros", "rt-core", "time"] }
|
||||
tracing = "0.1"
|
||||
tracing-log = "0.1"
|
||||
tracing-subscriber = { version = "0.2", default-features = false, features = ["fmt", "ansi", "env-filter"] }
|
||||
url = "2"
|
||||
|
@ -1,11 +1,16 @@
|
||||
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;
|
||||
|
||||
#[tokio::test]
|
||||
async fn init_miner_and_mine_to_miner_address() {
|
||||
let _guard = init_tracing();
|
||||
|
||||
let tc = Cli::default();
|
||||
let (monero, _monerod_container) = Monero::new(&tc, None, vec![]).await.unwrap();
|
||||
|
||||
|
27
monero-harness/tests/testutils/mod.rs
Normal file
27
monero-harness/tests/testutils/mod.rs
Normal file
@ -0,0 +1,27 @@
|
||||
use tracing::subscriber::DefaultGuard;
|
||||
use tracing_log::LogTracer;
|
||||
|
||||
/// 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 {
|
||||
// converts all log records into tracing events
|
||||
// Note: Make sure to initialize without unwrapping, otherwise this causes
|
||||
// trouble when running multiple tests.
|
||||
let _ = LogTracer::init();
|
||||
|
||||
let global_filter = tracing::Level::WARN;
|
||||
let test_filter = tracing::Level::DEBUG;
|
||||
let monero_harness_filter = tracing::Level::INFO;
|
||||
|
||||
use tracing_subscriber::util::SubscriberInitExt as _;
|
||||
tracing_subscriber::fmt()
|
||||
.with_env_filter(format!(
|
||||
"{},test={},monero_harness={}",
|
||||
global_filter, test_filter, monero_harness_filter,
|
||||
))
|
||||
.set_default()
|
||||
}
|
@ -1,9 +1,14 @@
|
||||
use crate::testutils::init_tracing;
|
||||
use monero_harness::Monero;
|
||||
use spectral::prelude::*;
|
||||
use testcontainers::clients::Cli;
|
||||
|
||||
mod testutils;
|
||||
|
||||
#[tokio::test]
|
||||
async fn fund_transfer_and_check_tx_key() {
|
||||
let _guard = init_tracing();
|
||||
|
||||
let fund_alice: u64 = 1_000_000_000_000;
|
||||
let fund_bob = 0;
|
||||
let send_to_bob = 5_000_000_000;
|
||||
|
Loading…
Reference in New Issue
Block a user