Skip to content

Commit

Permalink
Use wait_for_bcast in tests that report timeouts in most cases
Browse files Browse the repository at this point in the history
  • Loading branch information
nieznanysprawiciel authored and tworec committed Dec 21, 2020
1 parent 24c3bf0 commit b7111f0
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions core/market/tests/test_offer_broadcast.rs
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,8 @@ async fn test_broadcast_offer_callbacks() {
.bcast_offers(vec![offer_id.clone()])
.await
.unwrap();
tokio::time::delay_for(Duration::from_millis(50)).await;

wait_for_bcast(1000, &market1, &offer_id, true).await;

let offer = market1.get_offer(&offer_id).await.unwrap();
assert_eq!(offer_clone, offer);
Expand Down Expand Up @@ -135,8 +136,8 @@ async fn test_broadcast_offer_id_validation() {
.bcast_offers(vec![invalid_id.clone()])
.await
.unwrap();
tokio::time::delay_for(Duration::from_millis(50)).await;

wait_for_bcast(100, &market1, &invalid_id, false).await;
assert_err_eq!(
QueryOfferError::NotFound(invalid_id.clone()),
market1.get_offer(&invalid_id).await,
Expand Down Expand Up @@ -176,7 +177,8 @@ async fn test_broadcast_expired_offer() {
.bcast_offers(vec![offer_id.clone()])
.await
.unwrap();
tokio::time::delay_for(Duration::from_millis(50)).await;

wait_for_bcast(100, &market1, &offer_id, false).await;

// This should return NotFound, because Market shouldn't add this Offer
// to database at all.
Expand Down

0 comments on commit b7111f0

Please sign in to comment.