Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(test): Remove intermittent asserts in test #7600

Merged
merged 1 commit into from
Sep 21, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 7 additions & 14 deletions zebrad/tests/common/lightwalletd/send_transaction_test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,7 @@ pub async fn run() -> Result<()> {
zebrad.expect_stdout_line_matches("answered mempool request .*req.*=.*TransactionIds")?;

// 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? {
let hash: [u8; 32] = tx.hash.clone().try_into().expect("hash is correct length");
let hash = transaction::Hash::from_bytes_in_display_order(&hash);
Expand All @@ -202,39 +202,32 @@ pub async fn run() -> Result<()> {
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
//assert!(
// counter >= 1,
// "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.
tracing::info!("calling GetMempoolStream gRPC to fetch transactions...");
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? {
// 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!(
// counter >= 1,
// "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(())
}
Expand Down