From 210b55cba21236520a346e62574283a5781f8134 Mon Sep 17 00:00:00 2001 From: Luca Comellini Date: Tue, 13 Aug 2024 12:07:50 -0700 Subject: [PATCH] Add fail-fast flag to ginkgo tests Problem: When a test is failing the rest of the tests will still keep running. Solution: Add fail-fast flag so that the tests will stop and will make it easier to analyze the error. --- Makefile | 2 +- tests/Makefile | 6 ++++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/Makefile b/Makefile index c3cb86310..ba4df04ef 100644 --- a/Makefile +++ b/Makefile @@ -186,7 +186,7 @@ lint: check-golangci-lint ## Run golangci-lint against code unit-test: ## Run unit tests for the go code # We have to run the tests in the cmd package using `go test` because of a bug with the CLI library cobra. See https://github.com/spf13/cobra/issues/2104. go test -buildvcs ./cmd/... -race -shuffle=on -coverprofile=cmd-coverage.out -covermode=atomic - go run github.com/onsi/ginkgo/v2/ginkgo --randomize-all --randomize-suites --race --keep-going --fail-on-pending --trace --covermode=atomic --coverprofile=coverage.out --force-newlines $(GITHUB_OUTPUT) -p -v -r internal + go run github.com/onsi/ginkgo/v2/ginkgo --randomize-all --randomize-suites --race --keep-going --fail-on-pending --fail-fast --trace --covermode=atomic --coverprofile=coverage.out --force-newlines $(GITHUB_OUTPUT) -p -v -r internal go tool cover -html=coverage.out -o cover.html go tool cover -html=cmd-coverage.out -o cmd-cover.html diff --git a/tests/Makefile b/tests/Makefile index 37d41e5d6..abc4aa3ec 100644 --- a/tests/Makefile +++ b/tests/Makefile @@ -121,7 +121,8 @@ stop-longevity-test: nfr-test ## Stop the longevity test and collects results .PHONY: .vm-nfr-test .vm-nfr-test: ## Runs the NFR tests on the GCP VM (called by `nfr-test`) - go run github.com/onsi/ginkgo/v2/ginkgo --randomize-all --randomize-suites --keep-going --fail-on-pending --trace -r -v --buildvcs --force-newlines $(GITHUB_OUTPUT) \ + go run github.com/onsi/ginkgo/v2/ginkgo --randomize-all --randomize-suites --keep-going --fail-on-pending \ + --trace -r -v --buildvcs --force-newlines $(GITHUB_OUTPUT) \ --label-filter "nfr" $(GINKGO_FLAGS) --timeout 5h ./suite -- --gateway-api-version=$(GW_API_VERSION) \ --gateway-api-prev-version=$(GW_API_PREV_VERSION) --image-tag=$(TAG) --version-under-test=$(NGF_VERSION) \ --plus-enabled=$(PLUS_ENABLED) --ngf-image-repo=$(PREFIX) --nginx-image-repo=$(NGINX_PREFIX) --nginx-plus-image-repo=$(NGINX_PLUS_PREFIX) \ @@ -130,7 +131,8 @@ stop-longevity-test: nfr-test ## Stop the longevity test and collects results .PHONY: test test: ## Runs the functional tests on your default k8s cluster - go run github.com/onsi/ginkgo/v2/ginkgo --randomize-all --randomize-suites --keep-going --fail-on-pending --trace -r -v --buildvcs --force-newlines $(GITHUB_OUTPUT) \ + go run github.com/onsi/ginkgo/v2/ginkgo --randomize-all --randomize-suites --keep-going --fail-on-pending \ + --trace -r -v --buildvcs --force-newlines $(GITHUB_OUTPUT) \ --label-filter "functional" $(GINKGO_FLAGS) ./suite -- \ --gateway-api-version=$(GW_API_VERSION) --gateway-api-prev-version=$(GW_API_PREV_VERSION) \ --image-tag=$(TAG) --version-under-test=$(NGF_VERSION) \