Skip to content

Commit

Permalink
e2e: deferred: make restart tests opt-in
Browse files Browse the repository at this point in the history
unitl we deflake the restart tests, make them opt-in.

Signed-off-by: Francesco Romani <[email protected]>
  • Loading branch information
ffromani committed Jul 23, 2024
1 parent 905a6eb commit d480083
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions test/e2e/deferred/restart.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,9 @@ package e2e
import (
"context"
"fmt"
"os"
"path/filepath"
"strconv"
"strings"
"time"

Expand All @@ -20,6 +22,23 @@ import (
"github.com/openshift/cluster-node-tuning-operator/test/e2e/util/wait"
)

const (
enableRestartTestsEnvVar = "DEFERRED_RESTART_TESTS"
)

func areRestartTestsEnabled() bool {
envVal, ok := os.LookupEnv(enableRestartTestsEnvVar)
if !ok {
return false
}
val, err := strconv.ParseBool(envVal)
if err != nil {
util.Logf("wrong value for %q: %q (err=%v)", enableRestartTestsEnvVar, envVal, err)
return false
}
return val
}

var _ = ginkgo.Describe("[deferred][restart] Profile deferred", func() {
ginkgo.Context("when restarting", func() {
var (
Expand All @@ -34,6 +53,10 @@ var _ = ginkgo.Describe("[deferred][restart] Profile deferred", func() {
)

ginkgo.BeforeEach(func() {
if !areRestartTestsEnabled() {
ginkgo.Skip(fmt.Sprintf("restart tests are flaky and need to be opted-in setting \"%s=true\"", enableRestartTestsEnvVar))
}

ginkgo.By("getting a list of worker nodes")
nodes, err := util.GetNodesByRole(cs, "worker")
gomega.Expect(err).NotTo(gomega.HaveOccurred())
Expand Down

0 comments on commit d480083

Please sign in to comment.