-
Notifications
You must be signed in to change notification settings - Fork 18.4k
Open
Labels
NeedsFixThe path to resolution is known, but the work has not been done.The path to resolution is known, but the work has not been done.
Milestone
Description
The testing package silently drops t.Log messages that are made by a goroutine after the test has completed. For example, the following test passes and logs nothing.
This should be fixed by extending the code added in 1.12 that panics if a goroutine logs after a test has completed to not silently discard the log message. The silent discarding is occurring in the current code because every test runs in a parent context, and the output accumulated by the parent context is discarded.
package main
import (
"testing"
"time"
)
func TestLateLog(t *testing.T) {
c := make(chan bool)
go func() {
<-c
time.Sleep(time.Millisecond)
t.Log("log after test")
}()
close(c)
}Metadata
Metadata
Assignees
Labels
NeedsFixThe path to resolution is known, but the work has not been done.The path to resolution is known, but the work has not been done.