On Thu, Mar 9, 2023 at 5:55 AM 'Patrick Ohly' via golang-nuts
<golang-nuts@googlegroups.com> wrote:
>
> In Kubernetes, we have extensive infrastructure for collecting test failures. 
> For "go test" based tests (unit tests, integration tests) we use 
> gotest.tools/gotestsum to convert the output to a JUnit file for 
> post-processing.
>
> This approach has one drawback 
> (https://github.com/kubernetes/kubernetes/issues/116402): the entire output 
> of a failed tests is treated as the (in JUnit terminology) failure message. 
> In particular for integration tests that also includes normal log output. The 
> tool which triages failures then fails to detect that all of these test runs 
> failed for the same reason because the "failure message" is too different for 
> each run.
>
> My initial reaction was that we should modify our tests so that each 
> `t.Error` call uses a message with a unique prefix ("[FAILED]"). Then we 
> could identify those failures during post-processing.
>
> But this is going to be cumbersome to do and enforce, in particular when 
> there are additional third-party helpers involved. It would be much easier if 
> we could do `go test -failure-prefix [FAILED]` and then get that prefix 
> injected automatically into all calls which combine logging with `t.Fail`. 
> Would something like this be acceptable?
>
> I'm aware that a test could do `t.Log("I failed."); t.Fail()`. But this 
> should be rare and could be treated like it is now by the post-processing 
> (i.e. failure without a specific failure message).

Maybe I'm missing something, but I would expect that this general
class of things would be addressed via "go test -json", and a program
that parses the JSON output as you desire.

Ian

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/golang-nuts/CAOyqgcWxOAdh%3DggYDqCYENcN1XycMfrt2J97fvduow55boFoFw%40mail.gmail.com.

Reply via email to