Skip to content

Commit

Permalink
test: parallelise churn data final query
Browse files Browse the repository at this point in the history
  • Loading branch information
joshuef committed Aug 25, 2023
1 parent 60d3e1f commit 019ff3f
Showing 1 changed file with 15 additions and 7 deletions.
22 changes: 15 additions & 7 deletions sn_node/tests/data_with_churn.rs
Original file line number Diff line number Diff line change
Expand Up @@ -240,15 +240,23 @@ async fn data_availability_during_churn() -> Result<()> {
// prevent any late content uploads being added to the list
let content = content.read().await;
let uploaded_content_count = content.len();
let mut handles = Vec::new();
for net_addr in content.iter() {
let result = final_retry_query_content(&client, net_addr, dbcs.clone(), churn_period).await;
assert!(
result.is_ok(),
"Failed to query content at {net_addr:?} with error {result:?}"
);

content_queried_count += 1;
let client = client.clone();
let net_addr = net_addr.clone();
let dbcs = dbcs.clone();
let churn_period = churn_period.clone();
let handle = tokio::spawn(async move {
final_retry_query_content(&client, &net_addr, dbcs, churn_period).await
});
handles.push(handle);
}
let results: Vec<_> = futures::future::join_all(handles).await;
let content_queried_count = results.iter().filter(|r| r.is_ok()).count();
assert_eq!(
content_queried_count, uploaded_content_count,
"Not all content was queried successfully"
);

println!("{:?} pieces of content queried", content_queried_count);

Expand Down

0 comments on commit 019ff3f

Please sign in to comment.