WIP: rebase fork onto upstream/main (v1.103.0) #15

Closed
codinget wants to merge 670 commits from webnet into save/webnet-2026-07-29
2 changed files with 26 additions and 0 deletions
Showing only changes of commit 4ad1243332 - Show all commits
+4
View File
@@ -8,6 +8,7 @@ package testenv
import (
"context"
"flag"
"io"
"tailscale.com/types/lazy"
)
@@ -23,6 +24,8 @@ func InTest() bool {
// TB is testing.TB, to avoid importing "testing" in non-test code.
type TB interface {
ArtifactDir() string
Attr(key, value string)
Cleanup(func())
Error(args ...any)
Errorf(format string, args ...any)
@@ -35,6 +38,7 @@ type TB interface {
Log(args ...any)
Logf(format string, args ...any)
Name() string
Output() io.Writer
Setenv(key, value string)
Chdir(dir string)
Skip(args ...any)
+22
View File
@@ -4,6 +4,7 @@
package testenv
import (
"reflect"
"testing"
"tailscale.com/tstest/deptest"
@@ -29,3 +30,24 @@ func TestInParallelTestFalse(t *testing.T) {
t.Fatal("InParallelTest should return false before t.Parallel has been called")
}
}
// TestMatchesTestingTB verifies that TB has every exported method of
// testing.TB, with matching signatures. It can't be a compile-time
// assertion because testing.TB has an unexported method.
func TestMatchesTestingTB(t *testing.T) {
want := reflect.TypeFor[testing.TB]()
got := reflect.TypeFor[TB]()
for m := range want.Methods() {
if m.PkgPath != "" {
continue // unexported
}
gm, ok := got.MethodByName(m.Name)
if !ok {
t.Errorf("TB lacks method %s%v", m.Name, m.Type)
continue
}
if gm.Type != m.Type {
t.Errorf("TB method %s has type %v; want %v", m.Name, gm.Type, m.Type)
}
}
}