From 7e59ab852a70815069dba9018684743e4e6aa2d5 Mon Sep 17 00:00:00 2001 From: Nitish Malang Date: Fri, 14 Feb 2025 02:37:22 +0530 Subject: [PATCH 1/2] Update Makefile to support running specific unit and e2e tests (#1230) Signed-off-by: Nitish Malang Update Makefile to support running specific unit and e2e tests (#1230) Signed-off-by: Nitish Malang --- Makefile | 46 ++++++++++++++++++++++++++++++++++++++++------ 1 file changed, 40 insertions(+), 6 deletions(-) diff --git a/Makefile b/Makefile index 43b6d15a3..f1eb14171 100644 --- a/Makefile +++ b/Makefile @@ -211,15 +211,49 @@ e2e-ipv6: format: ./hack/format.sh +# New variables for test filtering +RUN_IN_CONTAINER ?= 0 +UNIT_TEST_PATTERN ?= . +E2E_TEST_PATTERN ?= . + +# Run unit tests +.PHONY: test-unit +test-unit: +ifeq ($(RUN_IN_CONTAINER), 1) + @echo "Running unit tests in Docker..." + ./hack/run-ut.sh --docker -run $(UNIT_TEST_PATTERN) +else + @echo "Running unit tests locally..." + ./hack/run-ut.sh --local -run $(UNIT_TEST_PATTERN) +endif + +# Run E2E tests +.PHONY: test-e2e +test-e2e: + @echo "Running E2E tests..." + ./test/e2e/run_test.sh --only-run-tests -run $(E2E_TEST_PATTERN) + +# Run all tests (unit + E2E) .PHONY: test -ifeq ($(RUN_IN_CONTAINER),1) -test: - ./hack/run-ut.sh --docker +test: test-unit test-e2e + +# Run specific unit tests +.PHONY: test-unit-specific +test-unit-specific: +ifeq ($(RUN_IN_CONTAINER), 1) + @echo "Running specific unit tests in Docker..." + ./hack/run-ut.sh --docker -run $(UNIT_TEST_PATTERN) else -test: - ./hack/run-ut.sh --local + @echo "Running specific unit tests locally..." + ./hack/run-ut.sh --local -run $(UNIT_TEST_PATTERN) endif +# Run specific E2E tests +.PHONY: test-e2e-specific +test-e2e-specific: + @echo "Running specific E2E tests..." + ./test/e2e/run_test.sh --only-run-tests -run $(E2E_TEST_PATTERN) + UPDATE_VERSION ?= ${VERSION} .PHONY: update-version update-version: @@ -288,4 +322,4 @@ helm-push: helm-package # run other make targets @for chart in $(CHARTS); do \ $(MAKE) $(addprefix helm-push., $$(basename $${chart})); \ - done + done \ No newline at end of file From 15212555be70078bd2d7511f5d6b0348029163f2 Mon Sep 17 00:00:00 2001 From: Nitish Malang Date: Sat, 15 Feb 2025 01:14:28 +0530 Subject: [PATCH 2/2] Update Makefile to support running specific unit and e2e tests (#1230) --- Makefile | 25 ++++--------------------- 1 file changed, 4 insertions(+), 21 deletions(-) diff --git a/Makefile b/Makefile index f1eb14171..858ad67ab 100644 --- a/Makefile +++ b/Makefile @@ -211,7 +211,7 @@ e2e-ipv6: format: ./hack/format.sh -# New variables for test filtering +# Variables for test filtering RUN_IN_CONTAINER ?= 0 UNIT_TEST_PATTERN ?= . E2E_TEST_PATTERN ?= . @@ -221,39 +221,22 @@ E2E_TEST_PATTERN ?= . test-unit: ifeq ($(RUN_IN_CONTAINER), 1) @echo "Running unit tests in Docker..." - ./hack/run-ut.sh --docker -run $(UNIT_TEST_PATTERN) + ./hack/run-ut.sh --docker else @echo "Running unit tests locally..." - ./hack/run-ut.sh --local -run $(UNIT_TEST_PATTERN) + ./hack/run-ut.sh --local endif # Run E2E tests .PHONY: test-e2e test-e2e: @echo "Running E2E tests..." - ./test/e2e/run_test.sh --only-run-tests -run $(E2E_TEST_PATTERN) + ./test/e2e/run_test.sh --only-run-tests # Run all tests (unit + E2E) .PHONY: test test: test-unit test-e2e -# Run specific unit tests -.PHONY: test-unit-specific -test-unit-specific: -ifeq ($(RUN_IN_CONTAINER), 1) - @echo "Running specific unit tests in Docker..." - ./hack/run-ut.sh --docker -run $(UNIT_TEST_PATTERN) -else - @echo "Running specific unit tests locally..." - ./hack/run-ut.sh --local -run $(UNIT_TEST_PATTERN) -endif - -# Run specific E2E tests -.PHONY: test-e2e-specific -test-e2e-specific: - @echo "Running specific E2E tests..." - ./test/e2e/run_test.sh --only-run-tests -run $(E2E_TEST_PATTERN) - UPDATE_VERSION ?= ${VERSION} .PHONY: update-version update-version: