operator-registry icon indicating copy to clipboard operation
operator-registry copied to clipboard

Unable to run the e2e tests locally

Open camilamacedo86 opened this issue 4 years ago • 4 comments

I have a kind cluster run and up and then, when I execute make e2e the following error is faced:

• Failure [0.002 seconds]
Launch bundle
/Users/camilamacedo/go/src/github.com/operator-framework/operator-registry/test/e2e/bundle_image_test.go:691
  Deploy bundle job
  /Users/camilamacedo/go/src/github.com/operator-framework/operator-registry/test/e2e/bundle_image_test.go:712
    should populate specified configmap [It]
    /Users/camilamacedo/go/src/github.com/operator-framework/operator-registry/test/e2e/bundle_image_test.go:713

    Unexpected error:
        <*errors.errorString | 0xc0007ec2c0>: {
            s: "Cannot load config for REST client: unable to load in-cluster configuration, KUBERNETES_SERVICE_HOST and KUBERNETES_SERVICE_PORT must be defined",
        }
        Cannot load config for REST client: unable to load in-cluster configuration, KUBERNETES_SERVICE_HOST and KUBERNETES_SERVICE_PORT must be defined
    occurred

    /Users/camilamacedo/go/src/github.com/operator-framework/operator-registry/test/e2e/bundle_image_test.go:717

Environment

  • Mac OS
  • kind v0.9.0 go1.15.2 darwin/amd64

Should not it work? Have any configuration that should be made?

camilamacedo86 avatar Jan 21 '21 00:01 camilamacedo86

I think this test currently expects the environment variable KUBECONFIG to be set (as in https://github.com/operator-framework/operator-registry/blob/master/.github/workflows/test.yml#L55).

benluddy avatar Jan 27 '21 05:01 benluddy

Related and possibly fixed by https://github.com/operator-framework/operator-registry/pull/605

joelanford avatar Apr 01 '21 14:04 joelanford

Long term, it would be good if the tests that our CI suite runs worked locally with no setup steps necessary.

In the short-term, we should update the tests to fail-fast and emit helpful error messages when expected setup has not occurred.

joelanford avatar Apr 01 '21 15:04 joelanford

Yeah agreed, and something we may want to entertain is wrapping the make e2e* targets in a bash script that handles the heavy-lifting or pretest setup, in addition to running things like go test .... It's fairly easy in that case to fail early when things like KUBECONFIG aren't defined, as you can do something similar to the following:

#! /bin/bash

set -o nounset

: "${KUBECONFIG:?}"

...

go test ...

timflannagan avatar Apr 01 '21 15:04 timflannagan