Skip to content

Commit 7ff5e4a

Browse files
committed
test: skip image polling test if running in a kind cluster (#2445)
Signed-off-by: Daniel Sover <[email protected]> Co-authored-by: Daniel Sover <[email protected]> Upstream-repository: operator-lifecycle-manager Upstream-commit: d36949bb3b7353a43d8e8fc02033e0f09b7252bb
1 parent 0c319f5 commit 7ff5e4a

File tree

3 files changed

+33
-4
lines changed

3 files changed

+33
-4
lines changed

staging/operator-lifecycle-manager/test/e2e/README.md

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,4 +54,14 @@ make file and use `-dryRun` with `-focus` and see if the regex would trigger you
5454

5555
## Build infrastructure
5656

57-
Note that the make file target `e2e-local` is executed by the github workflow `.github/workflows/e2e-tests.yml` and uses two parallel `go test` processes.
57+
Note that the make file target `e2e-local` is executed by the github workflow `.github/workflows/e2e-tests.yml` and uses two parallel `go test` processes.
58+
59+
## Running on minikube
60+
61+
The e2e suite is also runnable on a minikube cluster. First spin up the minikube cluster manually with the desired provisioner,
62+
then run `make run-local` to deploy OLM onto the cluster. Tests can be run by invoking ginkgo and passing the required command line
63+
arguments to the test suite. For example to run a specific test:
64+
65+
```bash
66+
GO111MODULE=on GOFLAGS="-mod=vendor" go run github.com/onsi/ginkgo/ginkgo -focus "static provider" -v --progress ./test/e2e -- -namespace=operators -olmNamespace=olm -dummyImage=bitnami/nginx:latest
67+
```

staging/operator-lifecycle-manager/test/e2e/catalog_e2e_test.go

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ import (
66
"context"
77
"fmt"
88
"net"
9-
"os"
109
"strconv"
1110
"strings"
1211
"time"
@@ -641,8 +640,10 @@ var _ = Describe("Catalog represents a store of bundles which OLM can use to ins
641640
})
642641

643642
It("image update", func() {
644-
if os.Getenv("GITHUB_ACTIONS") == "true" {
645-
Skip("This spec fails when run using KIND cluster. See https://github.com/operator-framework/operator-lifecycle-manager/issues/1380 for more details")
643+
if ok, err := inKind(c); ok && err == nil {
644+
Skip("This spec fails when run using KIND cluster. See https://github.com/operator-framework/operator-lifecycle-manager/issues/2420 for more details")
645+
} else if err != nil {
646+
Skip("Could not determine whether running in a kind cluster. Skipping.")
646647
}
647648
// Create an image based catalog source from public Quay image
648649
// Use a unique tag as identifier

staging/operator-lifecycle-manager/test/e2e/util_test.go

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -953,3 +953,21 @@ func TeardownNamespace(ns string) {
953953
return ctx.Ctx().KubeClient().KubernetesInterface().CoreV1().Namespaces().Delete(context.Background(), ns, metav1.DeleteOptions{})
954954
}).Should(Succeed())
955955
}
956+
957+
func inKind(client operatorclient.ClientInterface) (bool, error) {
958+
nodes, err := client.KubernetesInterface().CoreV1().Nodes().List(context.TODO(), metav1.ListOptions{})
959+
if err != nil {
960+
// error finding nodes
961+
return false, err
962+
}
963+
for _, node := range nodes.Items {
964+
if !strings.HasPrefix(node.GetName(), "kind-") {
965+
continue
966+
}
967+
if !strings.HasSuffix(node.GetName(), "-control-plane") {
968+
continue
969+
}
970+
return true, nil
971+
}
972+
return false, nil
973+
}

0 commit comments

Comments
 (0)