ref: Rename test.InitForTest to test.V23Init
The test.Init function remains unchanged.
Change-Id: Ic3838daea7a5d57bf4efe34b6a6d5e446c835ae0
MultiPart: 2/3
diff --git a/cmd/mounttable/impl_test.go b/cmd/mounttable/impl_test.go
index cc46ed1..5bc59cf 100644
--- a/cmd/mounttable/impl_test.go
+++ b/cmd/mounttable/impl_test.go
@@ -113,7 +113,7 @@
}
func TestMountTableClient(t *testing.T) {
- ctx, shutdown := test.InitForTest()
+ ctx, shutdown := test.V23Init()
defer shutdown()
server, endpoint, err := startServer(t, ctx)
diff --git a/cmd/vdl/arith_test.go b/cmd/vdl/arith_test.go
index 4a1e6b5..f5769b6 100644
--- a/cmd/vdl/arith_test.go
+++ b/cmd/vdl/arith_test.go
@@ -108,7 +108,7 @@
}
func TestCalculator(t *testing.T) {
- ctx, shutdown := test.InitForTest()
+ ctx, shutdown := test.V23Init()
defer shutdown()
server := newServer(ctx)
@@ -281,7 +281,7 @@
}
func TestArith(t *testing.T) {
- ctx, shutdown := test.InitForTest()
+ ctx, shutdown := test.V23Init()
defer shutdown()
// TODO(bprosnitz) Split this test up -- it is quite long and hard to debug.
diff --git a/cmd/vrpc/vrpc_test.go b/cmd/vrpc/vrpc_test.go
index 4ff920f..5fc6067 100644
--- a/cmd/vrpc/vrpc_test.go
+++ b/cmd/vrpc/vrpc_test.go
@@ -117,7 +117,7 @@
}
func initTest(t *testing.T) (ctx *context.T, name string, shutdown v23.Shutdown) {
- ctx, shutdown = test.InitForTest()
+ ctx, shutdown = test.V23Init()
rpcServer, err := v23.NewServer(ctx)
if err != nil {
diff --git a/examples/rps/rpsbot/impl_test.go b/examples/rps/rpsbot/impl_test.go
index 831f067..ec531e2 100644
--- a/examples/rps/rpsbot/impl_test.go
+++ b/examples/rps/rpsbot/impl_test.go
@@ -88,7 +88,7 @@
// TestRockPaperScissorsImpl runs one rock-paper-scissors game and verifies
// that all the counters are consistent.
func TestRockPaperScissorsImpl(t *testing.T) {
- ctx, shutdown := test.InitForTest()
+ ctx, shutdown := test.V23Init()
defer shutdown()
sh, err := modules.NewShell(ctx, nil, testing.Verbose(), t)
diff --git a/lib/signals/signals_test.go b/lib/signals/signals_test.go
index aa0ed90..63b0097 100644
--- a/lib/signals/signals_test.go
+++ b/lib/signals/signals_test.go
@@ -45,7 +45,7 @@
}
func program(stdin io.Reader, stdout io.Writer, signals ...os.Signal) {
- ctx, shutdown := test.InitForTest()
+ ctx, shutdown := test.V23Init()
closeStopLoop := make(chan struct{})
go stopLoop(v23.GetAppCycle(ctx).Stop, stdin, closeStopLoop)
wait := ShutdownOnSignals(ctx, signals...)
@@ -71,7 +71,7 @@
}, "handleCustomWithStop")
var handleDefaultsIgnoreChan = modules.Register(func(env *modules.Env, args ...string) error {
- ctx, shutdown := test.InitForTest()
+ ctx, shutdown := test.V23Init()
defer shutdown()
closeStopLoop := make(chan struct{})
@@ -120,7 +120,7 @@
// TestCleanShutdownSignal verifies that sending a signal to a child that
// handles it by default causes the child to shut down cleanly.
func TestCleanShutdownSignal(t *testing.T) {
- ctx, shutdown := test.InitForTest()
+ ctx, shutdown := test.V23Init()
defer shutdown()
sh, h := newShell(t, ctx, handleDefaults)
@@ -136,7 +136,7 @@
// TestCleanShutdownStop verifies that sending a stop comamnd to a child that
// handles stop commands by default causes the child to shut down cleanly.
func TestCleanShutdownStop(t *testing.T) {
- ctx, shutdown := test.InitForTest()
+ ctx, shutdown := test.V23Init()
defer shutdown()
sh, h := newShell(t, ctx, handleDefaults)
@@ -153,7 +153,7 @@
// that handles stop command as part of a custom set of signals handled, causes
// the child to shut down cleanly.
func TestCleanShutdownStopCustom(t *testing.T) {
- ctx, shutdown := test.InitForTest()
+ ctx, shutdown := test.V23Init()
defer shutdown()
sh, h := newShell(t, ctx, handleCustomWithStop)
@@ -177,7 +177,7 @@
// TestStopNoHandler verifies that sending a stop command to a child that does
// not handle stop commands causes the child to exit immediately.
func TestStopNoHandler(t *testing.T) {
- ctx, shutdown := test.InitForTest()
+ ctx, shutdown := test.V23Init()
defer shutdown()
sh, h := newShell(t, ctx, handleCustom)
@@ -191,7 +191,7 @@
// that handles these signals by default causes the child to exit immediately
// upon receiving the second signal.
func TestDoubleSignal(t *testing.T) {
- ctx, shutdown := test.InitForTest()
+ ctx, shutdown := test.V23Init()
defer shutdown()
sh, h := newShell(t, ctx, handleDefaults)
@@ -209,7 +209,7 @@
// to a child that handles these by default causes the child to exit immediately
// upon receiving the stop command.
func TestSignalAndStop(t *testing.T) {
- ctx, shutdown := test.InitForTest()
+ ctx, shutdown := test.V23Init()
defer shutdown()
sh, h := newShell(t, ctx, handleDefaults)
@@ -226,7 +226,7 @@
// that handles stop commands by default causes the child to exit immediately
// upon receiving the second stop command.
func TestDoubleStop(t *testing.T) {
- ctx, shutdown := test.InitForTest()
+ ctx, shutdown := test.V23Init()
defer shutdown()
sh, h := newShell(t, ctx, handleDefaults)
@@ -241,7 +241,7 @@
// TestSendUnhandledSignal verifies that sending a signal that the child does
// not handle causes the child to exit as per the signal being sent.
func TestSendUnhandledSignal(t *testing.T) {
- ctx, shutdown := test.InitForTest()
+ ctx, shutdown := test.V23Init()
defer shutdown()
sh, h := newShell(t, ctx, handleDefaults)
@@ -257,7 +257,7 @@
// process to exit (ensures that there is no dependency in ShutdownOnSignals
// on having a goroutine read from the returned channel).
func TestDoubleSignalIgnoreChan(t *testing.T) {
- ctx, shutdown := test.InitForTest()
+ ctx, shutdown := test.V23Init()
defer shutdown()
sh, h := newShell(t, ctx, handleDefaultsIgnoreChan)
@@ -275,7 +275,7 @@
// TestHandlerCustomSignal verifies that sending a non-default signal to a
// server that listens for that signal causes the server to shut down cleanly.
func TestHandlerCustomSignal(t *testing.T) {
- ctx, shutdown := test.InitForTest()
+ ctx, shutdown := test.V23Init()
defer shutdown()
sh, h := newShell(t, ctx, handleCustom)
@@ -292,7 +292,7 @@
// to a server that listens for that signal causes the server to shut down
// cleanly, even when a STOP signal is also among the handled signals.
func TestHandlerCustomSignalWithStop(t *testing.T) {
- rootCtx, shutdown := test.InitForTest()
+ rootCtx, shutdown := test.V23Init()
defer shutdown()
for _, signal := range []syscall.Signal{syscall.SIGABRT, syscall.SIGHUP} {
@@ -353,7 +353,7 @@
// TestCleanRemoteShutdown verifies that remote shutdown works correctly.
func TestCleanRemoteShutdown(t *testing.T) {
- ctx, shutdown := test.InitForTest()
+ ctx, shutdown := test.V23Init()
defer shutdown()
sh, err := modules.NewShell(ctx, nil, testing.Verbose(), t)
diff --git a/runtime/internal/naming/namespace/all_test.go b/runtime/internal/naming/namespace/all_test.go
index fd269d5..7153c39 100644
--- a/runtime/internal/naming/namespace/all_test.go
+++ b/runtime/internal/naming/namespace/all_test.go
@@ -32,7 +32,7 @@
//go:generate v23 test generate
func createContexts(t *testing.T) (sc, c *context.T, cleanup func()) {
- ctx, shutdown := test.InitForTest()
+ ctx, shutdown := test.V23Init()
var (
err error
psc = testutil.NewPrincipal("sc")
diff --git a/runtime/internal/naming/namespace/perms_test.go b/runtime/internal/naming/namespace/perms_test.go
index 3a0c916..c083758 100644
--- a/runtime/internal/naming/namespace/perms_test.go
+++ b/runtime/internal/naming/namespace/perms_test.go
@@ -27,7 +27,7 @@
}
func initTest() (rootCtx *context.T, aliceCtx *context.T, bobCtx *context.T, shutdown v23.Shutdown) {
- ctx, shutdown := test.InitForTest()
+ ctx, shutdown := test.V23Init()
var err error
if rootCtx, err = v23.WithPrincipal(ctx, testutil.NewPrincipal("root")); err != nil {
panic("failed to set root principal")
diff --git a/runtime/internal/rpc/benchmark/benchmark_test.go b/runtime/internal/rpc/benchmark/benchmark_test.go
index fe41273..5d98e34 100644
--- a/runtime/internal/rpc/benchmark/benchmark_test.go
+++ b/runtime/internal/rpc/benchmark/benchmark_test.go
@@ -110,7 +110,7 @@
// We do not use defer here since this program will exit at the end of
// this function through os.Exit().
var shutdown v23.Shutdown
- ctx, shutdown = test.InitForTest()
+ ctx, shutdown = test.V23Init()
var serverStop func()
serverEP, serverStop := internal.StartServer(ctx, v23.GetListenSpec(ctx))
diff --git a/runtime/internal/rpc/benchmark/glob/glob_test.go b/runtime/internal/rpc/benchmark/glob/glob_test.go
index 44454b9..3bb9c31 100644
--- a/runtime/internal/rpc/benchmark/glob/glob_test.go
+++ b/runtime/internal/rpc/benchmark/glob/glob_test.go
@@ -159,7 +159,7 @@
}
func RunBenchmarkGlob(b *testing.B, obj interface{}) {
- ctx, shutdown := test.InitForTest()
+ ctx, shutdown := test.V23Init()
defer shutdown()
addr, stop, err := startServer(b, ctx, obj)
diff --git a/runtime/internal/rpc/benchmark/simple/main.go b/runtime/internal/rpc/benchmark/simple/main.go
index b5ba01c..6806775 100644
--- a/runtime/internal/rpc/benchmark/simple/main.go
+++ b/runtime/internal/rpc/benchmark/simple/main.go
@@ -121,7 +121,7 @@
test.Init()
var shutdown v23.Shutdown
- ctx, shutdown = test.InitForTest()
+ ctx, shutdown = test.V23Init()
defer shutdown()
var serverStop func()
diff --git a/runtime/internal/rpc/stream/manager/error_test.go b/runtime/internal/rpc/stream/manager/error_test.go
index 4c61f49..a2fbf01 100644
--- a/runtime/internal/rpc/stream/manager/error_test.go
+++ b/runtime/internal/rpc/stream/manager/error_test.go
@@ -94,7 +94,7 @@
}
func TestDialErrors(t *testing.T) {
- _, shutdown := test.InitForTest()
+ _, shutdown := test.V23Init()
defer shutdown()
server := manager.InternalNew(naming.FixedRoutingID(0x55555555))
client := manager.InternalNew(naming.FixedRoutingID(0xcccccccc))
diff --git a/runtime/internal/rpc/stream/proxy/proxy_test.go b/runtime/internal/rpc/stream/proxy/proxy_test.go
index a438489..f583e9f 100644
--- a/runtime/internal/rpc/stream/proxy/proxy_test.go
+++ b/runtime/internal/rpc/stream/proxy/proxy_test.go
@@ -482,7 +482,7 @@
}
func v23Init() (*context.T, func()) {
- ctx, shutdown := test.InitForTest()
+ ctx, shutdown := test.V23Init()
ctx, err := v23.WithPrincipal(ctx, testutil.NewPrincipal("proxy"))
if err != nil {
panic(err)
diff --git a/runtime/internal/rpc/test/client_test.go b/runtime/internal/rpc/test/client_test.go
index 2f0157f..8c2e994 100644
--- a/runtime/internal/rpc/test/client_test.go
+++ b/runtime/internal/rpc/test/client_test.go
@@ -143,7 +143,7 @@
}, "echoClient")
func newCtx() (*context.T, v23.Shutdown) {
- ctx, shutdown := test.InitForTest()
+ ctx, shutdown := test.V23Init()
v23.GetNamespace(ctx).CacheCtl(naming.DisableCache(true))
return ctx, shutdown
}
@@ -508,7 +508,7 @@
}
var childPing = modules.Register(func(env *modules.Env, args ...string) error {
- ctx, shutdown := test.InitForTest()
+ ctx, shutdown := test.V23Init()
defer shutdown()
v23.GetNamespace(ctx).CacheCtl(naming.DisableCache(true))
@@ -577,7 +577,7 @@
}
func TestAccessDenied(t *testing.T) {
- ctx, shutdown := test.InitForTest()
+ ctx, shutdown := test.V23Init()
defer shutdown()
name, fn := initServer(t, ctx)
@@ -805,7 +805,7 @@
// endpoint).
func TestReconnect(t *testing.T) {
t.Skip()
- ctx, shutdown := test.InitForTest()
+ ctx, shutdown := test.V23Init()
defer shutdown()
sh, err := modules.NewShell(ctx, v23.GetPrincipal(ctx), testing.Verbose(), t)
diff --git a/runtime/internal/rpc/test/glob_test.go b/runtime/internal/rpc/test/glob_test.go
index 7e5bd43..471b6f2 100644
--- a/runtime/internal/rpc/test/glob_test.go
+++ b/runtime/internal/rpc/test/glob_test.go
@@ -42,7 +42,7 @@
}
func TestGlob(t *testing.T) {
- ctx, shutdown := test.InitForTest()
+ ctx, shutdown := test.V23Init()
defer shutdown()
namespace := []string{
@@ -203,7 +203,7 @@
}
func TestGlobDeny(t *testing.T) {
- ctx, shutdown := test.InitForTest()
+ ctx, shutdown := test.V23Init()
defer shutdown()
tree := newNode()
diff --git a/runtime/internal/rpc/test/signature_test.go b/runtime/internal/rpc/test/signature_test.go
index 480bd77..f6197c0 100644
--- a/runtime/internal/rpc/test/signature_test.go
+++ b/runtime/internal/rpc/test/signature_test.go
@@ -60,7 +60,7 @@
}
func TestMethodSignature(t *testing.T) {
- ctx, shutdown := test.InitForTest()
+ ctx, shutdown := test.V23Init()
defer shutdown()
ep, stop, err := startSigServer(ctx, sigImpl{})
if err != nil {
@@ -106,7 +106,7 @@
}
func TestSignature(t *testing.T) {
- ctx, shutdown := test.InitForTest()
+ ctx, shutdown := test.V23Init()
defer shutdown()
ep, stop, err := startSigServer(ctx, sigImpl{})
if err != nil {
diff --git a/runtime/internal/rpc/testutil_test.go b/runtime/internal/rpc/testutil_test.go
index 4f298dc..9a2e8f3 100644
--- a/runtime/internal/rpc/testutil_test.go
+++ b/runtime/internal/rpc/testutil_test.go
@@ -79,7 +79,7 @@
}
func initForTest() (*context.T, v23.Shutdown) {
- ctx, shutdown := test.InitForTest()
+ ctx, shutdown := test.V23Init()
ctx, err := ivtrace.Init(ctx, flags.VtraceFlags{})
if err != nil {
panic(err)
diff --git a/runtime/internal/rt/ipc_test.go b/runtime/internal/rt/ipc_test.go
index 0bbd0ef..f14549f 100644
--- a/runtime/internal/rt/ipc_test.go
+++ b/runtime/internal/rt/ipc_test.go
@@ -99,7 +99,7 @@
}
func TestClientServerBlessings(t *testing.T) {
- ctx, shutdown := test.InitForTest()
+ ctx, shutdown := test.V23Init()
defer shutdown()
var (
@@ -179,7 +179,7 @@
}
func TestServerEndpointBlessingNames(t *testing.T) {
- ctx, shutdown := test.InitForTest()
+ ctx, shutdown := test.V23Init()
defer shutdown()
ctx, _ = v23.WithPrincipal(ctx, testutil.NewPrincipal("default"))
@@ -272,7 +272,7 @@
}
func TestServerDischarges(t *testing.T) {
- ctx, shutdown := test.InitForTest()
+ ctx, shutdown := test.V23Init()
defer shutdown()
var (
diff --git a/runtime/internal/rt/mgmt_test.go b/runtime/internal/rt/mgmt_test.go
index 428b733..0a0d49d 100644
--- a/runtime/internal/rt/mgmt_test.go
+++ b/runtime/internal/rt/mgmt_test.go
@@ -32,7 +32,7 @@
// TestBasic verifies that the basic plumbing works: LocalStop calls result in
// stop messages being sent on the channel passed to WaitForStop.
func TestBasic(t *testing.T) {
- ctx, shutdown := test.InitForTest()
+ ctx, shutdown := test.V23Init()
defer shutdown()
m := v23.GetAppCycle(ctx)
@@ -54,7 +54,7 @@
// TestMultipleWaiters verifies that the plumbing works with more than one
// registered wait channel.
func TestMultipleWaiters(t *testing.T) {
- ctx, shutdown := test.InitForTest()
+ ctx, shutdown := test.V23Init()
defer shutdown()
m := v23.GetAppCycle(ctx)
@@ -77,7 +77,7 @@
// channel is not being drained: once the channel's buffer fills up, future
// Stops become no-ops.
func TestMultipleStops(t *testing.T) {
- ctx, shutdown := test.InitForTest()
+ ctx, shutdown := test.V23Init()
defer shutdown()
m := v23.GetAppCycle(ctx)
@@ -97,7 +97,7 @@
}
var noWaiters = modules.Register(func(env *modules.Env, args ...string) error {
- ctx, shutdown := test.InitForTest()
+ ctx, shutdown := test.V23Init()
defer shutdown()
m := v23.GetAppCycle(ctx)
@@ -128,7 +128,7 @@
}
var forceStop = modules.Register(func(env *modules.Env, args ...string) error {
- ctx, shutdown := test.InitForTest()
+ ctx, shutdown := test.V23Init()
defer shutdown()
m := v23.GetAppCycle(ctx)
@@ -177,7 +177,7 @@
// TestProgress verifies that the ticker update/track logic works for a single
// tracker.
func TestProgress(t *testing.T) {
- ctx, shutdown := test.InitForTest()
+ ctx, shutdown := test.V23Init()
m := v23.GetAppCycle(ctx)
m.AdvanceGoal(50)
@@ -209,7 +209,7 @@
// works for more than one tracker. It also ensures that the runtime doesn't
// block when the tracker channels are full.
func TestProgressMultipleTrackers(t *testing.T) {
- ctx, shutdown := test.InitForTest()
+ ctx, shutdown := test.V23Init()
m := v23.GetAppCycle(ctx)
// ch1 is 1-buffered, ch2 is 2-buffered.
@@ -244,7 +244,7 @@
}
var app = modules.Register(func(env *modules.Env, args ...string) error {
- ctx, shutdown := test.InitForTest()
+ ctx, shutdown := test.V23Init()
defer shutdown()
m := v23.GetAppCycle(ctx)
@@ -289,7 +289,7 @@
}
func setupRemoteAppCycleMgr(t *testing.T) (*context.T, modules.Handle, appcycle.AppCycleClientMethods, func()) {
- ctx, shutdown := test.InitForTest()
+ ctx, shutdown := test.V23Init()
configServer, configServiceName, ch := createConfigServer(t, ctx)
sh, err := modules.NewShell(ctx, v23.GetPrincipal(ctx), testing.Verbose(), t)
diff --git a/runtime/internal/rt/rt_test.go b/runtime/internal/rt/rt_test.go
index 2b49ef7..b3b3e29 100644
--- a/runtime/internal/rt/rt_test.go
+++ b/runtime/internal/rt/rt_test.go
@@ -53,7 +53,7 @@
}
var child = modules.Register(func(env *modules.Env, args ...string) error {
- _, shutdown := test.InitForTest()
+ _, shutdown := test.V23Init()
defer shutdown()
logger := vlog.Log
@@ -121,7 +121,7 @@
}
var principal = modules.Register(func(env *modules.Env, args ...string) error {
- ctx, shutdown := test.InitForTest()
+ ctx, shutdown := test.V23Init()
defer shutdown()
p := v23.GetPrincipal(ctx)
@@ -135,7 +135,7 @@
// Runner runs a principal as a subprocess and reports back with its
// own security info and it's childs.
var runner = modules.Register(func(env *modules.Env, args ...string) error {
- ctx, shutdown := test.InitForTest()
+ ctx, shutdown := test.V23Init()
defer shutdown()
p := v23.GetPrincipal(ctx)
@@ -233,7 +233,7 @@
}
defer sh.Cleanup(os.Stderr, os.Stderr)
- ctx, shutdown := test.InitForTest()
+ ctx, shutdown := test.V23Init()
defer shutdown()
agentSh, err := modules.NewShell(ctx, v23.GetPrincipal(ctx), testing.Verbose(), t)
diff --git a/runtime/internal/rt/shutdown_servers_test.go b/runtime/internal/rt/shutdown_servers_test.go
index c0713e5..38dd5e3 100644
--- a/runtime/internal/rt/shutdown_servers_test.go
+++ b/runtime/internal/rt/shutdown_servers_test.go
@@ -70,7 +70,7 @@
// For a more typical server, see simpleServerProgram.
var complexServerProgram = modules.Register(func(env *modules.Env, args ...string) error {
// Initialize the runtime. This is boilerplate.
- ctx, shutdown := test.InitForTest()
+ ctx, shutdown := test.V23Init()
// shutdown is optional, but it's a good idea to clean up, especially
// since it takes care of flushing the logs before exiting.
defer shutdown()
@@ -212,7 +212,7 @@
// complexServerProgram.
var simpleServerProgram = modules.Register(func(env *modules.Env, args ...string) error {
// Initialize the runtime. This is boilerplate.
- ctx, shutdown := test.InitForTest()
+ ctx, shutdown := test.V23Init()
// Calling shutdown is optional, but it's a good idea to clean up, especially
// since it takes care of flushing the logs before exiting.
//
diff --git a/runtime/internal/rt/signal_test.go b/runtime/internal/rt/signal_test.go
index 7027071..7d7c466 100644
--- a/runtime/internal/rt/signal_test.go
+++ b/runtime/internal/rt/signal_test.go
@@ -28,7 +28,7 @@
}
var withRuntime = modules.Register(func(env *modules.Env, args ...string) error {
- _, shutdown := test.InitForTest()
+ _, shutdown := test.V23Init()
defer shutdown()
simpleEchoProgram(env.Stdin, env.Stdout)
diff --git a/runtime/internal/testing/mocks/mocknet/mocknet_test.go b/runtime/internal/testing/mocks/mocknet/mocknet_test.go
index ccf1cf9..f038325 100644
--- a/runtime/internal/testing/mocks/mocknet/mocknet_test.go
+++ b/runtime/internal/testing/mocks/mocknet/mocknet_test.go
@@ -325,7 +325,7 @@
}
func newCtx() (*context.T, v23.Shutdown) {
- ctx, shutdown := test.InitForTest()
+ ctx, shutdown := test.V23Init()
v23.GetNamespace(ctx).CacheCtl(naming.DisableCache(true))
return ctx, shutdown
}
diff --git a/runtime/internal/vtrace/vtrace_test.go b/runtime/internal/vtrace/vtrace_test.go
index 38e3df5..1df4195 100644
--- a/runtime/internal/vtrace/vtrace_test.go
+++ b/runtime/internal/vtrace/vtrace_test.go
@@ -35,7 +35,7 @@
// initForTest initializes the vtrace runtime and starts a mounttable.
func initForTest(t *testing.T) (*context.T, v23.Shutdown, *testutil.IDProvider) {
idp := testutil.NewIDProvider("base")
- ctx, shutdown := test.InitForTest()
+ ctx, shutdown := test.V23Init()
if err := idp.Bless(v23.GetPrincipal(ctx), "alice"); err != nil {
t.Fatalf("Could not bless initial principal %v", err)
}
diff --git a/services/agent/agentlib/agent_test.go b/services/agent/agentlib/agent_test.go
index 65b6f3d..46170bf 100644
--- a/services/agent/agentlib/agent_test.go
+++ b/services/agent/agentlib/agent_test.go
@@ -43,7 +43,7 @@
//go:generate v23 test generate
var getPrincipalAndHang = modules.Register(func(env *modules.Env, args ...string) error {
- ctx, shutdown := test.InitForTest()
+ ctx, shutdown := test.V23Init()
defer shutdown()
p := v23.GetPrincipal(ctx)
@@ -97,7 +97,7 @@
}
func TestAgent(t *testing.T) {
- ctx, shutdown := test.InitForTest()
+ ctx, shutdown := test.V23Init()
defer shutdown()
var (
@@ -156,7 +156,7 @@
}
func TestAgentShutdown(t *testing.T) {
- ctx, shutdown := test.InitForTest()
+ ctx, shutdown := test.V23Init()
// This starts an agent
sh, err := modules.NewShell(ctx, nil, testing.Verbose(), t)
@@ -234,73 +234,73 @@
}
func BenchmarkSignNoAgent(b *testing.B) {
- ctx, shutdown := test.InitForTest()
+ ctx, shutdown := test.V23Init()
defer shutdown()
runSignBenchmark(b, v23.GetPrincipal(ctx))
}
func BenchmarkSignCachedAgent(b *testing.B) {
- ctx, shutdown := test.InitForTest()
+ ctx, shutdown := test.V23Init()
defer shutdown()
runSignBenchmark(b, setupAgent(ctx, true))
}
func BenchmarkSignUncachedAgent(b *testing.B) {
- ctx, shutdown := test.InitForTest()
+ ctx, shutdown := test.V23Init()
defer shutdown()
runSignBenchmark(b, setupAgent(ctx, false))
}
func BenchmarkDefaultNoAgent(b *testing.B) {
- ctx, shutdown := test.InitForTest()
+ ctx, shutdown := test.V23Init()
defer shutdown()
runDefaultBenchmark(b, v23.GetPrincipal(ctx))
}
func BenchmarkDefaultCachedAgent(b *testing.B) {
- ctx, shutdown := test.InitForTest()
+ ctx, shutdown := test.V23Init()
defer shutdown()
runDefaultBenchmark(b, setupAgent(ctx, true))
}
func BenchmarkDefaultUncachedAgent(b *testing.B) {
- ctx, shutdown := test.InitForTest()
+ ctx, shutdown := test.V23Init()
defer shutdown()
runDefaultBenchmark(b, setupAgent(ctx, false))
}
func BenchmarkRecognizedNegativeNoAgent(b *testing.B) {
- ctx, shutdown := test.InitForTest()
+ ctx, shutdown := test.V23Init()
defer shutdown()
runRecognizedNegativeBenchmark(b, v23.GetPrincipal(ctx))
}
func BenchmarkRecognizedNegativeCachedAgent(b *testing.B) {
- ctx, shutdown := test.InitForTest()
+ ctx, shutdown := test.V23Init()
defer shutdown()
runRecognizedNegativeBenchmark(b, setupAgent(ctx, true))
}
func BenchmarkRecognizedNegativeUncachedAgent(b *testing.B) {
- ctx, shutdown := test.InitForTest()
+ ctx, shutdown := test.V23Init()
defer shutdown()
runRecognizedNegativeBenchmark(b, setupAgent(ctx, false))
}
func BenchmarkRecognizedNoAgent(b *testing.B) {
- ctx, shutdown := test.InitForTest()
+ ctx, shutdown := test.V23Init()
defer shutdown()
runRecognizedBenchmark(b, v23.GetPrincipal(ctx))
}
func BenchmarkRecognizedCachedAgent(b *testing.B) {
- ctx, shutdown := test.InitForTest()
+ ctx, shutdown := test.V23Init()
defer shutdown()
runRecognizedBenchmark(b, setupAgent(ctx, true))
}
func BenchmarkRecognizedUncachedAgent(b *testing.B) {
- ctx, shutdown := test.InitForTest()
+ ctx, shutdown := test.V23Init()
defer shutdown()
runRecognizedBenchmark(b, setupAgent(ctx, false))
}
diff --git a/services/agent/keymgr/keymgr_test.go b/services/agent/keymgr/keymgr_test.go
index bbe20be..dd0a334 100644
--- a/services/agent/keymgr/keymgr_test.go
+++ b/services/agent/keymgr/keymgr_test.go
@@ -44,7 +44,7 @@
}
func TestNoDeviceManager(t *testing.T) {
- ctx, shutdown := test.InitForTest()
+ ctx, shutdown := test.V23Init()
defer shutdown()
agent, cleanup, err := createAgent(ctx, "")
@@ -80,7 +80,7 @@
}
func TestSigning(t *testing.T) {
- ctx, shutdown := test.InitForTest()
+ ctx, shutdown := test.V23Init()
defer shutdown()
path, err := ioutil.TempDir("", "agent")
@@ -147,7 +147,7 @@
}
func TestInMemorySigning(t *testing.T) {
- ctx, shutdown := test.InitForTest()
+ ctx, shutdown := test.V23Init()
defer shutdown()
path, err := ioutil.TempDir("", "agent")
diff --git a/services/application/application/impl_test.go b/services/application/application/impl_test.go
index 8f7a084..676676a 100644
--- a/services/application/application/impl_test.go
+++ b/services/application/application/impl_test.go
@@ -146,7 +146,7 @@
}
func TestApplicationClient(t *testing.T) {
- ctx, shutdown := test.InitForTest()
+ ctx, shutdown := test.V23Init()
defer shutdown()
server, endpoint, err := startServer(t, ctx)
diff --git a/services/application/applicationd/impl_test.go b/services/application/applicationd/impl_test.go
index aa53303..7284d8a 100644
--- a/services/application/applicationd/impl_test.go
+++ b/services/application/applicationd/impl_test.go
@@ -41,7 +41,7 @@
// TestInterface tests that the implementation correctly implements
// the Application interface.
func TestInterface(t *testing.T) {
- ctx, shutdown := test.InitForTest()
+ ctx, shutdown := test.V23Init()
defer shutdown()
dir, prefix := "", ""
@@ -230,7 +230,7 @@
}
func TestPreserveAcrossRestarts(t *testing.T) {
- ctx, shutdown := test.InitForTest()
+ ctx, shutdown := test.V23Init()
defer shutdown()
dir, prefix := "", ""
diff --git a/services/application/applicationd/perms_test.go b/services/application/applicationd/perms_test.go
index 720b64b..ad04614 100644
--- a/services/application/applicationd/perms_test.go
+++ b/services/application/applicationd/perms_test.go
@@ -36,7 +36,7 @@
publishName := args[0]
storedir := args[1]
- ctx, shutdown := test.InitForTest()
+ ctx, shutdown := test.V23Init()
defer shutdown()
v23.GetNamespace(ctx).CacheCtl(naming.DisableCache(true))
@@ -64,7 +64,7 @@
}, "appRepository")
func TestApplicationUpdatePermissions(t *testing.T) {
- ctx, shutdown := test.InitForTest()
+ ctx, shutdown := test.V23Init()
defer shutdown()
v23.GetNamespace(ctx).CacheCtl(naming.DisableCache(true))
@@ -210,7 +210,7 @@
}
func TestPerAppPermissions(t *testing.T) {
- ctx, shutdown := test.InitForTest()
+ ctx, shutdown := test.V23Init()
defer shutdown()
v23.GetNamespace(ctx).CacheCtl(naming.DisableCache(true))
// By default, all principals in this test will have blessings generated based
diff --git a/services/binary/binary/impl_test.go b/services/binary/binary/impl_test.go
index 36a5c01..e4dc1a6 100644
--- a/services/binary/binary/impl_test.go
+++ b/services/binary/binary/impl_test.go
@@ -127,7 +127,7 @@
}
func TestBinaryClient(t *testing.T) {
- ctx, shutdown := test.InitForTest()
+ ctx, shutdown := test.V23Init()
defer shutdown()
server, endpoint, err := startServer(t, ctx)
diff --git a/services/build/build/impl_test.go b/services/build/build/impl_test.go
index c37c367..64c1479 100644
--- a/services/build/build/impl_test.go
+++ b/services/build/build/impl_test.go
@@ -70,7 +70,7 @@
}
func TestBuildClient(t *testing.T) {
- ctx, shutdown := test.InitForTest()
+ ctx, shutdown := test.V23Init()
defer shutdown()
server, endpoint := startServer(ctx, t)
diff --git a/services/build/buildd/impl_test.go b/services/build/buildd/impl_test.go
index dacf6eb..6956828 100644
--- a/services/build/buildd/impl_test.go
+++ b/services/build/buildd/impl_test.go
@@ -142,7 +142,7 @@
// TestSuccess checks that the build server successfully builds a
// package that depends on the standard Go library.
func TestSuccess(t *testing.T) {
- ctx, shutdown := test.InitForTest()
+ ctx, shutdown := test.V23Init()
defer shutdown()
client := startServer(t, ctx)
@@ -177,7 +177,7 @@
// TestEmpty checks that the build server successfully builds a
// package that does not produce a binary.
func TestEmpty(t *testing.T) {
- ctx, shutdown := test.InitForTest()
+ ctx, shutdown := test.V23Init()
defer shutdown()
client := startServer(t, ctx)
@@ -212,7 +212,7 @@
// TestFailure checks that the build server fails to build a package
// consisting of an empty file.
func TestFailure(t *testing.T) {
- ctx, shutdown := test.InitForTest()
+ ctx, shutdown := test.V23Init()
defer shutdown()
client := startServer(t, ctx)
diff --git a/services/debug/debuglib/dispatcher_test.go b/services/debug/debuglib/dispatcher_test.go
index d5879fb..5bcd18c 100644
--- a/services/debug/debuglib/dispatcher_test.go
+++ b/services/debug/debuglib/dispatcher_test.go
@@ -57,7 +57,7 @@
}
func TestDebugServer(t *testing.T) {
- ctx, shutdown := test.InitForTest()
+ ctx, shutdown := test.V23Init()
defer shutdown()
tracedContext := func(ctx *context.T) *context.T {
diff --git a/services/device/device/acl_test.go b/services/device/device/acl_test.go
index 1a12227..4ad61bc 100644
--- a/services/device/device/acl_test.go
+++ b/services/device/device/acl_test.go
@@ -28,7 +28,7 @@
)
func TestAccessListGetCommand(t *testing.T) {
- ctx, shutdown := test.InitForTest()
+ ctx, shutdown := test.V23Init()
defer shutdown()
tapes := newTapeMap()
@@ -76,7 +76,7 @@
}
func TestAccessListSetCommand(t *testing.T) {
- ctx, shutdown := test.InitForTest()
+ ctx, shutdown := test.V23Init()
defer shutdown()
tapes := newTapeMap()
diff --git a/services/device/device/impl_test.go b/services/device/device/impl_test.go
index db1bd97..49471c1 100644
--- a/services/device/device/impl_test.go
+++ b/services/device/device/impl_test.go
@@ -29,7 +29,7 @@
//go:generate v23 test generate
func TestListCommand(t *testing.T) {
- ctx, shutdown := test.InitForTest()
+ ctx, shutdown := test.V23Init()
defer shutdown()
tapes := newTapeMap()
@@ -83,7 +83,7 @@
}
func TestAddCommand(t *testing.T) {
- ctx, shutdown := test.InitForTest()
+ ctx, shutdown := test.V23Init()
defer shutdown()
tapes := newTapeMap()
@@ -135,7 +135,7 @@
}
func TestRemoveCommand(t *testing.T) {
- ctx, shutdown := test.InitForTest()
+ ctx, shutdown := test.V23Init()
defer shutdown()
tapes := newTapeMap()
@@ -174,7 +174,7 @@
}
func TestInstallCommand(t *testing.T) {
- ctx, shutdown := test.InitForTest()
+ ctx, shutdown := test.V23Init()
defer shutdown()
tapes := newTapeMap()
@@ -283,7 +283,7 @@
}
func TestClaimCommand(t *testing.T) {
- ctx, shutdown := test.InitForTest()
+ ctx, shutdown := test.V23Init()
defer shutdown()
tapes := newTapeMap()
@@ -377,7 +377,7 @@
}
func TestInstantiateCommand(t *testing.T) {
- ctx, shutdown := test.InitForTest()
+ ctx, shutdown := test.V23Init()
defer shutdown()
tapes := newTapeMap()
@@ -456,7 +456,7 @@
}
func TestDebugCommand(t *testing.T) {
- ctx, shutdown := test.InitForTest()
+ ctx, shutdown := test.V23Init()
defer shutdown()
tapes := newTapeMap()
server, endpoint, err := startServer(t, ctx, tapes)
@@ -508,7 +508,7 @@
)
func TestStatusCommand(t *testing.T) {
- ctx, shutdown := test.InitForTest()
+ ctx, shutdown := test.V23Init()
defer shutdown()
tapes := newTapeMap()
server, endpoint, err := startServer(t, ctx, tapes)
diff --git a/services/device/device/instance_impl_test.go b/services/device/device/instance_impl_test.go
index 1397cca..4201c6b 100644
--- a/services/device/device/instance_impl_test.go
+++ b/services/device/device/instance_impl_test.go
@@ -21,7 +21,7 @@
)
func TestKillCommand(t *testing.T) {
- ctx, shutdown := test.InitForTest()
+ ctx, shutdown := test.V23Init()
defer shutdown()
tapes := newTapeMap()
@@ -90,7 +90,7 @@
}
func testHelper(t *testing.T, lower, upper string) {
- ctx, shutdown := test.InitForTest()
+ ctx, shutdown := test.V23Init()
defer shutdown()
tapes := newTapeMap()
diff --git a/services/device/device/local_install_test.go b/services/device/device/local_install_test.go
index e3880e7..f3e938c 100644
--- a/services/device/device/local_install_test.go
+++ b/services/device/device/local_install_test.go
@@ -33,7 +33,7 @@
}
func TestInstallLocalCommand(t *testing.T) {
- ctx, shutdown := test.InitForTest()
+ ctx, shutdown := test.V23Init()
defer shutdown()
tapes := newTapeMap()
diff --git a/services/device/device/ls_test.go b/services/device/device/ls_test.go
index 9ceefd0..238a545 100644
--- a/services/device/device/ls_test.go
+++ b/services/device/device/ls_test.go
@@ -22,7 +22,7 @@
// glob functionality, by trying out various combinations of
// instances/installations in glob results.
func TestLsCommand(t *testing.T) {
- ctx, shutdown := test.InitForTest()
+ ctx, shutdown := test.V23Init()
defer shutdown()
tapes := newTapeMap()
server, endpoint, err := startServer(t, ctx, tapes)
diff --git a/services/device/internal/impl/applife/app_life_test.go b/services/device/internal/impl/applife/app_life_test.go
index efdef51..1c469ad 100644
--- a/services/device/internal/impl/applife/app_life_test.go
+++ b/services/device/internal/impl/applife/app_life_test.go
@@ -57,7 +57,7 @@
// TestLifeOfAnApp installs an app, instantiates, runs, kills, and deletes
// several instances, and performs updates.
func TestLifeOfAnApp(t *testing.T) {
- ctx, shutdown := utiltest.InitForTest()
+ ctx, shutdown := utiltest.V23Init()
defer shutdown()
sh, deferFn := servicetest.CreateShellAndMountTable(t, ctx, nil)
diff --git a/services/device/internal/impl/globsuid/glob_test.go b/services/device/internal/impl/globsuid/glob_test.go
index 1d6a04d..dfa826d 100644
--- a/services/device/internal/impl/globsuid/glob_test.go
+++ b/services/device/internal/impl/globsuid/glob_test.go
@@ -15,7 +15,7 @@
)
func TestDeviceManagerGlobAndDebug(t *testing.T) {
- ctx, shutdown := utiltest.InitForTest()
+ ctx, shutdown := utiltest.V23Init()
defer shutdown()
sh, deferFn := servicetest.CreateShellAndMountTable(t, ctx, nil)
diff --git a/services/device/internal/impl/globsuid/signature_match_test.go b/services/device/internal/impl/globsuid/signature_match_test.go
index aedb942..fa79511 100644
--- a/services/device/internal/impl/globsuid/signature_match_test.go
+++ b/services/device/internal/impl/globsuid/signature_match_test.go
@@ -26,7 +26,7 @@
)
func TestDownloadSignatureMatch(t *testing.T) {
- ctx, shutdown := utiltest.InitForTest()
+ ctx, shutdown := utiltest.V23Init()
defer shutdown()
sh, deferFn := servicetest.CreateShellAndMountTable(t, ctx, nil)
diff --git a/services/device/internal/impl/globsuid/suid_test.go b/services/device/internal/impl/globsuid/suid_test.go
index 313b720..de99a2f 100644
--- a/services/device/internal/impl/globsuid/suid_test.go
+++ b/services/device/internal/impl/globsuid/suid_test.go
@@ -38,7 +38,7 @@
}
func TestAppWithSuidHelper(t *testing.T) {
- ctx, shutdown := utiltest.InitForTest()
+ ctx, shutdown := utiltest.V23Init()
defer shutdown()
// Identity provider used to ensure that all processes recognize each
diff --git a/services/device/internal/impl/impl_test.go b/services/device/internal/impl/impl_test.go
index ef302f3..d40787d 100644
--- a/services/device/internal/impl/impl_test.go
+++ b/services/device/internal/impl/impl_test.go
@@ -74,7 +74,7 @@
// command. Further versions are running through the soft link that the device
// manager itself updates.
func TestDeviceManagerUpdateAndRevert(t *testing.T) {
- ctx, shutdown := utiltest.InitForTest()
+ ctx, shutdown := utiltest.V23Init()
defer shutdown()
sh, deferFn := servicetest.CreateShellAndMountTable(t, ctx, v23.GetPrincipal(ctx))
@@ -292,7 +292,7 @@
// This should bring up a functioning device manager. In the end it runs
// Uninstall and verifies that the installation is gone.
func TestDeviceManagerInstallation(t *testing.T) {
- ctx, shutdown := utiltest.InitForTest()
+ ctx, shutdown := utiltest.V23Init()
defer shutdown()
sh, deferFn := servicetest.CreateShellAndMountTable(t, ctx, nil)
@@ -354,7 +354,7 @@
// TODO(caprita): We need better test coverage for how updating/reverting apps
// affects the package configured for the app.
func TestDeviceManagerPackages(t *testing.T) {
- ctx, shutdown := utiltest.InitForTest()
+ ctx, shutdown := utiltest.V23Init()
defer shutdown()
sh, deferFn := servicetest.CreateShellAndMountTable(t, ctx, nil)
@@ -494,7 +494,7 @@
// TODO(rjkroege): Verify that associations persist across restarts once
// permanent storage is added.
func TestAccountAssociation(t *testing.T) {
- ctx, shutdown := utiltest.InitForTest()
+ ctx, shutdown := utiltest.V23Init()
defer shutdown()
sh, deferFn := servicetest.CreateShellAndMountTable(t, ctx, nil)
diff --git a/services/device/internal/impl/perms/perms_test.go b/services/device/internal/impl/perms/perms_test.go
index 166de49..821301b 100644
--- a/services/device/internal/impl/perms/perms_test.go
+++ b/services/device/internal/impl/perms/perms_test.go
@@ -26,7 +26,7 @@
// TestDeviceManagerClaim claims a devicemanager and tests AccessList permissions on
// its methods.
func TestDeviceManagerClaim(t *testing.T) {
- ctx, shutdown := utiltest.InitForTest()
+ ctx, shutdown := utiltest.V23Init()
defer shutdown()
// root blessing provider so that the principals of all the contexts
@@ -110,7 +110,7 @@
}
func TestDeviceManagerUpdateAccessList(t *testing.T) {
- ctx, shutdown := utiltest.InitForTest()
+ ctx, shutdown := utiltest.V23Init()
defer shutdown()
// Identity provider to ensure that all processes recognize each
diff --git a/services/device/internal/impl/proxy_invoker_test.go b/services/device/internal/impl/proxy_invoker_test.go
index 8cb7bf7..ad4a8aa 100644
--- a/services/device/internal/impl/proxy_invoker_test.go
+++ b/services/device/internal/impl/proxy_invoker_test.go
@@ -23,7 +23,7 @@
// TODO(toddw): Add tests of Signature and MethodSignature.
func TestProxyInvoker(t *testing.T) {
- ctx, shutdown := test.InitForTest()
+ ctx, shutdown := test.V23Init()
defer shutdown()
v23.GetNamespace(ctx).CacheCtl(naming.DisableCache(true))
diff --git a/services/device/internal/impl/utiltest/app.go b/services/device/internal/impl/utiltest/app.go
index bc194c9..7ef524b 100644
--- a/services/device/internal/impl/utiltest/app.go
+++ b/services/device/internal/impl/utiltest/app.go
@@ -115,7 +115,7 @@
var App = modules.Register(appFunc, "App")
func appFunc(env *modules.Env, args ...string) error {
- ctx, shutdown := test.InitForTest()
+ ctx, shutdown := test.V23Init()
defer shutdown()
v23.GetNamespace(ctx).CacheCtl(naming.DisableCache(true))
diff --git a/services/device/internal/impl/utiltest/helpers.go b/services/device/internal/impl/utiltest/helpers.go
index 498c05b..cab2204 100644
--- a/services/device/internal/impl/utiltest/helpers.go
+++ b/services/device/internal/impl/utiltest/helpers.go
@@ -509,7 +509,7 @@
// TODO(rjkroege): This helper is generally useful. Use it to reduce
// boiler plate across all device manager tests.
func StartupHelper(t *testing.T) (func(), *context.T, *modules.Shell, *application.Envelope, string, string, *testutil.IDProvider) {
- ctx, shutdown := test.InitForTest()
+ ctx, shutdown := test.V23Init()
v23.GetNamespace(ctx).CacheCtl(naming.DisableCache(true))
// Make a new identity context.
@@ -700,12 +700,12 @@
return u.Username
}
-func InitForTest() (*context.T, v23.Shutdown) {
+func V23Init() (*context.T, v23.Shutdown) {
roots, _ := ref.EnvNamespaceRoots()
for key, _ := range roots {
os.Unsetenv(key)
}
- ctx, shutdown := test.InitForTest()
+ ctx, shutdown := test.V23Init()
v23.GetNamespace(ctx).CacheCtl(naming.DisableCache(true))
return ctx, shutdown
}
diff --git a/services/device/internal/impl/utiltest/modules.go b/services/device/internal/impl/utiltest/modules.go
index 13656e3..84f1d00 100644
--- a/services/device/internal/impl/utiltest/modules.go
+++ b/services/device/internal/impl/utiltest/modules.go
@@ -59,7 +59,7 @@
var DeviceManager = modules.Register(deviceManagerFunc, "DeviceManager")
func deviceManagerFunc(env *modules.Env, args ...string) error {
- ctx, shutdown := test.InitForTest()
+ ctx, shutdown := test.V23Init()
if len(args) == 0 {
vlog.Fatalf("deviceManager expected at least an argument")
}
diff --git a/services/identity/internal/revocation/revocation_test.go b/services/identity/internal/revocation/revocation_test.go
index 0b07b0c..662af26 100644
--- a/services/identity/internal/revocation/revocation_test.go
+++ b/services/identity/internal/revocation/revocation_test.go
@@ -42,7 +42,7 @@
}
func TestDischargeRevokeDischargeRevokeDischarge(t *testing.T) {
- ctx, shutdown := test.InitForTest()
+ ctx, shutdown := test.V23Init()
defer shutdown()
dcKey, dc, revoker, closeFunc := revokerSetup(t, ctx)
diff --git a/services/internal/binarylib/client_test.go b/services/internal/binarylib/client_test.go
index 2d91162..255dad4 100644
--- a/services/internal/binarylib/client_test.go
+++ b/services/internal/binarylib/client_test.go
@@ -83,7 +83,7 @@
// TestBufferAPI tests the binary repository client-side library
// interface using buffers.
func TestBufferAPI(t *testing.T) {
- ctx, shutdown := test.InitForTest()
+ ctx, shutdown := test.V23Init()
defer shutdown()
v23.GetNamespace(ctx).CacheCtl(naming.DisableCache(true))
@@ -127,7 +127,7 @@
// TestFileAPI tests the binary repository client-side library
// interface using files.
func TestFileAPI(t *testing.T) {
- ctx, shutdown := test.InitForTest()
+ ctx, shutdown := test.V23Init()
defer shutdown()
v23.GetNamespace(ctx).CacheCtl(naming.DisableCache(true))
@@ -184,7 +184,7 @@
// TestDownloadUrl tests the binary repository client-side library
// DownloadUrl method.
func TestDownloadUrl(t *testing.T) {
- ctx, shutdown := test.InitForTest()
+ ctx, shutdown := test.V23Init()
defer shutdown()
v23.GetNamespace(ctx).CacheCtl(naming.DisableCache(true))
diff --git a/services/internal/binarylib/http_test.go b/services/internal/binarylib/http_test.go
index 60968c7..77f0f2d 100644
--- a/services/internal/binarylib/http_test.go
+++ b/services/internal/binarylib/http_test.go
@@ -23,7 +23,7 @@
// TestHTTP checks that HTTP download works.
func TestHTTP(t *testing.T) {
- ctx, shutdown := test.InitForTest()
+ ctx, shutdown := test.V23Init()
defer shutdown()
v23.GetNamespace(ctx).CacheCtl(naming.DisableCache(true))
diff --git a/services/internal/binarylib/impl_test.go b/services/internal/binarylib/impl_test.go
index 21ebb2a..93bbb35 100644
--- a/services/internal/binarylib/impl_test.go
+++ b/services/internal/binarylib/impl_test.go
@@ -77,7 +77,7 @@
// all possible valid values of the depth used for the directory
// hierarchy that stores binary objects in the local file system.
func TestHierarchy(t *testing.T) {
- ctx, shutdown := test.InitForTest()
+ ctx, shutdown := test.V23Init()
defer shutdown()
v23.GetNamespace(ctx).CacheCtl(naming.DisableCache(true))
@@ -131,7 +131,7 @@
// uploads and downloads ranging the number of parts the test binary
// consists of.
func TestMultiPart(t *testing.T) {
- ctx, shutdown := test.InitForTest()
+ ctx, shutdown := test.V23Init()
defer shutdown()
v23.GetNamespace(ctx).CacheCtl(naming.DisableCache(true))
@@ -185,7 +185,7 @@
// resumption ranging the number of parts the uploaded binary consists
// of.
func TestResumption(t *testing.T) {
- ctx, shutdown := test.InitForTest()
+ ctx, shutdown := test.V23Init()
defer shutdown()
v23.GetNamespace(ctx).CacheCtl(naming.DisableCache(true))
@@ -232,7 +232,7 @@
// TestErrors checks that the binary interface correctly reports errors.
func TestErrors(t *testing.T) {
- ctx, shutdown := test.InitForTest()
+ ctx, shutdown := test.V23Init()
defer shutdown()
v23.GetNamespace(ctx).CacheCtl(naming.DisableCache(true))
@@ -299,7 +299,7 @@
}
func TestGlob(t *testing.T) {
- ctx, shutdown := test.InitForTest()
+ ctx, shutdown := test.V23Init()
defer shutdown()
v23.GetNamespace(ctx).CacheCtl(naming.DisableCache(true))
diff --git a/services/internal/binarylib/perms_test.go b/services/internal/binarylib/perms_test.go
index 0b2e978..80b5307 100644
--- a/services/internal/binarylib/perms_test.go
+++ b/services/internal/binarylib/perms_test.go
@@ -37,7 +37,7 @@
publishName := args[0]
storedir := args[1]
- ctx, shutdown := test.InitForTest()
+ ctx, shutdown := test.V23Init()
defer fmt.Fprintf(env.Stdout, "%v terminating\n", publishName)
defer vlog.VI(1).Infof("%v terminating", publishName)
@@ -84,7 +84,7 @@
}
func TestBinaryCreateAccessList(t *testing.T) {
- ctx, shutdown := test.InitForTest()
+ ctx, shutdown := test.V23Init()
defer shutdown()
v23.GetNamespace(ctx).CacheCtl(naming.DisableCache(true))
@@ -139,7 +139,7 @@
}
func TestBinaryRootAccessList(t *testing.T) {
- ctx, shutdown := test.InitForTest()
+ ctx, shutdown := test.V23Init()
defer shutdown()
v23.GetNamespace(ctx).CacheCtl(naming.DisableCache(true))
@@ -423,7 +423,7 @@
}
func TestBinaryRationalStartingValueForGetPermissions(t *testing.T) {
- ctx, shutdown := test.InitForTest()
+ ctx, shutdown := test.V23Init()
defer shutdown()
v23.GetNamespace(ctx).CacheCtl(naming.DisableCache(true))
diff --git a/services/internal/logreaderlib/logfile_test.go b/services/internal/logreaderlib/logfile_test.go
index 3f74b34..ca3dd6e 100644
--- a/services/internal/logreaderlib/logfile_test.go
+++ b/services/internal/logreaderlib/logfile_test.go
@@ -67,7 +67,7 @@
}
func TestReadLogImplNoFollow(t *testing.T) {
- ctx, shutdown := test.InitForTest()
+ ctx, shutdown := test.V23Init()
defer shutdown()
workdir, err := ioutil.TempDir("", "logreadertest")
@@ -154,7 +154,7 @@
}
func TestReadLogImplWithFollow(t *testing.T) {
- ctx, shutdown := test.InitForTest()
+ ctx, shutdown := test.V23Init()
defer shutdown()
workdir, err := ioutil.TempDir("", "logreadertest")
diff --git a/services/internal/pproflib/proxy_test.go b/services/internal/pproflib/proxy_test.go
index b277b89..6f30246 100644
--- a/services/internal/pproflib/proxy_test.go
+++ b/services/internal/pproflib/proxy_test.go
@@ -29,7 +29,7 @@
}
func TestPProfProxy(t *testing.T) {
- ctx, shutdown := test.InitForTest()
+ ctx, shutdown := test.V23Init()
defer shutdown()
s, err := v23.NewServer(ctx)
@@ -56,10 +56,11 @@
"/pprof/profile?seconds=1",
"/pprof/heap",
"/pprof/goroutine",
- fmt.Sprintf("/pprof/symbol?%#x", TestPProfProxy),
+ fmt.Sprintf("/pprof/symbol?%p", TestPProfProxy),
}
for _, c := range testcases {
url := "http://" + l.Addr().String() + c
+ t.Log(url)
resp, err := http.Get(url)
if err != nil {
t.Fatalf("http.Get failed: %v", err)
diff --git a/services/internal/statslib/stats_test.go b/services/internal/statslib/stats_test.go
index d8d4ff3..9e38a73 100644
--- a/services/internal/statslib/stats_test.go
+++ b/services/internal/statslib/stats_test.go
@@ -57,7 +57,7 @@
}
func TestStatsImpl(t *testing.T) {
- ctx, shutdown := test.InitForTest()
+ ctx, shutdown := test.V23Init()
defer shutdown()
endpoint, stop := startServer(t, ctx)
diff --git a/services/internal/vtracelib/vtrace_test.go b/services/internal/vtracelib/vtrace_test.go
index 93deb05..5eb8a82 100644
--- a/services/internal/vtracelib/vtrace_test.go
+++ b/services/internal/vtracelib/vtrace_test.go
@@ -20,7 +20,7 @@
//go:generate v23 test generate
func TestVtraceServer(t *testing.T) {
- ctx, shutdown := test.InitForTest()
+ ctx, shutdown := test.V23Init()
defer shutdown()
server, err := v23.NewServer(ctx)
diff --git a/services/mounttable/mounttablelib/mounttable_test.go b/services/mounttable/mounttablelib/mounttable_test.go
index 1a07339..a8f9e7f 100644
--- a/services/mounttable/mounttablelib/mounttable_test.go
+++ b/services/mounttable/mounttablelib/mounttable_test.go
@@ -396,7 +396,7 @@
}
func TestGlob(t *testing.T) {
- rootCtx, shutdown := test.InitForTest()
+ rootCtx, shutdown := test.V23Init()
defer shutdown()
server, estr := newMT(t, "", "", "testGlob", rootCtx)
@@ -549,7 +549,7 @@
}
func TestCleanup(t *testing.T) {
- rootCtx, shutdown := test.InitForTest()
+ rootCtx, shutdown := test.V23Init()
defer shutdown()
server, estr := newMT(t, "", "", "testCleanup", rootCtx)
@@ -604,7 +604,7 @@
}
func TestServerFormat(t *testing.T) {
- rootCtx, shutdown := test.InitForTest()
+ rootCtx, shutdown := test.V23Init()
defer shutdown()
server, estr := newMT(t, "", "", "testerverFormat", rootCtx)
@@ -618,7 +618,7 @@
}
func TestExpiry(t *testing.T) {
- rootCtx, shutdown := test.InitForTest()
+ rootCtx, shutdown := test.V23Init()
defer shutdown()
server, estr := newMT(t, "", "", "testExpiry", rootCtx)
@@ -683,7 +683,7 @@
}
func TestStatsCounters(t *testing.T) {
- rootCtx, shutdown := test.InitForTest()
+ rootCtx, shutdown := test.V23Init()
defer shutdown()
ft := NewFakeTimeClock()
@@ -817,7 +817,7 @@
func initTest() (rootCtx *context.T, aliceCtx *context.T, bobCtx *context.T, shutdown v23.Shutdown) {
test.Init()
- ctx, shutdown := test.InitForTest()
+ ctx, shutdown := test.V23Init()
var err error
if rootCtx, err = v23.WithPrincipal(ctx, testutil.NewPrincipal("root")); err != nil {
panic("failed to set root principal")
diff --git a/services/mounttable/mounttablelib/neighborhood_test.go b/services/mounttable/mounttablelib/neighborhood_test.go
index a8d67d8..4225985 100644
--- a/services/mounttable/mounttablelib/neighborhood_test.go
+++ b/services/mounttable/mounttablelib/neighborhood_test.go
@@ -31,7 +31,7 @@
}
func TestNeighborhood(t *testing.T) {
- rootCtx, shutdown := test.InitForTest()
+ rootCtx, shutdown := test.V23Init()
defer shutdown()
vlog.Infof("TestNeighborhood")
diff --git a/services/profile/profile/impl_test.go b/services/profile/profile/impl_test.go
index cf2b402..7ac0fcb 100644
--- a/services/profile/profile/impl_test.go
+++ b/services/profile/profile/impl_test.go
@@ -117,7 +117,7 @@
}
func TestProfileClient(t *testing.T) {
- ctx, shutdown := test.InitForTest()
+ ctx, shutdown := test.V23Init()
defer shutdown()
server, endpoint, err := startServer(t, ctx)
diff --git a/services/profile/profiled/impl_test.go b/services/profile/profiled/impl_test.go
index a981873..133c88a 100644
--- a/services/profile/profiled/impl_test.go
+++ b/services/profile/profiled/impl_test.go
@@ -36,7 +36,7 @@
// TestInterface tests that the implementation correctly implements
// the Profile interface.
func TestInterface(t *testing.T) {
- ctx, shutdown := test.InitForTest()
+ ctx, shutdown := test.V23Init()
defer shutdown()
// Setup and start the profile repository server.
@@ -114,7 +114,7 @@
}
func TestPreserveAcrossRestarts(t *testing.T) {
- ctx, shutdown := test.InitForTest()
+ ctx, shutdown := test.V23Init()
defer shutdown()
// Setup and start the profile repository server.
diff --git a/services/wspr/internal/app/app_test.go b/services/wspr/internal/app/app_test.go
index ae7bf91..4550e58 100644
--- a/services/wspr/internal/app/app_test.go
+++ b/services/wspr/internal/app/app_test.go
@@ -130,7 +130,7 @@
}
func TestGetGoServerSignature(t *testing.T) {
- ctx, shutdown := test.InitForTest()
+ ctx, shutdown := test.V23Init()
defer shutdown()
s, endpoint, err := startAdderServer(ctx)
@@ -173,7 +173,7 @@
}
func runGoServerTestCase(t *testing.T, testCase goServerTestCase) {
- ctx, shutdown := test.InitForTest()
+ ctx, shutdown := test.V23Init()
defer shutdown()
s, endpoint, err := startAdderServer(ctx)
@@ -384,7 +384,7 @@
}
func runJsServerTestCase(t *testing.T, testCase jsServerTestCase) {
- ctx, shutdown := test.InitForTest()
+ ctx, shutdown := test.V23Init()
defer shutdown()
vomClientStream := []string{}
diff --git a/services/wspr/internal/browspr/browspr_account_test.go b/services/wspr/internal/browspr/browspr_account_test.go
index eccef39..ff35bbf 100644
--- a/services/wspr/internal/browspr/browspr_account_test.go
+++ b/services/wspr/internal/browspr/browspr_account_test.go
@@ -43,7 +43,7 @@
}
func setup(t *testing.T) (*Browspr, func()) {
- ctx, shutdown := test.InitForTest()
+ ctx, shutdown := test.V23Init()
spec := v23.GetListenSpec(ctx)
spec.Proxy = "/mock/proxy"
diff --git a/services/wspr/internal/browspr/browspr_test.go b/services/wspr/internal/browspr/browspr_test.go
index 5a69168..03c108f 100644
--- a/services/wspr/internal/browspr/browspr_test.go
+++ b/services/wspr/internal/browspr/browspr_test.go
@@ -79,7 +79,7 @@
}
func TestBrowspr(t *testing.T) {
- ctx, shutdown := test.InitForTest()
+ ctx, shutdown := test.V23Init()
defer shutdown()
proxySpec := rpc.ListenSpec{
diff --git a/services/wspr/internal/lib/signature_manager_test.go b/services/wspr/internal/lib/signature_manager_test.go
index 94a0b43..7e50213 100644
--- a/services/wspr/internal/lib/signature_manager_test.go
+++ b/services/wspr/internal/lib/signature_manager_test.go
@@ -22,7 +22,7 @@
)
func initContext(t *testing.T) (*context.T, clientWithTimesCalled, v23.Shutdown) {
- ctx, shutdown := test.InitForTest()
+ ctx, shutdown := test.V23Init()
initialSig := []signature.Interface{
{
Methods: []signature.Method{
diff --git a/test/doc.go b/test/doc.go
index cb84f2b..206164e 100644
--- a/test/doc.go
+++ b/test/doc.go
@@ -14,11 +14,10 @@
// os.Exit(m.Run())
// }
//
-// InitForTest can be used within test functions as a safe alternative
-// to v23.Init.
+// V23Init can be used within test functions as a safe alternative to v23.Init.
//
// func TestFoo(t *testing.T) {
-// ctx, shutdown := test.InitForTest()
+// ctx, shutdown := test.V23Init()
// defer shutdown()
// ...
// }
diff --git a/test/init.go b/test/init.go
index f01b1df..395cab7 100644
--- a/test/init.go
+++ b/test/init.go
@@ -63,11 +63,11 @@
once.Do(init)
}
-// InitForTest initializes a new context.T and sets a freshly created principal
+// V23Init initializes a new context.T and sets a freshly created principal
// (with a single self-signed blessing) on it. The principal setting step is
// skipped if this function is invoked from a process run using the modules
// package.
-func InitForTest() (*context.T, v23.Shutdown) {
+func V23Init() (*context.T, v23.Shutdown) {
ctx, shutdown := v23.Init()
if len(os.Getenv("V23_SHELL_HELPER_PROCESS_ENTRY_POINT")) != 0 {
return ctx, shutdown
diff --git a/test/modules/examples_test.go b/test/modules/examples_test.go
index b5b66b1..18d05a4 100644
--- a/test/modules/examples_test.go
+++ b/test/modules/examples_test.go
@@ -28,7 +28,7 @@
return
}
// Parent process spawns the echo program.
- ctx, shutdown := test.InitForTest()
+ ctx, shutdown := test.V23Init()
defer shutdown()
sh, _ := modules.NewShell(ctx, nil, false, nil)
defer sh.Cleanup(nil, nil)
@@ -43,7 +43,7 @@
// Child process dispatches to the echo program.
modules.DispatchAndExitIfChild()
// Parent process spawns the echo program.
- ctx, shutdown := test.InitForTest()
+ ctx, shutdown := test.V23Init()
defer shutdown()
sh, _ := modules.NewShell(ctx, nil, false, nil)
defer sh.Cleanup(nil, nil)
diff --git a/test/modules/modules_test.go b/test/modules/modules_test.go
index 183aec6..117b4e4 100644
--- a/test/modules/modules_test.go
+++ b/test/modules/modules_test.go
@@ -75,7 +75,7 @@
}
var printBlessing = modules.Register(func(env *modules.Env, args ...string) error {
- ctx, shutdown := test.InitForTest()
+ ctx, shutdown := test.V23Init()
defer shutdown()
blessing := v23.GetPrincipal(ctx).BlessingStore().Default()
@@ -193,7 +193,7 @@
}
func TestChild(t *testing.T) {
- ctx, shutdown := test.InitForTest()
+ ctx, shutdown := test.V23Init()
defer shutdown()
sh, err := modules.NewShell(ctx, nil, testing.Verbose(), t)
@@ -207,7 +207,7 @@
}
func TestAgent(t *testing.T) {
- ctx, shutdown := test.InitForTest()
+ ctx, shutdown := test.V23Init()
defer shutdown()
sh, err := modules.NewShell(ctx, nil, testing.Verbose(), t)
@@ -223,7 +223,7 @@
}
func TestCustomPrincipal(t *testing.T) {
- ctx, shutdown := test.InitForTest()
+ ctx, shutdown := test.V23Init()
defer shutdown()
p, err := vsecurity.NewPrincipal()
@@ -253,7 +253,7 @@
}
func TestCustomCredentials(t *testing.T) {
- ctx, shutdown := test.InitForTest()
+ ctx, shutdown := test.V23Init()
defer shutdown()
root := testutil.NewIDProvider("myshell")
@@ -344,7 +344,7 @@
}
func TestChildNoRegistration(t *testing.T) {
- ctx, shutdown := test.InitForTest()
+ ctx, shutdown := test.V23Init()
defer shutdown()
sh, err := modules.NewShell(ctx, nil, testing.Verbose(), t)
@@ -363,7 +363,7 @@
}
func TestErrorChild(t *testing.T) {
- ctx, shutdown := test.InitForTest()
+ ctx, shutdown := test.V23Init()
defer shutdown()
sh, err := modules.NewShell(ctx, nil, testing.Verbose(), t)
@@ -404,7 +404,7 @@
}
func TestShutdownSubprocess(t *testing.T) {
- ctx, shutdown := test.InitForTest()
+ ctx, shutdown := test.V23Init()
defer shutdown()
sh, err := modules.NewShell(ctx, nil, false, t)
@@ -419,7 +419,7 @@
// forever if a child does not die upon closing stdin; but instead times out and
// returns an appropriate error.
func TestShutdownSubprocessIgnoreStdin(t *testing.T) {
- ctx, shutdown := test.InitForTest()
+ ctx, shutdown := test.V23Init()
defer shutdown()
sh, err := modules.NewShell(ctx, nil, false, t)
@@ -448,7 +448,7 @@
// implementation inappropriately sets stdout to the file that is to be closed
// in Wait.
func TestStdoutRace(t *testing.T) {
- ctx, shutdown := test.InitForTest()
+ ctx, shutdown := test.V23Init()
defer shutdown()
sh, err := modules.NewShell(ctx, nil, testing.Verbose(), t)
@@ -493,7 +493,7 @@
}
func TestEnvelope(t *testing.T) {
- ctx, shutdown := test.InitForTest()
+ ctx, shutdown := test.V23Init()
defer shutdown()
sh, err := modules.NewShell(ctx, nil, testing.Verbose(), t)
@@ -548,7 +548,7 @@
}
func TestEnvMerge(t *testing.T) {
- ctx, shutdown := test.InitForTest()
+ ctx, shutdown := test.V23Init()
defer shutdown()
sh, err := modules.NewShell(ctx, nil, testing.Verbose(), t)
@@ -581,7 +581,7 @@
}
func TestNoExec(t *testing.T) {
- ctx, shutdown := test.InitForTest()
+ ctx, shutdown := test.V23Init()
defer shutdown()
sh, err := modules.NewShell(ctx, nil, testing.Verbose(), t)
@@ -601,7 +601,7 @@
}
func TestExternal(t *testing.T) {
- ctx, shutdown := test.InitForTest()
+ ctx, shutdown := test.V23Init()
defer shutdown()
sh, err := modules.NewShell(ctx, nil, testing.Verbose(), t)
@@ -639,7 +639,7 @@
}
func TestPipe(t *testing.T) {
- ctx, shutdown := test.InitForTest()
+ ctx, shutdown := test.V23Init()
defer shutdown()
sh, err := modules.NewShell(ctx, nil, testing.Verbose(), t)
@@ -687,7 +687,7 @@
}
func TestLIFO(t *testing.T) {
- ctx, shutdown := test.InitForTest()
+ ctx, shutdown := test.V23Init()
defer shutdown()
sh, err := modules.NewShell(ctx, nil, testing.Verbose(), t)
if err != nil {
@@ -767,7 +767,7 @@
}
func TestCredentialsAndNoExec(t *testing.T) {
- ctx, shutdown := test.InitForTest()
+ ctx, shutdown := test.V23Init()
defer shutdown()
sh, err := modules.NewShell(ctx, nil, testing.Verbose(), t)
if err != nil {