Closed mattwelke closed 2 years ago
Taking a closer look, I see now that there's another piece of information reported to me. It says 10638/16000 of my tests passed. This makes a lot more sense to me. I see about a 2/3 pass rate in the logs in the terminal too:
So at this point, my question is more about why one part of the UI says 10638/16000 passed and the other part of the UI says that 15999/16000 of them passed, and why it chose green checkmark icons for the tests where are least one failure occurred.
my guess is that #
mark go test
uses to sanitize the subtest test name caused the confusion while encoding/decoding this test location into the uri (the assumed format is like https://github.com/golang/vscode-go/blob/50b13f17c9e93c29c12c37c2a9935757e0c08d38/src/goTest/resolve.ts#L171)
cc @firelizzard18
@mattwelke Every item in the tree view is a test, subtest, or directory (package, module, or workspace folder). The test controller is reporting "15999" as a subtest. It is not claiming that 15999/16000 of your tests succeeded. It should definitely be creating an entry for each subtest, not just the last one. I might need to implement a cap on the number of subtests, because adding 16000 items to the tree may cause issues. If you can point me to a git repo or provide me with a zip/tarball/etc that reproduces the issue, that would be very helpful.
In general, the test controller has problems around creating test items (nodes in the tree view). I've been using it a lot for the last few months, and it's definitely glitchy. Unfortunately, I'm working 50+ hours per week lately, so I don't really have bandwidth to look into this. Maybe over the holidays.
Hey @firelizzard18 I empathize with being busy. I'm in e-commerce so November and December are extra crazy. Don't worry about this for now. I'll put together a repro soon and we can work on it later on. This is a low priority for me.
Here, 16000 tests didn't mean I literally wrote 16000 tests and I'm interested in seeing each one in the tree. It's just a parameterized test with 16000 parameters. If I have one failure, I probably have a few hundred failures at least, so I didn't expect to get much value out of seeing the failed cases in that tree anyways.
I just wanted to report this in case it can be improved for the next person whose use case is more realistic than mine.
@mattwelke I was thinking more along the lines of, "Wow, what would happen if someone did something that created thousands of items in the tree? Probably nothing good, I should add a limit." The test controller is supposed to create an item in the tree for every time you call testing.T.Run
, so if you call that 16000 times, it's supposed to be creating 16000 items. That would probably break VSCode, or at least make it unreasonably slow.
Originally the test controller always reported every line of test output as a separate output event. With one of my projects, if I enable logging, some of the tests create thousands of lines of output. That made VSCode very sad. Now (by default, it's configurable), if multiple lines of output are produced at the same line of code, the test controller concatenates them and reports it once.
Test item creation is definitely buggy, so the more different angles I can get on the problem, the better.
@hyangah would you tag this as WaitingForInfo?
@firelizzard18 Are you waiting on any particular information from me?
@mattwelke
I'll put together a repro soon and we can work on it later on.
@gopherbot please add labels WaitingForInfo
(EDIT: don't know why but gopherbot seems to be on vacation)
@firelizzard18 I think this should work per https://github.com/golang/go/wiki/gopherbot and we are currently in process of sorting out the github permission to help project contributors. Thanks!
Work life balance is important. I'm not angry at GopherBot.
Change https://golang.org/cl/380501 mentions this issue: src/goTest: remove '#' in subtest name parsing cutset
Change https://go.dev/cl/380501 mentions this issue: src/goTest: remove '#' in subtest name parsing cutset
Change https://go.dev/cl/383935 mentions this issue: [release] src/goTest: remove '#' in subtest name parsing cutset
cl/380501 (released in v0.31.1) should fix the bug that caused misinterpretation of subtests with name duplicates
The only remaining task I see is to limit the number of tree items added to the ui. Created https://github.com/golang/vscode-go/issues/2068 to track that issue separately.
What version of Go, VS Code & VS Code Go extension are you using?
Version Information
* Run `go version` to get version of Go from _the VS Code integrated terminal_. - go version go1.17.3 linux/amd64 * Run `gopls -v version` to get version of Gopls from _the VS Code integrated terminal_. -
Share the Go related settings you have added/edited
Run
Preferences: Open Settings (JSON)
command to open your settings.json file. Share all the settings with thego.
or["go"]
orgopls
prefixes.Describe the bug
I set up some unit tests where I loop through an array of exactly 16000 strings and run a test for each string. I click the icon in the GUI to run the tests that is the left of the line numbers (because I want to see the test results displayed visually in the Testing tab on the left). Note that I do not click "run test" in the code editor because I don't want to see the concise results displayed, I want the verbose visual results where it shows the red and green icons.
The Go output displayed at the bottom shows me some cases where the tests failed and some where it passed. I know I have at least two failures. The Testing tab on the left though shows the number 15999 with a green icon. I'm not sure how to interpret this. But I think what it's telling me is that 15999 of my tests passed? But if so, this isn't correct. This is what it looks like:
Note how the output at the bottom proves I have at least two tests failing. I confirmed with the debugger that as it executes the tests, that slice has exactly 16000 strings:
Another thing I find strange is what is displayed to me in the Testing tab on the left as the tests execute. It has a few different numbers grow, and sometimes displays a red icon and sometimes a green icon:
Steps to reproduce the behavior:
func Test_...
in the code editor so that the Testing tab shows the results visually.