MAKELEVEL was a bad choice which prevents me running the e2e.test binary from my OLM Makefile

Signed-off-by: Richard Wall <richard.wall@venafi.com>
This commit is contained in:
Richard Wall 2023-10-05 13:02:28 +01:00
parent 3ac37ba699
commit 4497ad5103
2 changed files with 12 additions and 11 deletions

View File

@ -55,6 +55,12 @@ IMAGE_kind_arm64 := $(IMAGE_kind_amd64)
# Once that is done, we can consume this variable from ./make/config/lib.sh
SERVICE_IP_PREFIX = 10.0.0
# This variable is exported so that the the Vault addon in the E2E tests can set
# the image reference of the locally loaded Docker image when it installs the
# Vault Helm chart.
# The Vault Docker image is loaded into kind by `make e2e-setup`.
export E2E_VAULT_IMAGE := $(LOCALIMAGE_vaultretagged)
.PHONY: e2e-setup-kind
## Create a Kubernetes cluster using Kind, which is required for `make e2e`.
## The Kind image is pre-pulled to avoid 'kind create' from blocking other make

View File

@ -30,6 +30,7 @@ import (
"math/big"
"net"
"os"
"strings"
"time"
corev1 "k8s.io/api/core/v1"
@ -47,12 +48,6 @@ import (
const (
vaultHelmChartRepo = "https://helm.releases.hashicorp.com"
vaultHelmChartVersion = "0.24.1"
// This local Vault image is only used when the tests are run using make,
// because it downloads the Vault image, saves it in the scratch folder on
// the filesystem, and copies it to the cluster-under-test before the E2E
// tests get executed.
vaultImageRepository = "local/vault"
vaultImageTag = "local"
)
// Vault describes the configuration details for an instance of Vault
@ -205,11 +200,11 @@ func (v *Vault) Setup(cfg *config.Config, leaderData ...internal.AddonTransferab
// the tests on their chosen cluster, in which case we do not override the
// Vault image and the default chart image will be downloaded and run
// instead.
// MAKELEVEL is always set by make so that it can know whether it is being
// called recursively, so we use that variable as a marker to know whether
// the tests are being executed from our Makefile. See
// https://www.gnu.org/software/make/manual/html_node/Variables_002fRecursion.html
if os.Getenv("MAKELEVEL") != "" {
// E2E_VAULT_IMAGE is exported by `make/e2e-setup.mk`.
if vaultImage := os.Getenv("E2E_VAULT_IMAGE"); vaultImage != "" {
parts := strings.Split(vaultImage, ":")
vaultImageRepository := parts[0]
vaultImageTag := parts[1]
v.chart.Vars = append(
v.chart.Vars,
[]chart.StringTuple{