Commit 4cd2d3a
authored
test: fix two flaky tests (darwin start_time regex, memstats HeapReleased drift) (#2050)
* test(process_collector): match scientific-notation start time on darwin
TestDarwinProcessCollector asserted process_start_time_seconds against [0-9.]{10,}, but expfmt renders large gauge values in scientific notation (for example 1.783414e+09), whose leading digit run is shorter than ten characters. The check then fails intermittently on macOS depending on the process start time. Match a leading digit like the sibling metric checks, which asserts the metric is present with a numeric value.
Signed-off-by: Kemal Akkoyun <kemal.akkoyun@datadoghq.com>
* test(collector): stabilize TestMemStatsEquivalence against HeapReleased drift
The test read runtime.ReadMemStats and runtime/metrics separately and compared them within 5%, with the code itself noting it hoped no GC ran in between. HeapReleased is driven by the background scavenger and drifted between the two reads, failing intermittently (seen on Linux arm64). Force a full scavenge with debug.FreeOSMemory and disable GC for the measurement window so both reads observe the same runtime state.
Signed-off-by: Kemal Akkoyun <kemal.akkoyun@datadoghq.com>
---------
Signed-off-by: Kemal Akkoyun <kemal.akkoyun@datadoghq.com>1 parent b0d896b commit 4cd2d3a
2 files changed
Lines changed: 11 additions & 6 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
21 | 21 | | |
22 | 22 | | |
23 | 23 | | |
| 24 | + | |
24 | 25 | | |
25 | 26 | | |
26 | 27 | | |
| |||
270 | 271 | | |
271 | 272 | | |
272 | 273 | | |
273 | | - | |
274 | | - | |
| 274 | + | |
| 275 | + | |
| 276 | + | |
| 277 | + | |
| 278 | + | |
| 279 | + | |
| 280 | + | |
275 | 281 | | |
276 | | - | |
| 282 | + | |
277 | 283 | | |
278 | | - | |
279 | 284 | | |
280 | 285 | | |
281 | 286 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
55 | 55 | | |
56 | 56 | | |
57 | 57 | | |
58 | | - | |
| 58 | + | |
59 | 59 | | |
60 | 60 | | |
61 | 61 | | |
62 | 62 | | |
63 | | - | |
| 63 | + | |
64 | 64 | | |
65 | 65 | | |
66 | 66 | | |
| |||
0 commit comments