Skip to content

Commit

Permalink
modify debug output for test(s)
Browse files Browse the repository at this point in the history
Addresses:
  #56 (comment)

Changes:
 1. remove test environment detection in ::get_latest_balance_height()
 2. decorate wallet_state_prune_abandoned_mutxos() with #[traced_test]

The net effect is that:
 1. The decorated test case will display debug!() log output.
 2. Any other test cases will not.
  • Loading branch information
dan-da authored and Sword-Smith committed Oct 14, 2023
1 parent 1d01593 commit 3fd5fc7
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 4 deletions.
4 changes: 0 additions & 4 deletions src/models/state/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -98,12 +98,8 @@ impl GlobalState {
let (height, time_secs) =
time_fn_call_async(self.get_latest_balance_height_internal()).await;

#[cfg(not(test))]
debug!("call to get_latest_balance_height() took {time_secs} seconds");

#[cfg(test)]
println!("call to get_latest_balance_height() took {time_secs} seconds");

height
}

Expand Down
2 changes: 2 additions & 0 deletions src/models/state/wallet/wallet_state.rs
Original file line number Diff line number Diff line change
Expand Up @@ -823,6 +823,7 @@ impl WalletState {
#[cfg(test)]
mod tests {
use num_traits::One;
use tracing_test::traced_test;

use crate::{
config_models::network::Network,
Expand All @@ -833,6 +834,7 @@ mod tests {
use super::*;

#[tokio::test]
#[traced_test]
async fn wallet_state_prune_abandoned_mutxos() {
// Get genesis block. Verify wallet is empty
// Add two blocks to state containing no UTXOs for own wallet
Expand Down

0 comments on commit 3fd5fc7

Please sign in to comment.