Skip to content

test: avoid exact elapsed times in the retry example - #1008

Merged
samber merged 1 commit into
samber:masterfrom
HNO3Miracle:fix-portable-tests-20260921
Sep 20, 2026
Merged

samber merged 1 commit into
samber:masterfrom
HNO3Miracle:fix-portable-tests-20260921

Conversation

@HNO3Miracle

Copy link
Copy Markdown
Contributor

ExampleAttemptWithDelay truncates its elapsed durations to milliseconds and requires both to equal exactly 1ms. A scheduler delay can legitimately make either retry take longer, causing the example to fail although the retry count and result are correct.

Print whether each duration is at least the requested delay instead. Keep the retry counts and success/error results in the expected output.

Validation: go test -run ExampleAttemptWithDelay -count=100 ./... passes with Go 1.26.3 on Linux/amd64.

Signed-off-by: HNO3Miracle <xiangao.or@isrc.iscas.ac.cn>
@samber
samber merged commit f686805 into samber:master Sep 20, 2026
@HNO3Miracle
HNO3Miracle deleted the fix-portable-tests-20260921 branch September 20, 2026 21:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants