Skip to content

Commit 9200847

Browse files
authored
Add fail-fast flag to ginkgo tests (#2389)
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.
1 parent 1af04e8 commit 9200847

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -193,7 +193,7 @@ lint: ## Run golangci-lint against code
193193
unit-test: ## Run unit tests for the go code
194194
# 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.
195195
go test -buildvcs ./cmd/... -race -shuffle=on -coverprofile=cmd-coverage.out -covermode=atomic
196-
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
196+
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
197197
go tool cover -html=coverage.out -o cover.html
198198
go tool cover -html=cmd-coverage.out -o cmd-cover.html
199199

tests/Makefile

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,8 @@ stop-longevity-test: nfr-test ## Stop the longevity test and collects results
121121

122122
.PHONY: .vm-nfr-test
123123
.vm-nfr-test: ## Runs the NFR tests on the GCP VM (called by `nfr-test`)
124-
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) \
124+
go run github.com/onsi/ginkgo/v2/ginkgo --randomize-all --randomize-suites --keep-going --fail-on-pending \
125+
--trace -r -v --buildvcs --force-newlines $(GITHUB_OUTPUT) \
125126
--label-filter "nfr" $(GINKGO_FLAGS) --timeout 5h ./suite -- --gateway-api-version=$(GW_API_VERSION) \
126127
--gateway-api-prev-version=$(GW_API_PREV_VERSION) --image-tag=$(TAG) --version-under-test=$(NGF_VERSION) \
127128
--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
130131

131132
.PHONY: test
132133
test: ## Runs the functional tests on your default k8s cluster
133-
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) \
134+
go run github.com/onsi/ginkgo/v2/ginkgo --randomize-all --randomize-suites --keep-going --fail-on-pending \
135+
--trace -r -v --buildvcs --force-newlines $(GITHUB_OUTPUT) \
134136
--label-filter "functional" $(GINKGO_FLAGS) ./suite -- \
135137
--gateway-api-version=$(GW_API_VERSION) --gateway-api-prev-version=$(GW_API_PREV_VERSION) \
136138
--image-tag=$(TAG) --version-under-test=$(NGF_VERSION) \

0 commit comments

Comments
 (0)