Refactor test retrying functions to make the number of retries configurable, and change the default to 3 retries (I'll be tuning this number in a follow up commit)

This commit is contained in:
David Dworken 2023-09-04 18:17:02 -07:00
parent 7b02d6f2a2
commit af0234797c
No known key found for this signature in database

View File

@ -174,9 +174,10 @@ func TestParam(t *testing.T) {
func runTestsWithRetries(parentT *testing.T, testName string, testFunc func(t testing.TB)) {
numRetries := 3
if testutils.IsGithubAction() {
numRetries = 5
}
runTestsWithExtraRetries(parentT, testName, testFunc, numRetries)
}
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}
parentT.Run(fmt.Sprintf("%s/%d", testName, i), func(t *testing.T) {