go2xunit icon indicating copy to clipboard operation
go2xunit copied to clipboard

error: 1061: orphan end test

Open tej24 opened this issue 7 years ago • 14 comments

We are facing issue while running the below command for go2xunit package, since a month

command : go test -v $PKGS | $GOPATH/bin/go2xunit

error snippet root@****:<PATH># go test -v $PKGS | $GOPATH/bin/go2xunit -output tests.xml error: 1044: orphan end test

root@*****:<PATH># go test -v $PKGS | $GOPATH/bin/go2xunit - (should output to console, but none) error: 1036: orphan end test *error snippet

go2xunit package version - 1.4.8

tej24 avatar Sep 19 '18 13:09 tej24

Thanks @tej24 . Can you give me a bit more information? Mostly I'd like to see the output of go test -v $PKGS. go version will be helpful as well

tebeka avatar Sep 19 '18 14:09 tebeka

@tebeka List of files ( not exactly same in content though) github.abc.def.hij/test/productapi.git/model/resourceCustomActionsModel github.abc.def.hij/test/productapi.git/model/resourceModel github.abc.def.hij/test/productapi.git/model/roleModel github.abc.def.hij/test/productapi.git/model/schedulerModel github.abc.def.hij/test/productapi.git/model/scriptTypeModel github.abc.def.hij/test/productapi.git/model/tagmodel github.abc.def.hij/test/productapi.git/model/templateModel github.abc.def.hij/test/productapi.git/model/ucmdbResourceModel github.abc.def.hij/test/productapi.git/util/clientutils github.abc.def.hij/test/productapi.git/util/constants github.abc.def.hij/test/productapi.git/webserver

go version go1.9.5 linux/amd64

tej24 avatar Sep 19 '18 15:09 tej24

Thanks @tej24, The output of go test -v $PKGS will be much more helpful. If you can attach it (maybe mask information) it'll be much more helpful. Currently I don't have much to go on.

tebeka avatar Sep 19 '18 21:09 tebeka

@tebeka I'm getting the same error with some of our testcases.

Maybe it's related to that some of our testcases print something in json format to the console?

I ran:

go test -tags unit  ./... 2>&1

to generate the output: output.txt.

When I pass it to

cat output.txt | go2xunit -output junit

I get the error:

error: 5: orphan end test

and the output file is empty.


  • go version go1.11.2 linux/amd64
  • go2xunit 1.4.8

fho avatar Dec 10 '18 16:12 fho

IMO the test output is truncated. The first line in output.txt that gives any indication that it's a test is --- FAIL: TestTriggerDueRemindersWhenAllARsAreDue (0.26s), there should be a RUN before it.

tebeka avatar Dec 17 '18 06:12 tebeka

@tebeka yes, sorry, you are right. In the attached output.txt, I ran go test without the -v flag.

The orphan end test error happens reproducibly for multiple of our unit tests (also when passing the -v flag).

Attached is the output from another test run, where go2xunit fails to parse it with the error:

error: 10: orphan end test

gotestoutput.txt

If required I can provide more examples.

fho avatar Dec 18 '18 15:12 fho

Thanks. Will have a look soon.

tebeka avatar Dec 19 '18 15:12 tebeka

Seems like you're running with t.Parallel? (CONT/PAUSE was added in go 1.10).

Currently t.Parallel is "problematic", see #29

tebeka avatar Dec 24 '18 07:12 tebeka

Yes, those tests were using t.parallel

fho avatar Dec 24 '18 08:12 fho

I am also hitting this error when I have fmt.Print for output instead of fmt.Println ps. tests are not running with t.parallel

go version go1.10.3 linux/amd64 go2xunit 1.4.8

soniachan avatar Jan 28 '19 03:01 soniachan

Sorry for the slow updates. I'll try to solved this soon.

tebeka avatar Jan 28 '19 18:01 tebeka

I am seeing this problem, too. I have tests that are not using T.Parallel, but do test a gin based web service. Running my tests gives debug output from gin, along the lines of:

[GIN] 2019/09/05 - 14:24:14 | 400 |       12.38µs |                 | POST     /api/v1/launch
=== RUN   TestLaunch/Missing_cilist
[GIN] 2019/09/05 - 14:24:14 | 400 |      48.228µs |                 | POST     /api/v1/launch/wannaTest
=== RUN   TestLaunch/Minimal_request
[GIN] 2019/09/05 - 14:24:14 | 200 |     776.615µs |                 | POST     /api/v1/launch/wannaTest
Response: {Message: Error:false CiList:[node1] Description: Tags:[] JobNumber: CIStatus:[]}=== RUN   TestLaunch/Multiple_CIs
[GIN] 2019/09/05 - 14:24:14 | 200 |     567.495µs |                 | POST     /api/v1/launch/wannaTest

kelbyers avatar Sep 05 '19 19:09 kelbyers

Thanks @kelbyers, can you provide the input to go2xunit?

tebeka avatar Sep 12 '19 06:09 tebeka

Sorry about the delay. In trying to get some data for you, we discovered that our test had some debug output that was printing as control characters, instead of taking an int and printing it as a string. It may well be a problem with our tests.

kelbyers avatar Sep 23 '19 21:09 kelbyers