tstest, util/testenv: drop tstest's dependency on the testing package
Change tstest's exported functions (AssertNotParallel, Replace, Parallel, RequireRoot, SkipOnKernelVersions, MinAllocsPerRun, FixLogs, UnfixLogs, CheckIsZero, ResourceCheck) to take testenv.TB instead of testing.TB or *testing.T, so importing tstest from non-test code no longer links the testing package and its flag registration side effects into the binary. Add testenv.Verbose to replace the one use of testing.Verbose, and a deptest check to keep testing out of tstest's dependency graph. Callers are unaffected: *testing.T and testing.TB both satisfy testenv.TB. Updates tailscale/corp#45223 Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com> Change-Id: Ib373ff66ceff638d071582baf8367245987e9155
This commit is contained in:
committed by
Brad Fitzpatrick
parent
d11757863d
commit
3ccc7725a3
+3
-2
@@ -6,8 +6,9 @@ package tstest
|
||||
import (
|
||||
"net/netip"
|
||||
"reflect"
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
"tailscale.com/util/testenv"
|
||||
)
|
||||
|
||||
// IsZeroable is the interface for things with an IsZero method.
|
||||
@@ -30,7 +31,7 @@ var (
|
||||
// The nonzeroValues map should contain non-zero values for each type that
|
||||
// exists in the type T or any contained types. Basic types like string, bool,
|
||||
// and numeric types are handled automatically.
|
||||
func CheckIsZero[T IsZeroable](t testing.TB, nonzeroValues map[reflect.Type]any) {
|
||||
func CheckIsZero[T IsZeroable](t testenv.TB, nonzeroValues map[reflect.Type]any) {
|
||||
t.Helper()
|
||||
|
||||
var zero T
|
||||
|
||||
Reference in New Issue
Block a user