From 003822363206969fec75ec31090e2fadab77feca Mon Sep 17 00:00:00 2001 From: David Anderson Date: Tue, 28 Apr 2020 19:56:11 -0700 Subject: [PATCH] tstest: rename from testy. Signed-off-by: David Anderson --- control/controlclient/auto_test.go | 10 +++++----- ipn/e2e_test.go | 8 ++++---- ipn/message_test.go | 14 +++++++------- {testy => tstest}/clock.go | 2 +- {testy => tstest}/doc.go | 4 ++-- {testy => tstest}/log.go | 2 +- {testy => tstest}/resource.go | 2 +- tsweb/tsweb_test.go | 4 ++-- 8 files changed, 23 insertions(+), 23 deletions(-) rename {testy => tstest}/clock.go (98%) rename {testy => tstest}/doc.go (69%) rename {testy => tstest}/log.go (97%) rename {testy => tstest}/resource.go (99%) diff --git a/control/controlclient/auto_test.go b/control/controlclient/auto_test.go index 4ebd1eaac..f201fef4e 100644 --- a/control/controlclient/auto_test.go +++ b/control/controlclient/auto_test.go @@ -29,13 +29,13 @@ "github.com/klauspost/compress/zstd" "github.com/tailscale/wireguard-go/wgcfg" "tailscale.com/tailcfg" - "tailscale.com/testy" + "tailscale.com/tstest" "tailscale.io/control" // not yet released "tailscale.io/control/cfgdb" ) func TestTest(t *testing.T) { - check := testy.NewResourceCheck() + check := tstest.NewResourceCheck() defer check.Assert(t) } @@ -967,7 +967,7 @@ type server struct { control *control.Server http *httptest.Server clients []*client - check *testy.ResourceCheck + check *tstest.ResourceCheck segmentMsg chan map[string]interface{} } @@ -975,10 +975,10 @@ type server struct { func newServer(t *testing.T) *server { t.Helper() - testy.FixLogs(t) + tstest.FixLogs(t) s := &server{ t: t, - check: testy.NewResourceCheck(), + check: tstest.NewResourceCheck(), segmentMsg: make(chan map[string]interface{}, 8), } diff --git a/ipn/e2e_test.go b/ipn/e2e_test.go index 63d74e661..398ae0f71 100644 --- a/ipn/e2e_test.go +++ b/ipn/e2e_test.go @@ -21,7 +21,7 @@ "github.com/tailscale/wireguard-go/tun/tuntest" "tailscale.com/control/controlclient" "tailscale.com/tailcfg" - "tailscale.com/testy" + "tailscale.com/tstest" "tailscale.com/wgengine" "tailscale.com/wgengine/magicsock" "tailscale.io/control" // not yet released @@ -35,8 +35,8 @@ func init() { } func TestIPN(t *testing.T) { - testy.FixLogs(t) - defer testy.UnfixLogs(t) + tstest.FixLogs(t) + defer tstest.UnfixLogs(t) // Turn off STUN for the test to make it hermitic. // 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. // They don't right now, because (at least) wgengine doesn't fully // shut down. - // rc := testy.NewResourceCheck() + // rc := tstest.NewResourceCheck() // defer rc.Assert(t) var ctl *control.Server diff --git a/ipn/message_test.go b/ipn/message_test.go index 4559f1d4d..ced17d8e9 100644 --- a/ipn/message_test.go +++ b/ipn/message_test.go @@ -9,14 +9,14 @@ "testing" "time" - "tailscale.com/testy" + "tailscale.com/tstest" ) func TestReadWrite(t *testing.T) { - testy.FixLogs(t) - defer testy.UnfixLogs(t) + tstest.FixLogs(t) + defer tstest.UnfixLogs(t) - rc := testy.NewResourceCheck() + rc := tstest.NewResourceCheck() defer rc.Assert(t) buf := bytes.Buffer{} @@ -62,10 +62,10 @@ func TestReadWrite(t *testing.T) { } func TestClientServer(t *testing.T) { - testy.FixLogs(t) - defer testy.UnfixLogs(t) + tstest.FixLogs(t) + defer tstest.UnfixLogs(t) - rc := testy.NewResourceCheck() + rc := tstest.NewResourceCheck() defer rc.Assert(t) b := &FakeBackend{} diff --git a/testy/clock.go b/tstest/clock.go similarity index 98% rename from testy/clock.go rename to tstest/clock.go index 8608a69e2..71408f2bd 100644 --- a/testy/clock.go +++ b/tstest/clock.go @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. -package testy +package tstest import ( "sync" diff --git a/testy/doc.go b/tstest/doc.go similarity index 69% rename from testy/doc.go rename to tstest/doc.go index 13dc2fae3..72e63b7db 100644 --- a/testy/doc.go +++ b/tstest/doc.go @@ -2,5 +2,5 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. -// Package testy provides utilities for use in unit tests. -package testy +// Package tstest provides utilities for use in unit tests. +package tstest diff --git a/testy/log.go b/tstest/log.go similarity index 97% rename from testy/log.go rename to tstest/log.go index 43674afce..33e7bc439 100644 --- a/testy/log.go +++ b/tstest/log.go @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. -package testy +package tstest import ( "log" diff --git a/testy/resource.go b/tstest/resource.go similarity index 99% rename from testy/resource.go rename to tstest/resource.go index 2c12bb57d..245877e9f 100644 --- a/testy/resource.go +++ b/tstest/resource.go @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. -package testy +package tstest import ( "bytes" diff --git a/tsweb/tsweb_test.go b/tsweb/tsweb_test.go index 607439723..6b4dcaf28 100644 --- a/tsweb/tsweb_test.go +++ b/tsweb/tsweb_test.go @@ -15,7 +15,7 @@ "time" "github.com/google/go-cmp/cmp" - "tailscale.com/testy" + "tailscale.com/tstest" ) type noopHijacker struct { @@ -63,7 +63,7 @@ func TestStdHandler(t *testing.T) { testErr = errors.New("test error") bgCtx = context.Background() // canceledCtx, cancel = context.WithCancel(bgCtx) - clock = testy.Clock{ + clock = tstest.Clock{ Start: time.Now(), Step: time.Second, }