From d433797731fa097a0c30795408b779c292a9dba4 Mon Sep 17 00:00:00 2001 From: Roberts Pumpurs Date: Mon, 13 Jan 2025 19:53:53 +0200 Subject: [PATCH] test: improvements to pass on ci --- crates/solana-listener/src/component.rs | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/crates/solana-listener/src/component.rs b/crates/solana-listener/src/component.rs index cbc608b..e45bb97 100644 --- a/crates/solana-listener/src/component.rs +++ b/crates/solana-listener/src/component.rs @@ -148,7 +148,11 @@ mod tests { solana_ws: pubsub_url.parse().unwrap(), missed_signature_catchup_strategy: MissedSignatureCatchupStrategy::UntilBeginning, latest_processed_signature: None, - tx_scan_poll_period: Duration::from_millis(500), + tx_scan_poll_period: if std::env::var("CI").is_ok() { + Duration::from_millis(1500) + } else { + Duration::from_millis(500) + }, commitment: CommitmentConfig::confirmed(), }; let (tx, mut rx) = futures::channel::mpsc::unbounded(); @@ -183,7 +187,11 @@ mod tests { .collect::>() .await; let init_items_btree = init_items.clone().into_iter().collect::>(); - assert!(!processor.is_finished()); + let is_finished = processor.is_finished(); + if is_finished { + assert!(processor.await.unwrap().is_ok()); + panic!(); + } dbg!(&init_items_btree); assert_eq!( fetched @@ -196,6 +204,7 @@ mod tests { }; for _ in 0..2_u8 { + tokio::time::sleep(Duration::from_secs(2)).await; // 4. generate more test data let generated_signs_set_2 = generate_test_solana_data(&mut fixture, counter_pda, &gas_config).await; @@ -219,7 +228,11 @@ mod tests { .collect::>() .await; let new_items_btree = new_items.clone().into_iter().collect::>(); - assert!(!processor.is_finished()); + let is_finished = processor.is_finished(); + if is_finished { + assert!(processor.await.unwrap().is_ok()); + panic!(); + } assert_eq!( fetched .intersection(&new_items_btree)