Comments (2)
And as a side note (not sure if I should open a separate issue), when the test panics, all the logs is placed under error.message, like:
<error message="No test result found"><![CDATA[
{"time":"2023-11-02T09:58:14.944416+01:00","level":"INFO","msg":"heartbeat state","git_commit":"","git_time":"0001-01-01T00:00:00Z","git_modified":false,"go_os":"","go_arch":"","process_generation":"68cbe19f-f21e-49aa-b3a7-3c1d9b991409","hostname_fqdn":"","hostname_short":"Emmanuels-MacBook-Pro.local","private_ips":["192.168.1.55","192.168.1.94"],"num_vcpus":12,"server_id":"DNS_SERVER_ID","address":"127.0.0.1:9093","module":"environment","sub_service":"environment","num_actors":0,"used_memory":0}
{"time":"2023-11-02T09:58:14.944427+01:00","level":"INFO","msg":"performed initial heartbeat","git_commit":"","git_time":"0001-01-01T00:00:00Z","git_modified":false,"go_os":"","go_arch":"","process_generation":"68cbe19f-f21e-49aa-b3a7-3c1d9b991409","hostname_fqdn":"","hostname_short":"Emmanuels-MacBook-Pro.local","private_ips":["192.168.1.55","192.168.1.94"],"num_vcpus":12,"server_id":"DNS_SERVER_ID","address":"127.0.0.1:9093","address":"127.0.0.1:9093"}
{"time":"2023-11-02T09:58:14.944475+01:00","level":"INFO","msg":"trying to connect to sqlite","git_commit":"","git_time":"0001-01-01T00:00:00Z","git_modified":false,"go_os":"","go_arch":"","process_generation":"68cbe19f-f21e-49aa-b3a7-3c1d9b991409","hostname_fqdn":"","hostname_short":"Emmanuels-MacBook-Pro.local","private_ips":["192.168.1.55","192.168.1.94"],"num_vcpus":12}
{"time":"2023-11-02T09:58:14.944671+01:00","level":"INFO","msg":"done connecting to sqlite","git_commit":"","git_time":"0001-01-01T00:00:00Z","git_modified":false,"go_os":"","go_arch":"","process_generation":"68cbe19f-f21e-49aa-b3a7-3c1d9b991409","hostname_fqdn":"","hostname_short":"Emmanuels-MacBook-Pro.local","private_ips":["192.168.1.55","192.168.1.94"],"num_vcpus":12}
....
from go-junit-report.
I have similar issue:
Reproduce:
- Sample test
func TestPanic(t *testing.T) {
// cause a panic in order to get the test to exit with an exception
panic("This test has a panic")
}
- Run go test
go test -count=1 -v -timeout 1h | tee test_output.log
- Will produce
test_output.log
like,..
=== RUN TestPanicTerraform
--- FAIL: TestPanicTerraform (0.00s)
panic: This test has a panic [recovered]
panic: This test has a panic
goroutine 13 [running]:
testing.tRunner.func1.2({0x1877a80, 0x201da60})
/home/linuxbrew/.linuxbrew/Cellar/go/1.21.5/libexec/src/testing/testing.go:1545 +0x238
testing.tRunner.func1()
/home/linuxbrew/.linuxbrew/Cellar/go/1.21.5/libexec/src/testing/testing.go:1548 +0x397
panic({0x1877a80?, 0x201da60?})
/home/linuxbrew/.linuxbrew/Cellar/go/1.21.5/libexec/src/runtime/panic.go:914 +0x21f
github.com/avaya/terratest-action.TestPanicTerraform(0xc000581380?)
/mnt/c/dev/GitHub/terratest-action/test/terraform_hello_world_test.go:117 +0x25
testing.tRunner(0xc000642680, 0x1c7e1b8)
/home/linuxbrew/.linuxbrew/Cellar/go/1.21.5/libexec/src/testing/testing.go:1595 +0xff
created by testing.(*T).Run in goroutine 1
/home/linuxbrew/.linuxbrew/Cellar/go/1.21.5/libexec/src/testing/testing.go:1648 +0x3ad
exit status 2
FAIL github.com/company/test 0.066s
- Create report.xml
go-junit-report < test_output.log > report.xml
will produce
<?xml version="1.0" encoding="UTF-8"?>
<testsuites tests="6" errors="1" failures="5">
<testsuite name="github.com/company/test" tests="6" failures="5" errors="1" id="0" hostname="foo" time="0.066" timestamp="2024-03-26T18:09:14Z">
<testcase name="TestPanicTerraform" classname="github.com/company/test" time="0.000">
<failure message="Failed"></failure>
</testcase>
<system-out><![CDATA[panic: This test has a panic [recovered]
panic: This test has a panic
goroutine 13 [running]:
testing.tRunner.func1.2({0x1877a80, 0x201da60})
/home/linuxbrew/.linuxbrew/Cellar/go/1.21.5/libexec/src/testing/testing.go:1545 +0x238
testing.tRunner.func1()
/home/linuxbrew/.linuxbrew/Cellar/go/1.21.5/libexec/src/testing/testing.go:1548 +0x397
panic({0x1877a80?, 0x201da60?})
/home/linuxbrew/.linuxbrew/Cellar/go/1.21.5/libexec/src/runtime/panic.go:914 +0x21f
github.com/company/test.TestPanicTerraform(0xc000581380?)
/mnt/c/dev/GitHub/terratest-action/test/terraform_hello_world_test.go:117 +0x25
testing.tRunner(0xc000642680, 0x1c7e1b8)
/home/linuxbrew/.linuxbrew/Cellar/go/1.21.5/libexec/src/testing/testing.go:1595 +0xff
created by testing.(*T).Run in goroutine 1
/home/linuxbrew/.linuxbrew/Cellar/go/1.21.5/libexec/src/testing/testing.go:1648 +0x3ad
exit status 2]]></system-out>
</testsuite>
</testsuites>
from go-junit-report.
Related Issues (20)
- after I use "go test xxx 2>&1 | go-junit-report > result.xml", then the console doesn't print any more information HOT 4
- go-junit-report is failing with command not found...
- `-version` info is "not as useful" as it may should've been HOT 1
- have an option to exclude succeeded tests
- zsh: command not found: go-junit-report HOT 4
- [no test files] Not handled well by set-exit-code HOT 1
- New release HOT 2
- False error report in case of json parsing HOT 1
- Include arm64 builds in release assets HOT 1
- gotest output from 1.20+ is not properly parsed
- `flag provided but not defined: -in` HOT 1
- go-junit-report reports success after failing to compile code HOT 1
- benchmark tests marked as error when no unit test found HOT 1
- Consider adding an option to prevent parsing lines starting with `#` as build output
- Better support of multiple test runs (`-count`)
- Linux arm64 binary missing HOT 3
- Capture test failures
- nested benchmarks are reported as failure
- How to enable coverage capture when used maxprocs
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from go-junit-report.