Commit ce5867b
authored
fix: stabilize flaky timer and thread count tests (#1973)
## Summary
- **GaugeTest.testTimer**: `Thread.sleep(12)` can take 100ms+ on CI.
Assert `> 10ms` instead of `closeTo(12ms, 5ms)`
- **JvmThreadsMetricsTest.testInvalidThreadIds**: background threads
can start between scrapes. Assert only that UNKNOWN count increased
by the expected amount, ignore other states
Fixes #1971, fixes #1972
## Test plan
- [x] Both tests pass locally
- [x] `mise run build` passes
- [ ] CI passes
Signed-off-by: Gregor Zeitlinger <gregor.zeitlinger@grafana.com>1 parent d8388fb commit ce5867b
File tree
2 files changed
+8
-12
lines changed- prometheus-metrics-core/src/test/java/io/prometheus/metrics/core/metrics
- prometheus-metrics-instrumentation-jvm/src/test/java/io/prometheus/metrics/instrumentation/jvm
2 files changed
+8
-12
lines changedLines 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