diff --git a/profiler/proftest/proftest.go b/profiler/proftest/proftest.go index ebe2e31eec6..86c21aaa7a6 100644 --- a/profiler/proftest/proftest.go +++ b/profiler/proftest/proftest.go @@ -45,7 +45,7 @@ const ( var ( logtimeRE = regexp.MustCompile(`[A-Z][a-z]{2} [A-Z][a-z]{2} ?\d+ \d\d:\d\d:\d\d [A-Z]{3} \d{4}`) - backoffTimeRE = regexp.MustCompile(`(\d+(h|m|s|ms|us))+`) + backoffTimeRE = regexp.MustCompile(`(\d+(\.\d+)?(h|m|s|ms|us))+`) ) // BaseStartupTmpl is the common part of the startup script that diff --git a/profiler/proftest/proftest_test.go b/profiler/proftest/proftest_test.go index e99ff948f6a..f22beda103e 100644 --- a/profiler/proftest/proftest_test.go +++ b/profiler/proftest/proftest_test.go @@ -124,6 +124,11 @@ func TestParseBackoffDuration(t *testing.T) { line: "Fri May 15 22:05:01 UTC 2020: benchmark 0: failed to create profile, will retry: rpc error: code = Aborted desc = generic::aborted: action throttled, backoff for 32m0s", wantBackoffDur: 32 * time.Minute, }, + { + desc: "a floating-point backoff duration is parsed correctly", + line: "Fri May 15 22:05:01 UTC 2020: benchmark 0: failed to create profile, will retry: rpc error: code = Aborted desc = generic::aborted: action throttled, backoff for 2000.000s", + wantBackoffDur: 2000 * time.Second, + }, { desc: "an error is returned when the backoff duration is invalid", line: "Fri May 15 22:05:01 UTC 2020: benchmark 0: failed to create profile, will retry: rpc error: code = Aborted desc = generic::aborted: action throttled, backoff for 32..0.s", @@ -139,7 +144,7 @@ func TestParseBackoffDuration(t *testing.T) { return } if backoffDur != tc.wantBackoffDur { - t.Errorf("got log time = %v, want %v", backoffDur, tc.wantBackoffDur) + t.Errorf("backoff duration: got %v, want %v", backoffDur, tc.wantBackoffDur) } }) }