Skip to content

Commit

Permalink
Remove leader election test (#2745)
Browse files Browse the repository at this point in the history
Now that we are using the standard k8s leases from
the controller runtime library, there is no need to
test our implementation as it is no longer in use.
This will save some testing time and random failures.

Signed-off-by: Alexander Wels <awels@redhat.com>
  • Loading branch information
awels authored Jun 9, 2023
1 parent 33c55a5 commit 35f1c79
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 262 deletions.
1 change: 0 additions & 1 deletion tests/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@ go_test(
"external_population_test.go",
"import_proxy_test.go",
"import_test.go",
"leaderelection_test.go",
"local_volume_test.go",
"monitoring_test.go",
"operator_test.go",
Expand Down
9 changes: 9 additions & 0 deletions tests/apiserver_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,15 @@ import (
"kubevirt.io/containerized-data-importer/tests/utils"
)

const (
cdiDeploymentPodPrefix = "cdi-deployment-"
cdiApiServerPodPrefix = "cdi-apiserver-"
cdiUploadProxyPodPrefix = "cdi-uploadproxy-"

pollingInterval = 2 * time.Second
timeout = 360 * time.Second
)

var _ = Describe("cdi-apiserver tests", func() {
var origSpec *cdiv1.CDIConfigSpec
f := framework.NewFramework("cdi-apiserver-test", framework.Config{})
Expand Down
261 changes: 0 additions & 261 deletions tests/leaderelection_test.go

This file was deleted.

16 changes: 16 additions & 0 deletions tests/operator_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import (
"encoding/json"
"fmt"
"reflect"
"regexp"
"time"

. "github.com/onsi/ginkgo"
Expand Down Expand Up @@ -38,6 +39,10 @@ import (
"kubevirt.io/controller-lifecycle-operator-sdk/pkg/sdk"
)

var (
logIsLeaderRegex = regexp.MustCompile("successfully acquired lease")
)

var _ = Describe("ALL Operator tests", func() {
Context("[Destructive]", func() {
var _ = Describe("Operator tests", func() {
Expand Down Expand Up @@ -1230,3 +1235,14 @@ func scaleDeployment(f *framework.Framework, deploymentName string, replicas int
Expect(err).ToNot(HaveOccurred())
return originalReplicas
}

func checkLogForRegEx(regEx *regexp.Regexp, log string) bool {
matches := regEx.FindAllStringIndex(log, -1)
return len(matches) >= 1
}

func getLog(f *framework.Framework, name string) string {
log, err := f.RunKubectlCommand("logs", "--since=0", name, "-n", f.CdiInstallNs)
Expect(err).ToNot(HaveOccurred())
return log
}

0 comments on commit 35f1c79

Please sign in to comment.