tstest: rename from testy.

Signed-off-by: David Anderson <danderson@tailscale.com>
This commit is contained in:
David Anderson 2020-04-28 19:56:11 -07:00 committed by Dave Anderson
parent e1526b796e
commit 0038223632
8 changed files with 23 additions and 23 deletions

View File

@ -29,13 +29,13 @@
"github.com/klauspost/compress/zstd" "github.com/klauspost/compress/zstd"
"github.com/tailscale/wireguard-go/wgcfg" "github.com/tailscale/wireguard-go/wgcfg"
"tailscale.com/tailcfg" "tailscale.com/tailcfg"
"tailscale.com/testy" "tailscale.com/tstest"
"tailscale.io/control" // not yet released "tailscale.io/control" // not yet released
"tailscale.io/control/cfgdb" "tailscale.io/control/cfgdb"
) )
func TestTest(t *testing.T) { func TestTest(t *testing.T) {
check := testy.NewResourceCheck() check := tstest.NewResourceCheck()
defer check.Assert(t) defer check.Assert(t)
} }
@ -967,7 +967,7 @@ type server struct {
control *control.Server control *control.Server
http *httptest.Server http *httptest.Server
clients []*client clients []*client
check *testy.ResourceCheck check *tstest.ResourceCheck
segmentMsg chan map[string]interface{} segmentMsg chan map[string]interface{}
} }
@ -975,10 +975,10 @@ type server struct {
func newServer(t *testing.T) *server { func newServer(t *testing.T) *server {
t.Helper() t.Helper()
testy.FixLogs(t) tstest.FixLogs(t)
s := &server{ s := &server{
t: t, t: t,
check: testy.NewResourceCheck(), check: tstest.NewResourceCheck(),
segmentMsg: make(chan map[string]interface{}, 8), segmentMsg: make(chan map[string]interface{}, 8),
} }

View File

@ -21,7 +21,7 @@
"github.com/tailscale/wireguard-go/tun/tuntest" "github.com/tailscale/wireguard-go/tun/tuntest"
"tailscale.com/control/controlclient" "tailscale.com/control/controlclient"
"tailscale.com/tailcfg" "tailscale.com/tailcfg"
"tailscale.com/testy" "tailscale.com/tstest"
"tailscale.com/wgengine" "tailscale.com/wgengine"
"tailscale.com/wgengine/magicsock" "tailscale.com/wgengine/magicsock"
"tailscale.io/control" // not yet released "tailscale.io/control" // not yet released
@ -35,8 +35,8 @@ func init() {
} }
func TestIPN(t *testing.T) { func TestIPN(t *testing.T) {
testy.FixLogs(t) tstest.FixLogs(t)
defer testy.UnfixLogs(t) defer tstest.UnfixLogs(t)
// Turn off STUN for the test to make it hermitic. // Turn off STUN for the test to make it hermitic.
// TODO(crawshaw): add a test that runs against a local STUN server. // TODO(crawshaw): add a test that runs against a local STUN server.
@ -46,7 +46,7 @@ func TestIPN(t *testing.T) {
// TODO(apenwarr): Make resource checks actually pass. // TODO(apenwarr): Make resource checks actually pass.
// They don't right now, because (at least) wgengine doesn't fully // They don't right now, because (at least) wgengine doesn't fully
// shut down. // shut down.
// rc := testy.NewResourceCheck() // rc := tstest.NewResourceCheck()
// defer rc.Assert(t) // defer rc.Assert(t)
var ctl *control.Server var ctl *control.Server

View File

@ -9,14 +9,14 @@
"testing" "testing"
"time" "time"
"tailscale.com/testy" "tailscale.com/tstest"
) )
func TestReadWrite(t *testing.T) { func TestReadWrite(t *testing.T) {
testy.FixLogs(t) tstest.FixLogs(t)
defer testy.UnfixLogs(t) defer tstest.UnfixLogs(t)
rc := testy.NewResourceCheck() rc := tstest.NewResourceCheck()
defer rc.Assert(t) defer rc.Assert(t)
buf := bytes.Buffer{} buf := bytes.Buffer{}
@ -62,10 +62,10 @@ func TestReadWrite(t *testing.T) {
} }
func TestClientServer(t *testing.T) { func TestClientServer(t *testing.T) {
testy.FixLogs(t) tstest.FixLogs(t)
defer testy.UnfixLogs(t) defer tstest.UnfixLogs(t)
rc := testy.NewResourceCheck() rc := tstest.NewResourceCheck()
defer rc.Assert(t) defer rc.Assert(t)
b := &FakeBackend{} b := &FakeBackend{}

View File

@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style // Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file. // license that can be found in the LICENSE file.
package testy package tstest
import ( import (
"sync" "sync"

View File

@ -2,5 +2,5 @@
// Use of this source code is governed by a BSD-style // Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file. // license that can be found in the LICENSE file.
// Package testy provides utilities for use in unit tests. // Package tstest provides utilities for use in unit tests.
package testy package tstest

View File

@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style // Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file. // license that can be found in the LICENSE file.
package testy package tstest
import ( import (
"log" "log"

View File

@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style // Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file. // license that can be found in the LICENSE file.
package testy package tstest
import ( import (
"bytes" "bytes"

View File

@ -15,7 +15,7 @@
"time" "time"
"github.com/google/go-cmp/cmp" "github.com/google/go-cmp/cmp"
"tailscale.com/testy" "tailscale.com/tstest"
) )
type noopHijacker struct { type noopHijacker struct {
@ -63,7 +63,7 @@ func TestStdHandler(t *testing.T) {
testErr = errors.New("test error") testErr = errors.New("test error")
bgCtx = context.Background() bgCtx = context.Background()
// canceledCtx, cancel = context.WithCancel(bgCtx) // canceledCtx, cancel = context.WithCancel(bgCtx)
clock = testy.Clock{ clock = tstest.Clock{
Start: time.Now(), Start: time.Now(),
Step: time.Second, Step: time.Second,
} }