Skip to content

test: make Gauge timer test deterministic#2266

Merged
jaydeluca merged 1 commit into
prometheus:mainfrom
arnabnandy7:fix/gauge-timer-test
Jul 1, 2026
Merged

test: make Gauge timer test deterministic#2266
jaydeluca merged 1 commit into
prometheus:mainfrom
arnabnandy7:fix/gauge-timer-test

Conversation

@arnabnandy7

Copy link
Copy Markdown
Contributor

Summary

  • Make GaugeTest.testTimer deterministic by removing the Thread.sleep(12) timing dependency.
  • Assert that the gauge stores the exact duration returned by Timer.observeDuration().

Fixes #1968

Test plan

  • .\mvnw.cmd clean test -pl prometheus-metrics-core '-Dtest=GaugeTest' '-Dcoverage.skip=true' '-Dcheckstyle.skip=true'
  • .\mvnw.cmd install -DskipTests '-Dcoverage.skip=true'

Signed-off-by: Arnab Nandy <arnab_nandy7@yahoo.com>
@arnabnandy7 arnabnandy7 force-pushed the fix/gauge-timer-test branch from 98c5c7b to d90fbfc Compare July 1, 2026 18:45

@jaydeluca jaydeluca left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

thanks!

@jaydeluca jaydeluca merged commit 0a88856 into prometheus:main Jul 1, 2026
22 checks passed
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.

Fix flaky GaugeTest.testTimer test

2 participants