Skip to content

Commit 6cdc504

Browse files
committed
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>
1 parent e0b7a44 commit 6cdc504

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

prometheus/process_collector_darwin_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,12 +55,12 @@ func TestDarwinProcessCollector(t *testing.T) {
5555
regexp.MustCompile("\nprocess_max_fds [1-9]"),
5656
regexp.MustCompile("\nprocess_open_fds [1-9]"),
5757
regexp.MustCompile("\nprocess_virtual_memory_max_bytes (-1|[1-9])"),
58-
regexp.MustCompile("\nprocess_start_time_seconds [0-9.]{10,}"),
58+
regexp.MustCompile("\nprocess_start_time_seconds [0-9]"),
5959
regexp.MustCompile("\nfoobar_process_cpu_seconds_total [0-9]"),
6060
regexp.MustCompile("\nfoobar_process_max_fds [1-9]"),
6161
regexp.MustCompile("\nfoobar_process_open_fds [1-9]"),
6262
regexp.MustCompile("\nfoobar_process_virtual_memory_max_bytes (-1|[1-9])"),
63-
regexp.MustCompile("\nfoobar_process_start_time_seconds [0-9.]{10,}"),
63+
regexp.MustCompile("\nfoobar_process_start_time_seconds [0-9]"),
6464
} {
6565
if !re.Match(buf.Bytes()) {
6666
t.Errorf("want body to match %s\n%s", re, buf.String())

0 commit comments

Comments
 (0)