add wait to tests
@@ -16,6 +16,7 @@ use jormungandr_testing_utils::testing::{AdversaryFragmentSender, AdversaryFragm
use jortestkit::prelude::Wait;
use std::fs::metadata;
use std::path::Path;
+use std::thread::sleep;
use std::time::Duration;
#[test]
@@ -113,6 +114,8 @@ pub fn dump_send_invalid_fragments() {
.send_transactions_with_invalid_counter(10, &mut sender, &receiver, &jormungandr)
.unwrap();
+ sleep(Duration::from_secs(1));
+
assert_all_fragment_are_persisted(dump_folder.path(), persistent_log_path.path());
}
@@ -212,6 +215,8 @@ pub fn fragment_which_reached_mempool_should_be_persisted() {
.send_transactions_with_invalid_counter(10, &mut sender, &receiver, &jormungandr)
.unwrap();
+ sleep(Duration::from_secs(1));
+
assert_all_fragment_are_persisted(dump_folder.path(), persistent_log_path.path());
}
@@ -249,6 +254,8 @@ pub fn fragment_which_is_not_in_fragment_log_should_be_persisted() {
.send_transactions_with_invalid_counter(10, &mut sender, &receiver, &jormungandr)
.unwrap();
+ sleep(Duration::from_secs(1));
+
assert_all_fragment_are_persisted(dump_folder.path(), persistent_log_path.path());
}
@@ -286,6 +293,8 @@ pub fn pending_fragment_should_be_persisted() {
.send_transaction(&mut sender, &receiver, &jormungandr, 1.into())
.unwrap();
+ sleep(Duration::from_secs(1));
+
let persistent_log_viewer = PersistentLogViewer::new(persistent_log_path.path().to_path_buf());
assert_eq!(1, persistent_log_viewer.get_all().len());
@@ -344,6 +353,8 @@ pub fn node_should_pickup_log_after_restart() {
.send_transactions_with_invalid_counter(10, &mut sender, &receiver, &jormungandr)
.unwrap();
+ sleep(Duration::from_secs(1));
+
jormungandr.stop();
let jormungandr = Starter::new()
@@ -363,6 +374,8 @@ pub fn node_should_pickup_log_after_restart() {
.send_transactions_with_invalid_counter(10, &mut sender, &receiver, &jormungandr)
.unwrap();
+ sleep(Duration::from_secs(1));
+
let persistent_log_viewer = PersistentLogViewer::new(persistent_log_path.path().to_path_buf());
assert_eq!(20, persistent_log_viewer.get_all().len());
