From ba099c384b61cf220d539b33654160be9c0f9a41 Mon Sep 17 00:00:00 2001 From: David Dworken Date: Fri, 8 Sep 2023 19:40:10 -0700 Subject: [PATCH] Add statsd incr for overall test failure --- client/client_test.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/client/client_test.go b/client/client_test.go index 90fd17a..a0253f9 100644 --- a/client/client_test.go +++ b/client/client_test.go @@ -206,7 +206,7 @@ func runTestsWithRetries(parentT *testing.T, testName string, testFunc func(t te func runTestsWithExtraRetries(parentT *testing.T, testName string, testFunc func(t testing.TB), numRetries int) { for i := 1; i <= numRetries; i++ { - rt := &retryingTester{nil, i == numRetries, true} + rt := &retryingTester{nil, i == numRetries, true, testName} parentT.Run(fmt.Sprintf("%s/%d", testName, i), func(t *testing.T) { rt.T = t testFunc(rt) @@ -229,12 +229,16 @@ type retryingTester struct { *testing.T isFinalRun bool succeeded bool + testName string } func (t *retryingTester) Fatalf(format string, args ...any) { t.T.Helper() t.succeeded = false if t.isFinalRun { + if GLOBAL_STATSD != nil { + GLOBAL_STATSD.Incr("test_failure", []string{"test:" + t.testName, "os:" + runtime.GOOS}, 1.0) + } t.T.Fatalf(format, args...) } else { testutils.TestLog(t.T, fmt.Sprintf("retryingTester: Ignoring fatalf for non-final run: %#v", fmt.Sprintf(format, args...)))