Skip to content

Commit

Permalink
test: skip image polling test if running in a kind cluster (#2445)
Browse files Browse the repository at this point in the history
Signed-off-by: Daniel Sover <dsover@redhat.com>

Co-authored-by: Daniel Sover <dsover@redhat.com>

Upstream-repository: operator-lifecycle-manager
Upstream-commit: d36949bb3b7353a43d8e8fc02033e0f09b7252bb
  • Loading branch information
timflannagan authored and perdasilva committed Mar 4, 2022
1 parent 322ec9f commit c0155db
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 4 deletions.
12 changes: 11 additions & 1 deletion staging/operator-lifecycle-manager/test/e2e/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -54,4 +54,14 @@ make file and use `-dryRun` with `-focus` and see if the regex would trigger you

## Build infrastructure

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.
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.

## Running on minikube

The e2e suite is also runnable on a minikube cluster. First spin up the minikube cluster manually with the desired provisioner,
then run `make run-local` to deploy OLM onto the cluster. Tests can be run by invoking ginkgo and passing the required command line
arguments to the test suite. For example to run a specific test:

```bash
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
```
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import (
"context"
"fmt"
"net"
"os"
"strconv"
"strings"
"time"
Expand Down Expand Up @@ -641,8 +640,10 @@ var _ = Describe("Catalog represents a store of bundles which OLM can use to ins
})

It("image update", func() {
if os.Getenv("GITHUB_ACTIONS") == "true" {
Skip("This spec fails when run using KIND cluster. See https://github.com/operator-framework/operator-lifecycle-manager/issues/1380 for more details")
if ok, err := inKind(c); ok && err == nil {
Skip("This spec fails when run using KIND cluster. See https://github.com/operator-framework/operator-lifecycle-manager/issues/2420 for more details")
} else if err != nil {
Skip("Could not determine whether running in a kind cluster. Skipping.")
}
// Create an image based catalog source from public Quay image
// Use a unique tag as identifier
Expand Down
18 changes: 18 additions & 0 deletions staging/operator-lifecycle-manager/test/e2e/util_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -953,3 +953,21 @@ func TeardownNamespace(ns string) {
return ctx.Ctx().KubeClient().KubernetesInterface().CoreV1().Namespaces().Delete(context.Background(), ns, metav1.DeleteOptions{})
}).Should(Succeed())
}

func inKind(client operatorclient.ClientInterface) (bool, error) {
nodes, err := client.KubernetesInterface().CoreV1().Nodes().List(context.TODO(), metav1.ListOptions{})
if err != nil {
// error finding nodes
return false, err
}
for _, node := range nodes.Items {
if !strings.HasPrefix(node.GetName(), "kind-") {
continue
}
if !strings.HasSuffix(node.GetName(), "-control-plane") {
continue
}
return true, nil
}
return false, nil
}

0 comments on commit c0155db

Please sign in to comment.