mirror of
https://github.com/ddworken/hishtory.git
synced 2025-02-17 02:50:49 +01:00
Increment the test_retry_count metric for failures too to ensure that it captures tests that fail all retries
This commit is contained in:
parent
f64362fbba
commit
f589a0b1ba
@ -207,7 +207,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) {
|
func runTestsWithExtraRetries(parentT *testing.T, testName string, testFunc func(t testing.TB), numRetries int) {
|
||||||
for i := 1; i <= numRetries; i++ {
|
for i := 1; i <= numRetries; i++ {
|
||||||
rt := &retryingTester{nil, i == numRetries, true, testName}
|
rt := &retryingTester{nil, i == numRetries, true, testName, numRetries}
|
||||||
parentT.Run(fmt.Sprintf("%s/%d", testName, i), func(t *testing.T) {
|
parentT.Run(fmt.Sprintf("%s/%d", testName, i), func(t *testing.T) {
|
||||||
rt.T = t
|
rt.T = t
|
||||||
testFunc(rt)
|
testFunc(rt)
|
||||||
@ -231,6 +231,7 @@ type retryingTester struct {
|
|||||||
isFinalRun bool
|
isFinalRun bool
|
||||||
succeeded bool
|
succeeded bool
|
||||||
testName string
|
testName string
|
||||||
|
numRetries int
|
||||||
}
|
}
|
||||||
|
|
||||||
func (t *retryingTester) Fatalf(format string, args ...any) {
|
func (t *retryingTester) Fatalf(format string, args ...any) {
|
||||||
@ -239,6 +240,7 @@ func (t *retryingTester) Fatalf(format string, args ...any) {
|
|||||||
if t.isFinalRun {
|
if t.isFinalRun {
|
||||||
if GLOBAL_STATSD != nil {
|
if GLOBAL_STATSD != nil {
|
||||||
GLOBAL_STATSD.Incr("test_failure", []string{"test:" + t.testName, "os:" + runtime.GOOS}, 1.0)
|
GLOBAL_STATSD.Incr("test_failure", []string{"test:" + t.testName, "os:" + runtime.GOOS}, 1.0)
|
||||||
|
GLOBAL_STATSD.Distribution("test_retry_count", float64(t.numRetries), []string{"test:" + t.testName, "os:" + runtime.GOOS}, 1.0)
|
||||||
}
|
}
|
||||||
t.T.Fatalf(format, args...)
|
t.T.Fatalf(format, args...)
|
||||||
} else {
|
} else {
|
||||||
|
Loading…
Reference in New Issue
Block a user