From 9ccb0492ce00ae7ce3abafd08320c8b4acc4110f Mon Sep 17 00:00:00 2001 From: Franck Royer Date: Fri, 29 Jan 2021 17:06:14 +1100 Subject: [PATCH] Remove redundant qualifier --- .github/workflows/ci.yml | 2 +- swap/src/tests/happy_path.rs | 6 +++--- swap/src/tests/happy_path_restart_alice.rs | 6 +++--- swap/src/tests/happy_path_restart_bob_after_comm.rs | 6 +++--- .../happy_path_restart_bob_after_lock_proof_received.rs | 6 +++--- swap/src/tests/happy_path_restart_bob_before_comm.rs | 6 +++--- swap/src/tests/mod.rs | 2 +- swap/src/tests/punish.rs | 6 +++--- swap/src/tests/refund_restart_alice.rs | 6 +++--- swap/src/tests/refund_restart_alice_cancelled.rs | 6 +++--- swap/src/tests/{testutils.rs => utils.rs} | 4 ++-- 11 files changed, 28 insertions(+), 28 deletions(-) rename swap/src/tests/{testutils.rs => utils.rs} (99%) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index f5560b6c..4652a769 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -160,7 +160,7 @@ jobs: key: rust-${{ env.TARGET }}-cargo-registry-directory-${{ hashFiles('Cargo.lock') }}-v1 - name: Run test ${{ matrix.test_name }} - run: cargo test --package swap --all-features --lib tests::${{ matrix.test_name }} "" + run: cargo test --package swap --all-features --lib tests::${{ matrix.test_name }} env: MONERO_ADDITIONAL_SLEEP_PERIOD: 60000 RUST_MIN_STACK: 16777216 # 16 MB. Default is 8MB. This is fine as in tests we start 2 programs: Alice and Bob. diff --git a/swap/src/tests/happy_path.rs b/swap/src/tests/happy_path.rs index 103236b5..5b8d0833 100644 --- a/swap/src/tests/happy_path.rs +++ b/swap/src/tests/happy_path.rs @@ -1,15 +1,15 @@ use crate::{ protocol::{alice, bob}, - tests::testutils, + tests::utils, }; -use testutils::SlowCancelConfig; use tokio::join; +use utils::SlowCancelConfig; /// Run the following tests with RUST_MIN_STACK=10000000 #[tokio::test] async fn happy_path() { - testutils::setup_test(SlowCancelConfig, |mut ctx| async move { + utils::setup_test(SlowCancelConfig, |mut ctx| async move { let (alice_swap, _) = ctx.new_swap_as_alice().await; let (bob_swap, _) = ctx.new_swap_as_bob().await; diff --git a/swap/src/tests/happy_path_restart_alice.rs b/swap/src/tests/happy_path_restart_alice.rs index c0d9085a..fa567005 100644 --- a/swap/src/tests/happy_path_restart_alice.rs +++ b/swap/src/tests/happy_path_restart_alice.rs @@ -1,12 +1,12 @@ use crate::{ protocol::{alice, alice::AliceState, bob}, - tests::testutils, + tests::utils, }; -use testutils::{alice_run_until::is_encsig_learned, SlowCancelConfig}; +use utils::{alice_run_until::is_encsig_learned, SlowCancelConfig}; #[tokio::test] async fn given_alice_restarts_after_encsig_is_learned_resume_swap() { - testutils::setup_test(SlowCancelConfig, |mut ctx| async move { + utils::setup_test(SlowCancelConfig, |mut ctx| async move { let (alice_swap, alice_join_handle) = ctx.new_swap_as_alice().await; let (bob_swap, _) = ctx.new_swap_as_bob().await; diff --git a/swap/src/tests/happy_path_restart_bob_after_comm.rs b/swap/src/tests/happy_path_restart_bob_after_comm.rs index 427e832e..37640e21 100644 --- a/swap/src/tests/happy_path_restart_bob_after_comm.rs +++ b/swap/src/tests/happy_path_restart_bob_after_comm.rs @@ -1,12 +1,12 @@ use crate::{ protocol::{alice, bob, bob::BobState}, - tests::testutils, + tests::utils, }; -use testutils::{bob_run_until::is_encsig_sent, SlowCancelConfig}; +use utils::{bob_run_until::is_encsig_sent, SlowCancelConfig}; #[tokio::test] async fn given_bob_restarts_after_encsig_is_sent_resume_swap() { - testutils::setup_test(SlowCancelConfig, |mut ctx| async move { + utils::setup_test(SlowCancelConfig, |mut ctx| async move { let (alice_swap, _) = ctx.new_swap_as_alice().await; let (bob_swap, bob_join_handle) = ctx.new_swap_as_bob().await; diff --git a/swap/src/tests/happy_path_restart_bob_after_lock_proof_received.rs b/swap/src/tests/happy_path_restart_bob_after_lock_proof_received.rs index 6b1da998..45b391e6 100644 --- a/swap/src/tests/happy_path_restart_bob_after_lock_proof_received.rs +++ b/swap/src/tests/happy_path_restart_bob_after_lock_proof_received.rs @@ -1,12 +1,12 @@ use crate::{ protocol::{alice, bob, bob::BobState}, - tests::testutils, + tests::utils, }; -use testutils::{bob_run_until::is_lock_proof_received, SlowCancelConfig}; +use utils::{bob_run_until::is_lock_proof_received, SlowCancelConfig}; #[tokio::test] async fn given_bob_restarts_after_lock_proof_received_resume_swap() { - testutils::setup_test(SlowCancelConfig, |mut ctx| async move { + utils::setup_test(SlowCancelConfig, |mut ctx| async move { let (alice_swap, _) = ctx.new_swap_as_alice().await; let (bob_swap, bob_join_handle) = ctx.new_swap_as_bob().await; diff --git a/swap/src/tests/happy_path_restart_bob_before_comm.rs b/swap/src/tests/happy_path_restart_bob_before_comm.rs index 3433dad0..652b4e00 100644 --- a/swap/src/tests/happy_path_restart_bob_before_comm.rs +++ b/swap/src/tests/happy_path_restart_bob_before_comm.rs @@ -1,12 +1,12 @@ use crate::{ protocol::{alice, bob, bob::BobState}, - tests::testutils, + tests::utils, }; -use testutils::{bob_run_until::is_xmr_locked, SlowCancelConfig}; +use utils::{bob_run_until::is_xmr_locked, SlowCancelConfig}; #[tokio::test] async fn given_bob_restarts_after_xmr_is_locked_resume_swap() { - testutils::setup_test(SlowCancelConfig, |mut ctx| async move { + utils::setup_test(SlowCancelConfig, |mut ctx| async move { let (alice_swap, _) = ctx.new_swap_as_alice().await; let (bob_swap, bob_join_handle) = ctx.new_swap_as_bob().await; diff --git a/swap/src/tests/mod.rs b/swap/src/tests/mod.rs index dc13053a..c70dbcc4 100644 --- a/swap/src/tests/mod.rs +++ b/swap/src/tests/mod.rs @@ -6,4 +6,4 @@ mod happy_path_restart_bob_before_comm; mod punish; mod refund_restart_alice; mod refund_restart_alice_cancelled; -pub mod testutils; +pub mod utils; diff --git a/swap/src/tests/punish.rs b/swap/src/tests/punish.rs index 0e4e89b3..e76474a0 100644 --- a/swap/src/tests/punish.rs +++ b/swap/src/tests/punish.rs @@ -1,14 +1,14 @@ use crate::{ protocol::{alice, bob, bob::BobState}, - tests::testutils, + tests::utils, }; -use testutils::{bob_run_until::is_btc_locked, FastPunishConfig}; +use utils::{bob_run_until::is_btc_locked, FastPunishConfig}; /// Bob locks Btc and Alice locks Xmr. Bob does not act; he fails to send Alice /// the encsig and fail to refund or redeem. Alice punishes. #[tokio::test] async fn alice_punishes_if_bob_never_acts_after_fund() { - testutils::setup_test(FastPunishConfig, |mut ctx| async move { + utils::setup_test(FastPunishConfig, |mut ctx| async move { let (alice_swap, _) = ctx.new_swap_as_alice().await; let (bob_swap, bob_join_handle) = ctx.new_swap_as_bob().await; diff --git a/swap/src/tests/refund_restart_alice.rs b/swap/src/tests/refund_restart_alice.rs index 3ce51a08..bae09177 100644 --- a/swap/src/tests/refund_restart_alice.rs +++ b/swap/src/tests/refund_restart_alice.rs @@ -1,14 +1,14 @@ use crate::{ protocol::{alice, alice::AliceState, bob}, - tests::testutils, + tests::utils, }; -use testutils::{alice_run_until::is_xmr_locked, FastCancelConfig}; +use utils::{alice_run_until::is_xmr_locked, FastCancelConfig}; /// Bob locks btc and Alice locks xmr. Alice fails to act so Bob refunds. Alice /// then also refunds. #[tokio::test] async fn given_alice_restarts_after_xmr_is_locked_refund_swap() { - testutils::setup_test(FastCancelConfig, |mut ctx| async move { + utils::setup_test(FastCancelConfig, |mut ctx| async move { let (alice_swap, alice_join_handle) = ctx.new_swap_as_alice().await; let (bob_swap, _) = ctx.new_swap_as_bob().await; diff --git a/swap/src/tests/refund_restart_alice_cancelled.rs b/swap/src/tests/refund_restart_alice_cancelled.rs index 3a1d51f5..d1ab1662 100644 --- a/swap/src/tests/refund_restart_alice_cancelled.rs +++ b/swap/src/tests/refund_restart_alice_cancelled.rs @@ -1,16 +1,16 @@ use crate::{ config, protocol::{alice, alice::AliceState, bob}, - tests::testutils, + tests::utils, }; -use testutils::alice_run_until::is_encsig_learned; +use utils::alice_run_until::is_encsig_learned; /// Bob locks btc and Alice locks xmr. Alice fails to act so Bob refunds. Alice /// is forced to refund even though she learned the secret and would be able to /// redeem had the timelock not expired. #[tokio::test] async fn given_alice_restarts_after_enc_sig_learned_and_bob_already_cancelled_refund_swap() { - testutils::setup_test(config::Regtest, |mut ctx| async move { + utils::setup_test(config::Regtest, |mut ctx| async move { let (alice_swap, alice_join_handle) = ctx.new_swap_as_alice().await; let (bob_swap, _) = ctx.new_swap_as_bob().await; diff --git a/swap/src/tests/testutils.rs b/swap/src/tests/utils.rs similarity index 99% rename from swap/src/tests/testutils.rs rename to swap/src/tests/utils.rs index 7812eb46..9331bed0 100644 --- a/swap/src/tests/testutils.rs +++ b/swap/src/tests/utils.rs @@ -6,7 +6,7 @@ use crate::{ monero, protocol::{alice, alice::AliceState, bob, bob::BobState, SwapAmounts}, seed::Seed, - tests::testutils, + tests::utils, }; use bitcoin_harness::Bitcoind; use futures::Future; @@ -316,7 +316,7 @@ where let config = C::get_config(); - let (monero, containers) = testutils::init_containers(&cli).await; + let (monero, containers) = utils::init_containers(&cli).await; let swap_amounts = SwapAmounts { btc: bitcoin::Amount::from_sat(1_000_000),