net/portmapper: fix test flakes from logging after test done

Fixes #15794

Change-Id: Ic22aa99acb10fdb6dc5f0b6482e722e48237703c
Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
This commit is contained in:
Brad Fitzpatrick
2025-04-25 14:56:18 -07:00
committed by Brad Fitzpatrick
parent 66371f392a
commit 189e03e741
5 changed files with 17 additions and 13 deletions

View File

@@ -13,6 +13,7 @@ import (
"go4.org/mem"
"tailscale.com/types/logger"
"tailscale.com/util/testenv"
)
type testLogWriter struct {
@@ -149,7 +150,7 @@ func (ml *MemLogger) String() string {
// WhileTestRunningLogger returns a logger.Logf that logs to t.Logf until the
// test finishes, at which point it no longer logs anything.
func WhileTestRunningLogger(t testing.TB) logger.Logf {
func WhileTestRunningLogger(t testenv.TB) logger.Logf {
var (
mu sync.RWMutex
done bool