Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test/e2e: Add race detection in e2e tests #5805

Merged
merged 1 commit into from
Oct 18, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 7 additions & 2 deletions test/e2e/deployment.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ import (
"path/filepath"
"runtime"
"strconv"
"strings"
"time"

"github.com/onsi/gomega/gexec"
Expand Down Expand Up @@ -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.
Expand All @@ -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
Expand Down
2 changes: 1 addition & 1 deletion test/e2e/framework.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}

Expand Down