From ca41a9222d59b32dd87b43ffc0cd92b02a8760e6 Mon Sep 17 00:00:00 2001 From: Christoph Blecker Date: Mon, 26 Feb 2024 09:01:04 -0800 Subject: [PATCH] Fix makefile variable expansion for test-integration target --- build/root/Makefile | 5 ++++- hack/make-rules/test-integration.sh | 12 ++++++++---- 2 files changed, 12 insertions(+), 5 deletions(-) diff --git a/build/root/Makefile b/build/root/Makefile index 628b093d220..40e6988109a 100644 --- a/build/root/Makefile +++ b/build/root/Makefile @@ -197,10 +197,12 @@ define TEST_IT_HELP_INFO # Args: # WHAT: Directory names to test. All *_test.go files under these # directories will be run. If not specified, "everything" will be tested. +# KUBE_TEST_ARGS: Arguments to pass to the resulting go test invocation. # # Example: # make test-integration # make test-integration WHAT=./test/integration/kubelet GOFLAGS="-v -coverpkg=./pkg/kubelet/..." KUBE_COVER="y" +# make test-integration WHAT=./test/integration/pods GOFLAGS="-v" KUBE_TEST_ARGS='-run ^TestPodUpdateActiveDeadlineSeconds$$' endef .PHONY: test-integration ifeq ($(PRINT_HELP),y) @@ -208,7 +210,8 @@ test-integration: echo "$$TEST_IT_HELP_INFO" else test-integration: - hack/make-rules/test-integration.sh $(WHAT) + # KUBE_TEST_ARGS is explicitly passed here in order to ensure that we are preserving any dollar signs in the value. + KUBE_TEST_ARGS='$(value KUBE_TEST_ARGS)' hack/make-rules/test-integration.sh $(WHAT) endif define TEST_E2E_NODE_HELP_INFO diff --git a/hack/make-rules/test-integration.sh b/hack/make-rules/test-integration.sh index f243fe8024c..18a241c1560 100755 --- a/hack/make-rules/test-integration.sh +++ b/hack/make-rules/test-integration.sh @@ -75,12 +75,16 @@ runTests() { kube::etcd::start_scraping kube::log::status "Running integration test cases" - make -C "${KUBE_ROOT}" test \ + # shellcheck disable=SC2034 + # KUBE_RACE and MAKEFLAGS are used in the downstream make, and we set them to + # empty here to ensure that we aren't unintentionally consuming them from the + # previous make invocation. + KUBE_TEST_ARGS="${SHORT:--short=true} --vmodule=${KUBE_TEST_VMODULE} ${KUBE_TEST_ARGS}" \ WHAT="${WHAT:-$(kube::test::find_integration_test_dirs | paste -sd' ' -)}" \ GOFLAGS="${GOFLAGS:-}" \ - KUBE_TEST_ARGS="${SHORT:--short=true} --vmodule=${KUBE_TEST_VMODULE} ${KUBE_TEST_ARGS:-}" \ - KUBE_TIMEOUT="${KUBE_TIMEOUT}" \ - KUBE_RACE="" + KUBE_RACE="" \ + MAKEFLAGS="" \ + make -C "${KUBE_ROOT}" test cleanup }