Commit 04acc04
committed
fix: stabilize flaky timer and thread count tests
GaugeTest.testTimer: Thread.sleep(12) can take 100ms+ on CI due to
scheduling delays. Assert only that the timer measured > 10ms, not
that it's close to exactly 12ms.
JvmThreadsMetricsTest.testInvalidThreadIds: background threads can
start between scrapes, changing counts for arbitrary states. Assert
only that the UNKNOWN count increased by the expected amount.
Fixes #1971, fixes #1972
Signed-off-by: Gregor Zeitlinger <gregor.zeitlinger@grafana.com>1 parent 9712762 commit 04acc04
2 files changed
Lines changed: 8 additions & 12 deletions
File tree
- prometheus-metrics-core/src/test/java/io/prometheus/metrics/core/metrics
- prometheus-metrics-instrumentation-jvm/src/test/java/io/prometheus/metrics/instrumentation/jvm
Lines changed: 1 addition & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
87 | 87 | | |
88 | 88 | | |
89 | 89 | | |
90 | | - | |
91 | | - | |
| 90 | + | |
92 | 91 | | |
93 | 92 | | |
94 | 93 | | |
| |||
Lines changed: 7 additions & 10 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
118 | 118 | | |
119 | 119 | | |
120 | 120 | | |
121 | | - | |
122 | | - | |
123 | | - | |
124 | | - | |
125 | | - | |
| 121 | + | |
| 122 | + | |
126 | 123 | | |
127 | 124 | | |
128 | 125 | | |
| |||
132 | 129 | | |
133 | 130 | | |
134 | 131 | | |
135 | | - | |
| 132 | + | |
| 133 | + | |
136 | 134 | | |
137 | | - | |
138 | | - | |
139 | | - | |
140 | | - | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
141 | 138 | | |
142 | 139 | | |
143 | 140 | | |
| |||
0 commit comments