1
0
mirror of https://github.com/golang/go synced 2024-11-21 23:24:41 -07:00

internal/poll: replace t.Sub(time.Now()) with time.Until in test

Signed-off-by: guoguangwu <guoguangwug@gmail.com>
This commit is contained in:
guoguangwu 2024-03-18 15:29:36 +08:00
parent 0a6f05e30f
commit 5c7cbeb737

View File

@ -59,7 +59,7 @@ func TestSplicePipePool(t *testing.T) {
// Exploit the timeout of "go test" as a timer for the subsequent verification. // Exploit the timeout of "go test" as a timer for the subsequent verification.
timeout := 5 * time.Minute timeout := 5 * time.Minute
if deadline, ok := t.Deadline(); ok { if deadline, ok := t.Deadline(); ok {
timeout = deadline.Sub(time.Now()) timeout = time.Until(deadline)
timeout -= timeout / 10 // Leave 10% headroom for cleanup. timeout -= timeout / 10 // Leave 10% headroom for cleanup.
} }
expiredTime := time.NewTimer(timeout) expiredTime := time.NewTimer(timeout)