commit 344a0399178b0efe0bd5f47aa7e2dd5095d455fc
parent 8fa0a1d6d78cd49f88509404c15b1c2032d62401
Author: Florian Dold <dold@taler.net>
Date: Mon, 7 Sep 2026 17:45:41 +0200
taler-test-utils: allow CI delays in history polling tests
Give history requests five seconds to complete while keeping their
long-poll timeout at ten seconds, so missed notifications still fail.
Enforce the assertion deadline and retain minimum polling durations.
Keep stderr visible in the CI test job for failure diagnostics.
Diffstat:
2 files changed, 20 insertions(+), 13 deletions(-)
diff --git a/common/taler-test-utils/src/routine.rs b/common/taler-test-utils/src/routine.rs
@@ -147,7 +147,13 @@ pub async fn routine_pagination<T: Page>(
pub async fn assert_time<R: Debug>(range: std::ops::Range<u128>, task: impl Future<Output = R>) {
let start = Instant::now();
- task.await;
+ let limit = Duration::from_millis(range.end.try_into().expect("timing bound exceeds u64"));
+ if tokio::time::timeout(limit, task).await.is_err() {
+ panic!(
+ "Expected to last {range:?} ms, timed out after {} ms",
+ start.elapsed().as_millis()
+ );
+ }
let elapsed = start.elapsed().as_millis();
if !range.contains(&elapsed) {
panic!("Expected to last {range:?} got {elapsed:?}")
@@ -195,20 +201,22 @@ pub async fn routine_history<T: Page>(
// Check skip ignored
assert_history!(format_args!("limit={nb_register}"), nb_register).await;
+ // Allow CI scheduling and database delays, but require completion before
+ // the long-poll timeout so broken notification delivery still fails.
// Check no polling when we cannot have more transactions
assert_time(
- 0..200,
+ 0..5000,
assert_history!(
- format_args!("limit=-{}&timeout_ms=1000", nb_register + 1),
+ format_args!("limit=-{}&timeout_ms=10000", nb_register + 1),
nb_register
),
)
.await;
// Check no polling when already find transactions even if less than delta
assert_time(
- 0..200,
+ 0..5000,
assert_history!(
- format_args!("limit={}&timeout_ms=1000", nb_register + 1),
+ format_args!("limit={}&timeout_ms=10000", nb_register + 1),
nb_register
),
)
@@ -219,11 +227,11 @@ pub async fn routine_history<T: Page>(
tokio::join!(
// Check polling succeed
assert_time(
- 100..400,
- assert_history!(format_args!("limit=2&offset={id}&timeout_ms=1000"), 1)
+ 100..5000,
+ assert_history!(format_args!("limit=2&offset={id}&timeout_ms=10000"), 1)
),
assert_time(
- 200..500,
+ 200..5000,
assert_history!(
format_args!(
"limit=1&offset={}&timeout_ms=200",
@@ -244,8 +252,8 @@ pub async fn routine_history<T: Page>(
tokio::join!(
// Check polling succeed
assert_time(
- 100..400,
- assert_history!(format_args!("limit=7&offset={id}&timeout_ms=1000"), 1)
+ 100..5000,
+ assert_history!(format_args!("limit=7&offset={id}&timeout_ms=10000"), 1)
),
async {
sleep(Duration::from_millis(100)).await;
@@ -259,7 +267,7 @@ pub async fn routine_history<T: Page>(
tokio::join!(
// Check polling succeed
assert_time(
- 200..500,
+ 200..5000,
assert_history!(format_args!("limit=7&offset={id}&timeout_ms=200"), 0)
),
async {
diff --git a/contrib/ci/jobs/2-test/job.sh b/contrib/ci/jobs/2-test/job.sh
@@ -13,4 +13,4 @@ sudo -u postgres pg_ctlcluster 17 main start
sudo -u postgres createuser root --superuser
sudo -u postgres createdb -O root taler_rust_check
-make check 2> /dev/null
-\ No newline at end of file
+make check