-
Notifications
You must be signed in to change notification settings - Fork 124
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
Test cases passed but gotestsum print out Failed in summary #400
Comments
Hello! Most of the time the problem is a missing newline in the output from the tests. You see can similar issues here: #105, #141, #124. And the upstream golang issue golang/go#38063, golang/go#57172 Are you by chance using a Go version older than 1.20 locally? It seems most of these issues were fixed in go1.20. If that's not the case, you you share the output of |
Thanks for quick response 😄 I'm using go version 1.21 so I think it could not cause the issue as you mentioned
Here is the output of the $ go test -json -run=TestGetMinTolerationTime pkg/util/helper/*.go
{"Time":"2024-04-19T23:11:02.458912+07:00","Action":"start","Package":"command-line-arguments"}
{"Time":"2024-04-19T23:11:03.421969+07:00","Action":"run","Package":"command-line-arguments","Test":"TestGetMinTolerationTime"}
{"Time":"2024-04-19T23:11:03.422079+07:00","Action":"output","Package":"command-line-arguments","Test":"TestGetMinTolerationTime","Output":"=== RUN TestGetMinTolerationTime\n"}
{"Time":"2024-04-19T23:11:03.422118+07:00","Action":"run","Package":"command-line-arguments","Test":"TestGetMinTolerationTime/no_noExecuteTaints"}
{"Time":"2024-04-19T23:11:03.422127+07:00","Action":"output","Package":"command-line-arguments","Test":"TestGetMinTolerationTime/no_noExecuteTaints","Output":"=== RUN TestGetMinTolerationTime/no_noExecuteTaints\n"}
{"Time":"2024-04-19T23:11:03.422137+07:00","Action":"output","Package":"command-line-arguments","Test":"TestGetMinTolerationTime/no_noExecuteTaints","Output":"-1ns"}
{"Time":"2024-04-19T23:11:03.422154+07:00","Action":"output","Package":"command-line-arguments","Test":"TestGetMinTolerationTime/no_noExecuteTaints","Output":"--- PASS: TestGetMinTolerationTime/no_noExecuteTaints (0.00s)\n"}
{"Time":"2024-04-19T23:11:03.422161+07:00","Action":"pass","Package":"command-line-arguments","Test":"TestGetMinTolerationTime/no_noExecuteTaints","Elapsed":0}
{"Time":"2024-04-19T23:11:03.422164+07:00","Action":"run","Package":"command-line-arguments","Test":"TestGetMinTolerationTime/no_usedTolerations"}
{"Time":"2024-04-19T23:11:03.422166+07:00","Action":"output","Package":"command-line-arguments","Test":"TestGetMinTolerationTime/no_usedTolerations","Output":"=== RUN TestGetMinTolerationTime/no_usedTolerations\n"}
{"Time":"2024-04-19T23:11:03.422168+07:00","Action":"output","Package":"command-line-arguments","Test":"TestGetMinTolerationTime/no_usedTolerations","Output":"0s"}
{"Time":"2024-04-19T23:11:03.422266+07:00","Action":"output","Package":"command-line-arguments","Test":"TestGetMinTolerationTime/no_usedTolerations","Output":"--- PASS: TestGetMinTolerationTime/no_usedTolerations (0.00s)\n"}
{"Time":"2024-04-19T23:11:03.422302+07:00","Action":"pass","Package":"command-line-arguments","Test":"TestGetMinTolerationTime/no_usedTolerations","Elapsed":0}
{"Time":"2024-04-19T23:11:03.422329+07:00","Action":"run","Package":"command-line-arguments","Test":"TestGetMinTolerationTime/with_noExecuteTaints_and_usedTolerations"}
{"Time":"2024-04-19T23:11:03.422364+07:00","Action":"output","Package":"command-line-arguments","Test":"TestGetMinTolerationTime/with_noExecuteTaints_and_usedTolerations","Output":"=== RUN TestGetMinTolerationTime/with_noExecuteTaints_and_usedTolerations\n"}
{"Time":"2024-04-19T23:11:03.422406+07:00","Action":"output","Package":"command-line-arguments","Test":"TestGetMinTolerationTime/with_noExecuteTaints_and_usedTolerations","Output":"59.999936625s"}
{"Time":"2024-04-19T23:11:03.422425+07:00","Action":"output","Package":"command-line-arguments","Test":"TestGetMinTolerationTime/with_noExecuteTaints_and_usedTolerations","Output":"--- PASS: TestGetMinTolerationTime/with_noExecuteTaints_and_usedTolerations (0.00s)\n"}
{"Time":"2024-04-19T23:11:03.422433+07:00","Action":"pass","Package":"command-line-arguments","Test":"TestGetMinTolerationTime/with_noExecuteTaints_and_usedTolerations","Elapsed":0}
{"Time":"2024-04-19T23:11:03.422439+07:00","Action":"run","Package":"command-line-arguments","Test":"TestGetMinTolerationTime/usedTolerantion.TolerationSeconds_is_nil"}
{"Time":"2024-04-19T23:11:03.422444+07:00","Action":"output","Package":"command-line-arguments","Test":"TestGetMinTolerationTime/usedTolerantion.TolerationSeconds_is_nil","Output":"=== RUN TestGetMinTolerationTime/usedTolerantion.TolerationSeconds_is_nil\n"}
{"Time":"2024-04-19T23:11:03.42245+07:00","Action":"output","Package":"command-line-arguments","Test":"TestGetMinTolerationTime/usedTolerantion.TolerationSeconds_is_nil","Output":"-1ns"}
{"Time":"2024-04-19T23:11:03.422456+07:00","Action":"output","Package":"command-line-arguments","Test":"TestGetMinTolerationTime/usedTolerantion.TolerationSeconds_is_nil","Output":"--- PASS: TestGetMinTolerationTime/usedTolerantion.TolerationSeconds_is_nil (0.00s)\n"}
{"Time":"2024-04-19T23:11:03.422462+07:00","Action":"pass","Package":"command-line-arguments","Test":"TestGetMinTolerationTime/usedTolerantion.TolerationSeconds_is_nil","Elapsed":0}
{"Time":"2024-04-19T23:11:03.422466+07:00","Action":"run","Package":"command-line-arguments","Test":"TestGetMinTolerationTime/noExecuteTaints.TimeAdded_is_nil"}
{"Time":"2024-04-19T23:11:03.422784+07:00","Action":"output","Package":"command-line-arguments","Test":"TestGetMinTolerationTime/noExecuteTaints.TimeAdded_is_nil","Output":"=== RUN TestGetMinTolerationTime/noExecuteTaints.TimeAdded_is_nil\n"}
{"Time":"2024-04-19T23:11:03.422796+07:00","Action":"output","Package":"command-line-arguments","Test":"TestGetMinTolerationTime/noExecuteTaints.TimeAdded_is_nil","Output":"-1ns"}
{"Time":"2024-04-19T23:11:03.422803+07:00","Action":"output","Package":"command-line-arguments","Test":"TestGetMinTolerationTime/noExecuteTaints.TimeAdded_is_nil","Output":"--- PASS: TestGetMinTolerationTime/noExecuteTaints.TimeAdded_is_nil (0.00s)\n"}
{"Time":"2024-04-19T23:11:03.422808+07:00","Action":"pass","Package":"command-line-arguments","Test":"TestGetMinTolerationTime/noExecuteTaints.TimeAdded_is_nil","Elapsed":0}
{"Time":"2024-04-19T23:11:03.422813+07:00","Action":"run","Package":"command-line-arguments","Test":"TestGetMinTolerationTime/find_the_latest_trigger_time"}
{"Time":"2024-04-19T23:11:03.422818+07:00","Action":"output","Package":"command-line-arguments","Test":"TestGetMinTolerationTime/find_the_latest_trigger_time","Output":"=== RUN TestGetMinTolerationTime/find_the_latest_trigger_time\n"}
{"Time":"2024-04-19T23:11:03.422844+07:00","Action":"output","Package":"command-line-arguments","Test":"TestGetMinTolerationTime/find_the_latest_trigger_time","Output":"59.999904792s"}
{"Time":"2024-04-19T23:11:03.422849+07:00","Action":"output","Package":"command-line-arguments","Test":"TestGetMinTolerationTime/find_the_latest_trigger_time","Output":"--- PASS: TestGetMinTolerationTime/find_the_latest_trigger_time (0.00s)\n"}
{"Time":"2024-04-19T23:11:03.422852+07:00","Action":"pass","Package":"command-line-arguments","Test":"TestGetMinTolerationTime/find_the_latest_trigger_time","Elapsed":0}
{"Time":"2024-04-19T23:11:03.422854+07:00","Action":"run","Package":"command-line-arguments","Test":"TestGetMinTolerationTime/trigger_time_is_up"}
{"Time":"2024-04-19T23:11:03.422856+07:00","Action":"output","Package":"command-line-arguments","Test":"TestGetMinTolerationTime/trigger_time_is_up","Output":"=== RUN TestGetMinTolerationTime/trigger_time_is_up\n"}
{"Time":"2024-04-19T23:11:03.42286+07:00","Action":"output","Package":"command-line-arguments","Test":"TestGetMinTolerationTime/trigger_time_is_up","Output":"0s"}
{"Time":"2024-04-19T23:11:03.422862+07:00","Action":"output","Package":"command-line-arguments","Test":"TestGetMinTolerationTime/trigger_time_is_up","Output":"--- PASS: TestGetMinTolerationTime/trigger_time_is_up (0.00s)\n"}
{"Time":"2024-04-19T23:11:03.422864+07:00","Action":"pass","Package":"command-line-arguments","Test":"TestGetMinTolerationTime/trigger_time_is_up","Elapsed":0}
{"Time":"2024-04-19T23:11:03.422866+07:00","Action":"output","Package":"command-line-arguments","Test":"TestGetMinTolerationTime","Output":"--- PASS: TestGetMinTolerationTime (0.00s)\n"}
{"Time":"2024-04-19T23:11:03.423005+07:00","Action":"pass","Package":"command-line-arguments","Test":"TestGetMinTolerationTime","Elapsed":0}
{"Time":"2024-04-19T23:11:03.423015+07:00","Action":"output","Package":"command-line-arguments","Output":"PASS\n"}
{"Time":"2024-04-19T23:11:03.423319+07:00","Action":"output","Package":"command-line-arguments","Output":"ok \tcommand-line-arguments\t0.964s\n"}
{"Time":"2024-04-19T23:11:03.423358+07:00","Action":"pass","Package":"command-line-arguments","Elapsed":0.964} |
I see an
I see the expected output (no failed tests). I'm not sure what is causing the unknown fail. What is that |
I used latest release of gotestsum v1.11.0 not the latest main branch code. Maybe that is the cause 👀 |
I tried to install gotestsum at latest commit (e9677fb) and look like nothing changed 🤔 $ go install gotest.tools/gotestsum@e9677fb405a5c0dc0b9d7217a7c73c3a20c5cb66
$ gotestsum -- -v -run=TestGetMinTolerationTime pkg/util/helper/*.go
✓ command-line-arguments (1.096s)
=== Failed
=== FAIL: command-line-arguments TestGetMinTolerationTime (unknown)
-1ns=== RUN TestGetMinTolerationTime/no_usedTolerations
0s=== RUN TestGetMinTolerationTime/with_noExecuteTaints_and_usedTolerations
59.999939459s=== RUN TestGetMinTolerationTime/usedTolerantion.TolerationSeconds_is_nil
-1ns=== RUN TestGetMinTolerationTime/noExecuteTaints.TimeAdded_is_nil
-1ns=== RUN TestGetMinTolerationTime/find_the_latest_trigger_time
59.999909333s=== RUN TestGetMinTolerationTime/trigger_time_is_up
0s--- PASS: TestGetMinTolerationTime (0.00s)
--- PASS: TestGetMinTolerationTime/no_noExecuteTaints (0.00s)
--- PASS: TestGetMinTolerationTime/no_usedTolerations (0.00s)
--- PASS: TestGetMinTolerationTime/with_noExecuteTaints_and_usedTolerations (0.00s)
--- PASS: TestGetMinTolerationTime/usedTolerantion.TolerationSeconds_is_nil (0.00s)
--- PASS: TestGetMinTolerationTime/noExecuteTaints.TimeAdded_is_nil (0.00s)
--- PASS: TestGetMinTolerationTime/find_the_latest_trigger_time (0.00s)
--- PASS: TestGetMinTolerationTime/trigger_time_is_up (0.00s)
=== FAIL: command-line-arguments TestGetMinTolerationTime/no_noExecuteTaints (unknown)
-1ns=== RUN TestGetMinTolerationTime/no_usedTolerations
0s=== RUN TestGetMinTolerationTime/with_noExecuteTaints_and_usedTolerations
59.999939459s=== RUN TestGetMinTolerationTime/usedTolerantion.TolerationSeconds_is_nil
-1ns=== RUN TestGetMinTolerationTime/noExecuteTaints.TimeAdded_is_nil
-1ns=== RUN TestGetMinTolerationTime/find_the_latest_trigger_time
59.999909333s=== RUN TestGetMinTolerationTime/trigger_time_is_up
0s--- PASS: TestGetMinTolerationTime (0.00s)
--- PASS: TestGetMinTolerationTime/no_noExecuteTaints (0.00s)
--- PASS: TestGetMinTolerationTime/no_usedTolerations (0.00s)
--- PASS: TestGetMinTolerationTime/with_noExecuteTaints_and_usedTolerations (0.00s)
--- PASS: TestGetMinTolerationTime/usedTolerantion.TolerationSeconds_is_nil (0.00s)
--- PASS: TestGetMinTolerationTime/noExecuteTaints.TimeAdded_is_nil (0.00s)
--- PASS: TestGetMinTolerationTime/find_the_latest_trigger_time (0.00s)
--- PASS: TestGetMinTolerationTime/trigger_time_is_up (0.00s)
DONE 2 tests, 2 failures in 5.804s Also, I tried both zsh (my current shell) and bash but both printed out the |
@dnephin I found that {"Time":"2024-04-19T23:11:03.422127+07:00","Action":"output","Package":"command-line-arguments","Test":"TestGetMinTolerationTime/no_noExecuteTaints","Output":"=== RUN TestGetMinTolerationTime/no_noExecuteTaints\n"}
{"Time":"2024-04-19T23:11:03.422137+07:00","Action":"output","Package":"command-line-arguments","Test":"TestGetMinTolerationTime/no_noExecuteTaints","Output":"-1ns"}
{"Time":"2024-04-19T23:11:03.422154+07:00","Action":"output","Package":"command-line-arguments","Test":"TestGetMinTolerationTime/no_noExecuteTaints","Output":"--- PASS: TestGetMinTolerationTime/no_noExecuteTaints (0.00s)\n"}
{"Time":"2024-04-19T23:11:03.422161+07:00","Action":"pass","Package":"command-line-arguments","Test":"TestGetMinTolerationTime/no_noExecuteTaints","Elapsed":0} previous gotestsum -ftestname --raw-command cat examples.json
PASS command-line-arguments.TestGetMinTolerationTime/no_noExecuteTaints (0.00s)
PASS command-line-arguments
=== RUN TestGetMinTolerationTime
FAIL command-line-arguments.TestGetMinTolerationTime (-1.00s)
=== Failed
=== FAIL: command-line-arguments TestGetMinTolerationTime (unknown)
-1ns--- PASS: TestGetMinTolerationTime/no_noExecuteTaints (0.00s)
DONE 2 tests, 1 failure in 0.006s now gotestsum -ftestname --raw-command cat examples1.json
PASS command-line-arguments.TestGetMinTolerationTime/no_noExecuteTaints (0.00s)
PASS command-line-arguments.TestGetMinTolerationTime/no_usedTolerations (0.00s)
PASS command-line-arguments.TestGetMinTolerationTime/with_noExecuteTaints_and_usedTolerations (0.00s)
PASS command-line-arguments.TestGetMinTolerationTime/usedTolerantion.TolerationSeconds_is_nil (0.00s)
PASS command-line-arguments.TestGetMinTolerationTime/noExecuteTaints.TimeAdded_is_nil (0.00s)
PASS command-line-arguments.TestGetMinTolerationTime/find_the_latest_trigger_time (0.00s)
PASS command-line-arguments.TestGetMinTolerationTime/trigger_time_is_up (0.00s)
PASS command-line-arguments.TestGetMinTolerationTime (0.00s)
PASS command-line-arguments
DONE 8 tests in 0.006s I think we should update the gotestsum to accept something printout in stdout from the test source code (like that Ofcource for this time, we can remove the print statement from the Karmada test code since it doesn't mean anything anyway. |
I don't know exactly how that would work. I think the problem was missing newline in the output were confusing |
We tried to adopt gotestsum to https://github.com/karmada-io/karmada repo, and in both CI and local tests, the summary printed by gotestsum returned FAILED even when all test cases passed. Rerun test cases again using
go test
command and it passed normally.This is the stdout printed by gotestsum in CI (Github Actions)
ref: https://github.com/karmada-io/karmada/actions/runs/8752542558/job/24020602781?pr=4850#step:4:8673
This is the stdout printed by gotestsum in the local
gotestsum printed FAIL, while rerun using
go test
Is this something wrong with gotestsum or did I miss setting any flags?
The text was updated successfully, but these errors were encountered: