Skip to content

Commit

Permalink
Make tests less verbose (#334)
Browse files Browse the repository at this point in the history
The log level is no longer hardcoded in tests. It can be manually
overriden with an environment variable when calling `cargo test` or
`contrib/test.sh`.

I set RUST_LOG=debug in the github workflow to maintain the same
behavior there, but we can remove that if not needed.
  • Loading branch information
DanGould authored Jul 30, 2024
2 parents 8d4196f + 11f1a0c commit a5091f6
Show file tree
Hide file tree
Showing 3 changed files with 1 addition and 8 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/rust.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ jobs:
cargo update -p url --precise 2.5.0
cargo update -p which --precise 4.4.0
- name: Run tests
run: bash contrib/test.sh
run: RUST_LOG=debug bash contrib/test.sh

rustfmt:
runs-on: ubuntu-latest
Expand Down
3 changes: 0 additions & 3 deletions payjoin-cli/tests/e2e.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,6 @@ mod e2e {
#[cfg(not(feature = "v2"))]
#[tokio::test(flavor = "multi_thread", worker_threads = 4)]
async fn send_receive_payjoin() {
env::set_var("RUST_LOG", "debug");

let bitcoind_exe = env::var("BITCOIND_EXE")
.ok()
.or_else(|| bitcoind::downloaded_exe_path().ok())
Expand Down Expand Up @@ -161,7 +159,6 @@ mod e2e {
static TESTS_TIMEOUT: Lazy<Duration> = Lazy::new(|| Duration::from_secs(20));
static WAIT_SERVICE_INTERVAL: Lazy<Duration> = Lazy::new(|| Duration::from_secs(3));

env::set_var("RUST_LOG", "debug");
init_tracing();
let (cert, key) = local_cert_key();
let ohttp_relay_port = find_free_port();
Expand Down
4 changes: 0 additions & 4 deletions payjoin/tests/integration.rs
Original file line number Diff line number Diff line change
Expand Up @@ -307,7 +307,6 @@ mod integration {
OhttpKeys::from_str("AQAg3WpRjS0aqAxQUoLvpas2VYjT2oIg6-3XSiB-QiYI1BAABAABAAM")
.expect("Invalid OhttpKeys");

std::env::set_var("RUST_LOG", "debug");
let (cert, key) = local_cert_key();
let port = find_free_port();
let directory = Url::parse(&format!("https://localhost:{}", port)).unwrap();
Expand Down Expand Up @@ -346,7 +345,6 @@ mod integration {

#[tokio::test]
async fn test_session_expiration() {
std::env::set_var("RUST_LOG", "debug");
init_tracing();
let (cert, key) = local_cert_key();
let ohttp_relay_port = find_free_port();
Expand Down Expand Up @@ -417,7 +415,6 @@ mod integration {

#[tokio::test]
async fn v2_to_v2() {
std::env::set_var("RUST_LOG", "debug");
init_tracing();
let (cert, key) = local_cert_key();
let ohttp_relay_port = find_free_port();
Expand Down Expand Up @@ -531,7 +528,6 @@ mod integration {

#[tokio::test]
async fn v1_to_v2() {
std::env::set_var("RUST_LOG", "debug");
init_tracing();
let (cert, key) = local_cert_key();
let ohttp_relay_port = find_free_port();
Expand Down

0 comments on commit a5091f6

Please sign in to comment.