Skip to content

[http] Fix test stability - #21392

Merged
wborn merged 1 commit into
openhab:mainfrom
lsiepel:http-test-17385
Aug 15, 2026
Merged

[http] Fix test stability#21392
wborn merged 1 commit into
openhab:mainfrom
lsiepel:http-test-17385

Conversation

@lsiepel

@lsiepel lsiepel commented Aug 14, 2026

Copy link
Copy Markdown
Contributor

Fix flaky RateLimitedHttpClientTest timing assertions by recording the request timestamp before sending the HTTP request. This prevents response latency from reducing the measured rate-limit interval below the configured delay.

Fixes #17385

Signed-off-by: Leo Siepel <leosiepel@gmail.com>
Copilot AI lite review requested due to automatic review settings August 14, 2026 20:59
@lsiepel
lsiepel requested a review from J-N-K as a code owner August 14, 2026 20:59
@lsiepel lsiepel added the test label Aug 14, 2026
@lsiepel
lsiepel requested a review from a team August 14, 2026 20:59

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

This PR improves the stability of the HTTP binding’s RateLimitedHttpClientTest by measuring rate-limit intervals using the timestamp captured immediately before each HTTP request is sent, instead of using a timestamp taken after the response returns (which can be skewed by response latency).

Changes:

  • Capture a requestTime just before calling request.send() in the async callback.
  • Pass that timestamp into the Response object instead of initializing time at construction time.
  • Update the Response constructor/signature to accept the timestamp explicitly.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

@wborn wborn left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Thanks for the fix!

@wborn
wborn merged commit d1c76dc into openhab:main Aug 15, 2026
3 checks passed
@wborn wborn added this to the 5.3 milestone Aug 15, 2026
@lsiepel
lsiepel deleted the http-test-17385 branch August 15, 2026 13:38
cipianpascu pushed a commit to cipianpascu/openhab-addons that referenced this pull request Aug 16, 2026
Signed-off-by: Leo Siepel <leosiepel@gmail.com>
Signed-off-by: Ciprian Pascu <contact@ciprianpascu.ro>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[http] RateLimitedHttpClientTest unstable

3 participants