Remove Bob restart tests after communication

The test do not work without acks as we stop the event loop as soon
as a message is considered as "sent" when actually the event loop
and swarm may not have yet sent the message.

The ack allow to avoid this issue as the message was considered "sent"
only once the other party sent a response. However, the ack brings
other issue so a review needs to be done to select the appropriate
solution.
This commit is contained in:
Franck Royer 2021-02-10 10:30:23 +11:00
parent fd9f633a77
commit 3bc8b58b6a
No known key found for this signature in database
GPG Key ID: A82ED75A8DFC50A4
4 changed files with 0 additions and 69 deletions

View File

@ -127,8 +127,6 @@ jobs:
matrix:
test_name: [
happy_path,
happy_path_restart_bob_after_comm,
happy_path_restart_bob_after_lock_proof_received,
happy_path_restart_bob_before_comm,
punish,
bob_refunds_using_cancel_and_refund_command,

View File

@ -3,8 +3,6 @@ status = [
"build_test (x86_64-unknown-linux-gnu)",
"build_test (x86_64-apple-darwin)",
"docker_tests (happy_path)",
"docker_tests (happy_path_restart_bob_after_comm)",
"docker_tests (happy_path_restart_bob_after_lock_proof_received)",
"docker_tests (happy_path_restart_bob_before_comm)",
"docker_tests (punish)",
]

View File

@ -1,30 +0,0 @@
pub mod testutils;
use swap::protocol::{alice, bob, bob::BobState};
use testutils::{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 {
let (alice_swap, _) = ctx.new_swap_as_alice().await;
let (bob_swap, bob_join_handle) = ctx.new_swap_as_bob().await;
let alice = alice::run(alice_swap);
let alice_handle = tokio::spawn(alice);
let bob_state = bob::run_until(bob_swap, is_encsig_sent).await.unwrap();
assert!(matches!(bob_state, BobState::EncSigSent { .. }));
let (bob_swap, _) = ctx.stop_and_resume_bob_from_db(bob_join_handle).await;
assert!(matches!(bob_swap.state, BobState::EncSigSent { .. }));
let bob_state = bob::run(bob_swap).await.unwrap();
ctx.assert_bob_redeemed(bob_state).await;
let alice_state = alice_handle.await.unwrap();
ctx.assert_alice_redeemed(alice_state.unwrap()).await;
})
.await;
}

View File

@ -1,35 +0,0 @@
pub mod testutils;
use swap::protocol::{alice, bob, bob::BobState};
use testutils::{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 {
let (alice_swap, _) = ctx.new_swap_as_alice().await;
let (bob_swap, bob_join_handle) = ctx.new_swap_as_bob().await;
let alice_handle = alice::run(alice_swap);
let alice_swap_handle = tokio::spawn(alice_handle);
let bob_state = bob::run_until(bob_swap, is_lock_proof_received)
.await
.unwrap();
assert!(matches!(bob_state, BobState::XmrLockProofReceived { .. }));
let (bob_swap, _) = ctx.stop_and_resume_bob_from_db(bob_join_handle).await;
assert!(matches!(
bob_swap.state,
BobState::XmrLockProofReceived { .. }
));
let bob_state = bob::run(bob_swap).await.unwrap();
ctx.assert_bob_redeemed(bob_state).await;
let alice_state = alice_swap_handle.await.unwrap().unwrap();
ctx.assert_alice_redeemed(alice_state).await;
})
.await;
}