-
Notifications
You must be signed in to change notification settings - Fork 925
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
do not start new tests after the first test failure #2082
Conversation
Could you please help to test if this flag works as expected? I guess you can hack one of the unit tests to make a failing test. |
The new go test -failfast flag disables running additional tests after any test fails. Note that tests running in parallel with the failing test are allowed to complete. |
A issue about this: golang/go#33038 |
This issue looks like hang on for a long time. How about update with this: golang/go#33038 (comment) |
LGTM. /cc @RainbowMango |
Signed-off-by: xin.li <[email protected]>
Test result: % for s in $(go list ./cmd/...); do if ! go test -race -failfast -v -p 1 $s; then break; fi; done
? github.com/karmada-io/karmada/cmd/agent [no test files]
? github.com/karmada-io/karmada/cmd/agent/app [no test files]
=== RUN TestValidateKarmadaAgentConfiguration
validation_test.go:44: expected success: []
validation_test.go:44: expected success: []
--- FAIL: TestValidateKarmadaAgentConfiguration (0.00s)
FAIL
FAIL github.com/karmada-io/karmada/cmd/agent/app/options 0.751s
FAIL
Seems good |
Great! |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: RainbowMango The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
Hi, @my-git9 @RainbowMango UT seems not work now, please take a look. |
In makefile, you shall use diff --git a/Makefile b/Makefile
index 9a5aed43..929a45e3 100644
--- a/Makefile
+++ b/Makefile
@@ -110,9 +110,9 @@ release-chart:
.PHONY: test
test:
- for s in $(go list ./pkg/...); do if ! go test -race -failfast -v -p 1 $s; then break; fi; done
- for s in $(go list ./cmd/...); do if ! go test -race -failfast -v -p 1 $s; then break; fi; done
- for s in $(go list ./examples/...); do if ! go test -race -failfast -v -p 1 $s; then break; fi; done
+ for s in $$(go list ./pkg/...); do if ! go test -race -failfast -v -p 1 $${s}; then break; fi; done
+ for s in $$(go list ./cmd/...); do if ! go test -race -failfast -v -p 1 $${s}; then break; fi; done
+ for s in $$(go list ./examples/...); do if ! go test -race -failfast -v -p 1 $${s}; then break; fi; done
|
But i am wonder, is it beneficial introducing failfast, abandoning parallel test? |
Why do you think |
|
test:
go clean -testcache
go test --race --v ./pkg/...
go test --race --v ./cmd/...
go test --race --v ./examples/...
real 0m20.817s
user 0m48.761s
sys 0m12.330s test:
go clean -testcache
for s in $$(go list ./pkg/...); do if ! go test -race -failfast -v -p 1 $${s}; then break; fi; done
for s in $$(go list ./cmd/...); do if ! go test -race -failfast -v -p 1 $${s}; then break; fi; done
for s in $$(go list ./examples/...); do if ! go test -race -failfast -v -p 1 $${s}; then break; fi; done
real 2m53.020s
user 2m6.859s
sys 1m51.134s |
Got it. Thanks for the explanation. But I found it's pretty inconvenient to get the failed case without -failfast. Do you think we should revert the change made by this PR? |
I'm thinking if we can introduce two endpoints in Makefile for different purposes, one is for developers run test locally and the other one for CI(I assume CI is time-insensitive). |
Talked with @ikaven1024, and given the UT is totally missing, for now, we are going to revert this change immediately. |
What type of PR is this?
Do not start new tests after the first test failure
What this PR does / why we need it:
Which issue(s) this PR fixes:
Fixes # #2073
Special notes for your reviewer:
Does this PR introduce a user-facing change?: