remove intermittent asserts in test (#7600)

This commit is contained in:
Alfredo Garcia 2023-09-21 00:20:55 -03:00 committed by GitHub
parent d651ee3c16
commit 09c1f994f0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 7 additions and 14 deletions

View File

@ -191,7 +191,7 @@ pub async fn run() -> Result<()> {
zebrad.expect_stdout_line_matches("answered mempool request .*req.*=.*TransactionIds")?; zebrad.expect_stdout_line_matches("answered mempool request .*req.*=.*TransactionIds")?;
// GetMempoolTx: make sure at least one of the transactions were inserted into the mempool. // GetMempoolTx: make sure at least one of the transactions were inserted into the mempool.
let mut counter = 0; let mut _counter = 0;
while let Some(tx) = transactions_stream.message().await? { while let Some(tx) = transactions_stream.message().await? {
let hash: [u8; 32] = tx.hash.clone().try_into().expect("hash is correct length"); let hash: [u8; 32] = tx.hash.clone().try_into().expect("hash is correct length");
let hash = transaction::Hash::from_bytes_in_display_order(&hash); let hash = transaction::Hash::from_bytes_in_display_order(&hash);
@ -202,39 +202,32 @@ pub async fn run() -> Result<()> {
in isolated mempool: {tx:?}", in isolated mempool: {tx:?}",
); );
counter += 1; _counter += 1;
} }
// TODO: This test is working locally in some environments, failing in others, failing always in the CI. // TODO: This check sometimes works and sometimes it doesn't so we can't just enable it.
// https://github.com/ZcashFoundation/zebra/issues/7529 // https://github.com/ZcashFoundation/zebra/issues/7529
//assert!( //assert!(
// counter >= 1, // counter >= 1,
// "all transactions from future blocks failed to send to an isolated mempool" // "all transactions from future blocks failed to send to an isolated mempool"
//); //);
assert_eq!(
counter, 0,
"developers: should fail if `get_mempool_tx` start working."
);
// GetMempoolTx: make sure at least one of the transactions were inserted into the mempool. // GetMempoolTx: make sure at least one of the transactions were inserted into the mempool.
tracing::info!("calling GetMempoolStream gRPC to fetch transactions..."); tracing::info!("calling GetMempoolStream gRPC to fetch transactions...");
let mut transaction_stream = rpc_client.get_mempool_stream(Empty {}).await?.into_inner(); let mut transaction_stream = rpc_client.get_mempool_stream(Empty {}).await?.into_inner();
let mut counter = 0; let mut _counter = 0;
while let Some(_tx) = transaction_stream.message().await? { while let Some(_tx) = transaction_stream.message().await? {
// TODO: check tx.data or tx.height here? // TODO: check tx.data or tx.height here?
counter += 1; _counter += 1;
} }
// TODO: This is not working, found out why. // TODO: This check sometimes works and sometimes it doesn't so we can't just enable it.
// https://github.com/ZcashFoundation/zebra/issues/7529
//assert!( //assert!(
// counter >= 1, // counter >= 1,
// "all transactions from future blocks failed to send to an isolated mempool" // "all transactions from future blocks failed to send to an isolated mempool"
//); //);
assert_eq!(
counter, 0,
"developers: should fail if `get_mempool_stream` start working."
);
Ok(()) Ok(())
} }