Skip to content

fix: allow timer jitter in TestForwarderConnectionRetryAndTimeout#1696

Open
Fedosin wants to merge 1 commit into
kedacore:mainfrom
Fedosin:fix/flaky-forwarder-timeout-test
Open

fix: allow timer jitter in TestForwarderConnectionRetryAndTimeout#1696
Fedosin wants to merge 1 commit into
kedacore:mainfrom
Fedosin:fix/flaky-forwarder-timeout-test

Conversation

@Fedosin

@Fedosin Fedosin commented Jun 22, 2026

Copy link
Copy Markdown
Contributor

TestForwarderConnectionRetryAndTimeout sets a 500ms context timeout
and then asserts elapsed >= 500ms. On busy CI runners Go timers can
fire slightly before the deadline — the failing run saw 499.495ms.

Add a 5ms tolerance so sub-millisecond timer drift does not cause
spurious failures.

Example of a failed test.

Checklist

Fixes #

The test asserts that a 500ms context timeout does not return early,
but Go timers can fire slightly before the deadline on busy CI runners.
Add a 5ms tolerance to prevent sub-millisecond drift from causing
flaky failures.

Signed-off-by: Mikhail Fedosin <mfedosin@redhat.com>
Copilot AI review requested due to automatic review settings June 22, 2026 08:50
@Fedosin Fedosin requested a review from a team as a code owner June 22, 2026 08:50
@snyk-io

snyk-io Bot commented Jun 22, 2026

Copy link
Copy Markdown

Snyk checks have passed. No issues have been found so far.

Status Scan Engine Critical High Medium Low Total (0)
Open Source Security 0 0 0 0 0 issues

💻 Catch issues earlier using the plugins for VS Code, JetBrains IDEs, Visual Studio, and Eclipse.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Improves CI reliability by making TestForwarderConnectionRetryAndTimeout tolerant to small Go timer jitter, avoiding spurious failures when context deadlines fire a fraction of a millisecond early on busy runners.

Changes:

  • Introduces a small timerJitter duration constant in the test.
  • Adjusts the minimum elapsed-time assertion from >= requestTimeout to >= requestTimeout - timerJitter.
  • Updates the assertion message to reflect approximate timing expectations.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

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