operator-registry
operator-registry copied to clipboard
Unable to run the e2e tests locally
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?
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).
Related and possibly fixed by https://github.com/operator-framework/operator-registry/pull/605
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.
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 ...