Skip to content

Commit de472c6

Browse files
committed
SE: Regression test for issue #1085
I verified that with the bugfix for #1085 reverted, this test fails with "all futures in select! were completed,but no `complete =>` handler was provided". We did not see this in practice before, but this is exactly what I predicted in the issue.
1 parent 0bf6a3f commit de472c6

File tree

1 file changed

+35
-0
lines changed

1 file changed

+35
-0
lines changed

scylla/src/policies/speculative_execution.rs

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -322,4 +322,39 @@ mod tests {
322322
now.checked_add(Duration::from_secs(24)).unwrap()
323323
)
324324
}
325+
326+
// Regresion test for https://github.com/scylladb/scylla-rust-driver/issues/1085
327+
#[tokio::test(flavor = "current_thread", start_paused = true)]
328+
async fn test_se_panic_on_ignorable_errors() {
329+
let policy = SimpleSpeculativeExecutionPolicy {
330+
max_retry_count: 5,
331+
// Each attempt will finish before next starts
332+
retry_interval: Duration::from_secs(1),
333+
};
334+
335+
let generator = {
336+
move |_first: bool| async move {
337+
tokio::time::sleep(Duration::from_secs(5)).await;
338+
IGNORABLE_ERROR.clone()
339+
}
340+
};
341+
342+
let now = tokio::time::Instant::now();
343+
let res = super::execute(&policy, &EMPTY_CONTEXT, generator).await;
344+
assert_matches!(
345+
res,
346+
Err(RequestError::LastAttemptError(
347+
RequestAttemptError::UnableToAllocStreamId
348+
))
349+
);
350+
// t - now
351+
// First execution is started at t
352+
// Speculative executions - at t+1, t+2, t+3, t+4, t+5
353+
// Each execution sleeps 5 seconds and returns ignorable error.
354+
// Last execution should finish at t+10.
355+
assert_eq!(
356+
tokio::time::Instant::now(),
357+
now.checked_add(Duration::from_secs(10)).unwrap()
358+
)
359+
}
325360
}

0 commit comments

Comments
 (0)