Skip to content

Commit

Permalink
test: improvements to pass on ci
Browse files Browse the repository at this point in the history
  • Loading branch information
roberts-pumpurs committed Jan 13, 2025
1 parent a22b33d commit d433797
Showing 1 changed file with 16 additions and 3 deletions.
19 changes: 16 additions & 3 deletions crates/solana-listener/src/component.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down Expand Up @@ -183,7 +187,11 @@ mod tests {
.collect::<BTreeSet<_>>()
.await;
let init_items_btree = init_items.clone().into_iter().collect::<BTreeSet<_>>();
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
Expand All @@ -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;
Expand All @@ -219,7 +228,11 @@ mod tests {
.collect::<BTreeSet<_>>()
.await;
let new_items_btree = new_items.clone().into_iter().collect::<BTreeSet<_>>();
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)
Expand Down

0 comments on commit d433797

Please sign in to comment.