diff --git a/test/e2e/deployment.go b/test/e2e/deployment.go index a4d95900910..16227b8cc0a 100644 --- a/test/e2e/deployment.go +++ b/test/e2e/deployment.go @@ -27,6 +27,7 @@ import ( "path/filepath" "runtime" "strconv" + "strings" "time" "github.com/onsi/gomega/gexec" @@ -696,6 +697,7 @@ func localAddress() string { } func (d *Deployment) StopLocalContour(contourCmd *gexec.Session, configFile string) error { + defer os.RemoveAll(configFile) // Look for the ENV variable to tell if this test run should use // the ContourConfiguration file or the ContourConfiguration CRD. @@ -714,8 +716,11 @@ func (d *Deployment) StopLocalContour(contourCmd *gexec.Session, configFile stri // Default timeout of 1s produces test flakes, // a minute should be more than enough to avoid them. - contourCmd.Terminate().Wait(time.Minute) - return os.RemoveAll(configFile) + logs := contourCmd.Terminate().Wait(time.Minute).Err.Contents() + if strings.Contains(string(logs), "DATA RACE") { + return errors.New("Detected data race, see log output above to diagnose") + } + return nil } // Convenience method for deploying the pieces of the deployment needed for diff --git a/test/e2e/framework.go b/test/e2e/framework.go index f001bb5700f..3af1dd02c8d 100644 --- a/test/e2e/framework.go +++ b/test/e2e/framework.go @@ -199,7 +199,7 @@ func NewFramework(inClusterTestSuite bool) *Framework { } var err error - contourBin, err = gexec.Build("github.com/projectcontour/contour/cmd/contour") + contourBin, err = gexec.Build("github.com/projectcontour/contour/cmd/contour", "-race") require.NoError(t, err) }