Skip to content

Commit

Permalink
add polling instead of hard sleep
Browse files Browse the repository at this point in the history
  • Loading branch information
dkijania committed Oct 28, 2020
1 parent 33e3ea3 commit fac26e2
Showing 1 changed file with 23 additions and 4 deletions.
27 changes: 23 additions & 4 deletions testing/jormungandr-integration-tests/src/jormungandr/recovery.rs
Expand Up @@ -97,15 +97,23 @@ pub fn test_node_recovers_from_node_restart() {
let snapshot_before = take_snapshot(&account_receiver, &jormungandr, new_utxo.clone());
jormungandr.stop();

std::thread::sleep(std::time::Duration::from_secs(10));
std::thread::sleep(std::time::Duration::from_secs(2));

let jormungandr = Starter::new()
.config(config)
.role(Role::Leader)
.start()
.unwrap();

std::thread::sleep(std::time::Duration::from_secs(10));
jormungandr
.rest()
.raw()
.send_until_ok(
|raw| raw.account_state(&account_receiver),
Default::default(),
)
.expect("timeout occured when pooling address endpoint");

let snapshot_after = take_snapshot(&account_receiver, &jormungandr, new_utxo);

assert_eq!(
Expand Down Expand Up @@ -143,13 +151,24 @@ pub fn test_node_recovers_kill_signal() {
);
let snapshot_before = take_snapshot(&account_receiver, &jormungandr, new_utxo.clone());
jormungandr.stop();
std::thread::sleep(std::time::Duration::from_secs(10));

std::thread::sleep(std::time::Duration::from_secs(2));

let jormungandr = Starter::new()
.config(config)
.role(Role::Leader)
.start()
.unwrap();
std::thread::sleep(std::time::Duration::from_secs(10));

jormungandr
.rest()
.raw()
.send_until_ok(
|raw| raw.account_state(&account_receiver),
Default::default(),
)
.expect("timeout occured when pooling address endpoint");

let snapshot_after = take_snapshot(&account_receiver, &jormungandr, new_utxo);

assert_eq!(
Expand Down

0 comments on commit fac26e2

Please sign in to comment.