Skip to content

Commit

Permalink
Skip pass actions if no test name is present (#8)
Browse files Browse the repository at this point in the history
Go test json may produce output like:

{"Time":"2021-10-07T15:05:01.541387-05:00","Action":"pass","Package":"github.com/example/package","Elapsed":0.023}

Instead of returning from the goroutine and hanging go-test-trace, just
skip it.
  • Loading branch information
willgorman authored Oct 12, 2021
1 parent 1df66a7 commit 732baad
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -62,14 +62,14 @@ $ go test -v ./example | go-test-trace -stdin
You can export to any collector by using the endpoint flag:

```
$ go-test-trace ./example -endpoint=my-otel-collector.io:9090
$ go-test-trace -endpoint=my-otel-collector.io:9090 ./example
```

You can make the go-test-trace to participate into an existing
trace with the traceparent flag.

```
$ go-test-trace ./example -traceparent=00-0af7651916cd43dd8448eb211c80319c-b7ad6b7169203331-01
$ go-test-trace -traceparent=00-0af7651916cd43dd8448eb211c80319c-b7ad6b7169203331-01 ./example
```

## Running the collector
Expand Down
3 changes: 3 additions & 0 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,9 @@ func trace(args []string) error {
startTime: data.Time,
}
case "pass", "fail", "skip":
if data.Test == "" {
continue
}
spanData, ok := collectedSpans[data.Test]
if !ok {
return // should never happen
Expand Down

0 comments on commit 732baad

Please sign in to comment.