Skip to content

Commit 6028661

Browse files
committed
test: skip image polling test if running in a kind cluster
Signed-off-by: Daniel Sover <[email protected]>
1 parent 700d282 commit 6028661

File tree

3 files changed

+33
-4
lines changed

3 files changed

+33
-4
lines changed

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+
```

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

test/e2e/util_test.go

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -918,3 +918,21 @@ func HaveMessage(goal string) gtypes.GomegaMatcher {
918918
return plan.Status.Message
919919
}, ContainSubstring(goal))
920920
}
921+
922+
func inKind(client operatorclient.ClientInterface) (bool, error) {
923+
nodes, err := client.KubernetesInterface().CoreV1().Nodes().List(context.TODO(), metav1.ListOptions{})
924+
if err != nil {
925+
// error finding nodes
926+
return false, err
927+
}
928+
for _, node := range nodes.Items {
929+
if !strings.HasPrefix(node.GetName(), "kind-") {
930+
continue
931+
}
932+
if !strings.HasSuffix(node.GetName(), "-control-plane") {
933+
continue
934+
}
935+
return true, nil
936+
}
937+
return false, nil
938+
}

0 commit comments

Comments
 (0)