Only retry whitelisted test failure flakes instead of retrying on any failure.

We should explicitly be retrying on certain conditions and not blindly doing so.
This commit is contained in:
Phillip Wittrock 2016-01-04 14:42:44 -08:00
parent 38cf3a0972
commit e2b96bb877

View File

@ -23,6 +23,7 @@ import (
"os"
"os/exec"
"path"
"regexp"
"strconv"
"strings"
"sync"
@ -117,6 +118,9 @@ func PushAndRunTests(host, testDir string) error {
// Run the tests in a retry loop.
glog.Infof("Running integration tests targeting %q...", host)
// Only retry on test failures caused by these known flaky failure conditions
retryRegex := regexp.MustCompile("Network tx and rx bytes should not be equal")
for i := 0; i <= *testRetryCount; i++ {
// Check if this is a retry
if i > 0 {
@ -129,6 +133,10 @@ func PushAndRunTests(host, testDir string) error {
// On success, break out of retry loop
break
}
if !retryRegex.Match([]byte(err.Error())) {
// If error not in whitelist, break out of loop
break
}
}
if err != nil {
err = fmt.Errorf("error on host %s: %v", host, err)