Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Integration tests #104

Merged
merged 2 commits into from
Sep 11, 2024
Merged
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
4 changes: 2 additions & 2 deletions .github/workflows/rust.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,10 +39,10 @@ jobs:
run: cargo check

- name: Tests (Bitcoin mode, REST+Electrum)
run: cargo test
run: RUST_LOG=debug cargo test

- name: Tests (Liquid mode, REST)
run: cargo test --features liquid
run: RUST_LOG=debug cargo test --features liquid

nix:
runs-on: ubuntu-latest
Expand Down
10 changes: 8 additions & 2 deletions tests/common.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
use std::str::FromStr;
use std::sync::{Arc, Once, RwLock};
use std::{env, net};

use log::LevelFilter;
use stderrlog::StdErrLog;
use tempfile::TempDir;

Expand Down Expand Up @@ -53,7 +55,7 @@ impl TestRunner {
#[cfg(feature = "liquid")]
node_conf.args.push("-anyonecanspendaremine=1");

node_conf.view_stdout = true;
node_conf.view_stdout = std::env::var_os("RUST_LOG").is_some();
}

// Setup node
Expand Down Expand Up @@ -310,7 +312,11 @@ fn generate(
fn init_log() -> StdErrLog {
static ONCE: Once = Once::new();
let mut log = stderrlog::new();
log.verbosity(4);
match std::env::var("RUST_LOG") {
Ok(e) => log.verbosity(LevelFilter::from_str(&e).unwrap_or(LevelFilter::Off)),
Err(_) => log.verbosity(0),
};

// log.timestamp(stderrlog::Timestamp::Millisecond );
ONCE.call_once(|| log.init().expect("logging initialization failed"));
log
Expand Down
6 changes: 5 additions & 1 deletion tests/electrum.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,11 @@ fn test_electrum() -> Result<()> {
// Spawn an headless Electrum wallet RPC daemon, connected to Electrs
let mut electrum_wallet_conf = electrumd::Conf::default();
let server_arg = format!("{}:t", electrum_addr.to_string());
electrum_wallet_conf.args = vec!["-v", "--server", &server_arg];
electrum_wallet_conf.args = if std::env::var_os("RUST_LOG").is_some() {
vec!["-v", "--server", &server_arg]
} else {
vec!["--server", &server_arg]
};
electrum_wallet_conf.view_stdout = true;
let electrum_wallet = ElectrumD::with_conf(electrumd::exe_path()?, &electrum_wallet_conf)?;

Expand Down
Loading