From 7f43796efccd05691c90e21f1f3b212913588553 Mon Sep 17 00:00:00 2001 From: Nikolay Volf Date: Tue, 18 Feb 2020 17:19:59 +0300 Subject: [PATCH] Fix flaky finalisation test (#4967) --- substrate/client/transaction-pool/src/testing/pool.rs | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/substrate/client/transaction-pool/src/testing/pool.rs b/substrate/client/transaction-pool/src/testing/pool.rs index c194a8615b..37b80df9e1 100644 --- a/substrate/client/transaction-pool/src/testing/pool.rs +++ b/substrate/client/transaction-pool/src/testing/pool.rs @@ -515,8 +515,15 @@ fn fork_aware_finalization() { assert_eq!(stream.next(), Some(TransactionStatus::Ready)); assert_eq!(stream.next(), Some(TransactionStatus::InBlock(c2.clone()))); assert_eq!(stream.next(), Some(TransactionStatus::Retracted(c2))); - assert_eq!(stream.next(), Some(TransactionStatus::Ready)); - assert_eq!(stream.next(), Some(TransactionStatus::InBlock(e1))); + + // can be either Ready, or InBlock, depending on which event comes first + assert_eq!( + match stream.next() { + Some(TransactionStatus::Ready) => stream.next(), + val @ _ => val, + }, + Some(TransactionStatus::InBlock(e1)), + ); assert_eq!(stream.next(), Some(TransactionStatus::Finalized(e1.clone()))); assert_eq!(stream.next(), None); }