Documentation ¶
Index ¶
- Constants
- Variables
- func AppStub(nameComponents ...string) device.ApplicationClientMethods
- func Cat(ctx *context.T, name, file string) (string, error)
- func ClaimDevice(t *testing.T, ctx *context.T, ...)
- func ClaimDeviceExpectError(t *testing.T, ctx *context.T, name, extension, pairingToken string, ...)
- func CompareAssociations(t *testing.T, got, expected []device.Association)
- func CreatePrincipal(t *testing.T, sh *v23test.Shell) string
- func CtxWithNewPrincipal(t *testing.T, ctx *context.T, idp *testutil.IDProvider, extension string) *context.T
- func Debug(t *testing.T, ctx *context.T, nameComponents ...string) string
- func DeleteApp(t *testing.T, ctx *context.T, appID, instanceID string)
- func DeviceManagerCmd(sh *v23test.Shell, f *gosh.Func, args ...interface{}) *v23test.Cmd
- func DeviceStub(name string) device.DeviceClientMethods
- func EnvelopeFromShell(sh *v23test.Shell, vars, flags []string, f *gosh.Func, title string, ...) application.Envelope
- func GenerateRestarter(t *testing.T, root string) string
- func GenerateSuidHelperScript(t *testing.T, root string) string
- func GetPid(t *testing.T, ctx *context.T, appID, instanceID string) int
- func InstallApp(t *testing.T, ctx *context.T, opt ...interface{}) string
- func InstallAppExpectError(t *testing.T, ctx *context.T, expectedError verror.ID, opt ...interface{})
- func KillApp(t *testing.T, ctx *context.T, appID, instanceID string)
- func KillDevice(t *testing.T, ctx *context.T, name string)
- func LaunchApp(t *testing.T, ctx *context.T, appID string) string
- func LaunchAppExpectError(t *testing.T, ctx *context.T, appID string, expectedError verror.ID)
- func LaunchAppImpl(t *testing.T, ctx *context.T, appID, grant string) (string, error)
- func NewGlobTestRegexHelper(appName string) *globTestRegexHelper
- func NewInstanceImpl(t *testing.T, ctx *context.T, appID, grant string) (string, error)
- func Ocfg(opt []interface{}) device.Config
- func Opkg(opt []interface{}) application.Packages
- func PollingWait(t *testing.T, pid int)
- func Resolve(f Fatalist, ctx *context.T, name string, expectReplicas int, retry bool) []string
- func ResolveExpectNotFound(f Fatalist, ctx *context.T, name string, retry bool)
- func RevertApp(t *testing.T, ctx *context.T, appID string)
- func RevertAppExpectError(t *testing.T, ctx *context.T, appID string, expectedError verror.ID)
- func RevertDevice(t *testing.T, ctx *context.T, name string)
- func RevertDeviceExpectError(t *testing.T, ctx *context.T, name string, errID verror.ID)
- func RunApp(t *testing.T, ctx *context.T, appID, instanceID string)
- func RunAppExpectError(t *testing.T, ctx *context.T, appID, instanceID string, ...)
- func SetNamespaceRootsForUnclaimedDevice(ctx *context.T) (*context.T, error)
- func ShutdownDevice(t *testing.T, ctx *context.T, name string)
- func SignedEnvelopeFromShell(ctx *context.T, sh *v23test.Shell, vars, flags []string, f *gosh.Func, ...) (application.Envelope, error)
- func StartApplicationRepository(ctx *context.T) (*application.Envelope, func())
- func StartBinaryRepository(ctx *context.T) func()
- func StartMockRepos(t *testing.T, ctx *context.T) (*application.Envelope, func())
- func StartRealBinaryRepository(t *testing.T, ctx *context.T, von string) func()
- func StartupHelper(t *testing.T) (func(), *context.T, *v23test.Shell, *application.Envelope, string, string, ...)
- func StatsStub(nameComponents ...string) stats.StatsClientMethods
- func Status(t *testing.T, ctx *context.T, nameComponents ...string) device.Status
- func TerminateApp(t *testing.T, ctx *context.T, appID, instanceID string)
- func TestMainImpl(m *testing.M)
- func TestSuidHelperImpl(t *testing.T)
- func UninstallApp(t *testing.T, ctx *context.T, appID string)
- func UpdateApp(t *testing.T, ctx *context.T, appID string)
- func UpdateAppExpectError(t *testing.T, ctx *context.T, appID string, expectedError verror.ID)
- func UpdateDevice(t *testing.T, ctx *context.T, name string)
- func UpdateDeviceExpectError(t *testing.T, ctx *context.T, name string, errID verror.ID)
- func UpdateInstance(t *testing.T, ctx *context.T, appID, instanceID string)
- func UpdateInstanceExpectError(t *testing.T, ctx *context.T, appID, instanceID string, ...)
- func UserName(t *testing.T) string
- func VerifyDeviceState(t *testing.T, ctx *context.T, want device.InstanceState, name string) string
- func VerifyFailGlob(t *testing.T, ctx *context.T, testcases []GlobTestVector)
- func VerifyGlob(t *testing.T, ctx *context.T, appName string, testcases []GlobTestVector, ...)
- func VerifyLog(t *testing.T, ctx *context.T, nameComponents ...string)
- func VerifyNoRunningProcesses(t *testing.T)
- func VerifyPProfCmdLine(t *testing.T, ctx *context.T, appName string, nameComponents ...string)
- func VerifyState(t *testing.T, ctx *context.T, want interface{}, nameComponents ...string) string
- func VerifyStatsValues(t *testing.T, ctx *context.T, nameComponents ...string)
- func WaitForMount(f Fatalist, ctx *context.T, name string, server rpc.Server)
- func WaitForState(t *testing.T, ctx *context.T, want interface{}, nameComponents ...string)
- type Fatalist
- type GlobTestVector
- type PingArgs
- type PingServer
Constants ¶
const ( RedirectEnv = "DEVICE_MANAGER_DONT_REDIRECT_STDOUT_STDERR" TestEnvVarName = "V23_RANDOM_ENV_VALUE" NoPairingToken = "" )
const MockApplicationRepoName = "ar"
const MockBinaryRepoName = "br"
const (
TestFlagName = "random_test_flag"
)
Variables ¶
var App = gosh.RegisterFunc("App", appFunc)
App is a test application. It pings the invoking device manager with state information.
var DeviceManager = gosh.RegisterFunc("DeviceManager", deviceManagerFunc)
DeviceManager sets up a device manager server. It accepts the name to publish the server under as an argument. Additional arguments can optionally specify device manager config settings.
var DeviceManagerV10 = gosh.RegisterFunc("DeviceManagerV10", func(publishName string, args ...string) error { versioning.CurrentVersion = versioning.Version{10, 0} return deviceManagerFunc(publishName, args...) })
This is the same as DeviceManager above, except that it has a different major version number.
var ErrOperationFailed = verror.Register(pkgPath+".OperationFailed", verror.NoRetry, "")
var ExecScript = gosh.RegisterFunc("ExecScript", func(script string) error { osenv := []string{RedirectEnv + "=1"} if os.Getenv("PAUSE_BEFORE_STOP") == "1" { osenv = append(osenv, "PAUSE_BEFORE_STOP=1") } cmd := goexec.Cmd{ Path: script, Env: osenv, Stdin: os.Stdin, Stderr: os.Stderr, Stdout: os.Stdout, } return cmd.Run() })
ExecScript launches the script passed as argument.
var HangingApp = gosh.RegisterFunc("HangingApp", func(publishName string) error { err := appFunc(publishName) time.Sleep(24 * time.Hour) return err })
HangingApp is the same as App, except that it does not exit properly after being stopped.
Functions ¶
func AppStub ¶
func AppStub(nameComponents ...string) device.ApplicationClientMethods
func ClaimDevice ¶
func ClaimDeviceExpectError ¶
func CompareAssociations ¶
func CompareAssociations(t *testing.T, got, expected []device.Association)
func CreatePrincipal ¶
CreatePrincipal sets up a principal in a temporary directory (to be cleaned up by the shell at the end) and returns that directory.
func CtxWithNewPrincipal ¶
func DeviceManagerCmd ¶
func DeviceStub ¶
func DeviceStub(name string) device.DeviceClientMethods
func EnvelopeFromShell ¶
func GenerateRestarter ¶
GenerateRestarter creates a simple script that acts as the restarter for tests. It blackholes arguments meant for the restarter.
func GenerateSuidHelperScript ¶
GenerateSuidHelperScript builds a script to execute the test target as a suidhelper instance and returns the path to the script.
func InstallAppExpectError ¶
func LaunchAppExpectError ¶
func LaunchAppImpl ¶
func NewGlobTestRegexHelper ¶
func NewGlobTestRegexHelper(appName string) *globTestRegexHelper
func NewInstanceImpl ¶
func Opkg ¶
func Opkg(opt []interface{}) application.Packages
func PollingWait ¶
PollingWait polls a given process to make sure that it has exited before continuing or fails with a time-out.
func ResolveExpectNotFound ¶
ResolveExpectNotFound verifies that the given name is not in the mounttable.
func RevertAppExpectError ¶
func RevertDeviceExpectError ¶
func RunAppExpectError ¶
func SignedEnvelopeFromShell ¶
func StartApplicationRepository ¶
func StartApplicationRepository(ctx *context.T) (*application.Envelope, func())
StartApplicationRepository sets up a server running the application repository. It returns a pointer to the envelope that the repository returns to clients (so that it can be changed). It also returns a cleanup function.
func StartBinaryRepository ¶
StartBinaryRepository sets up a server running the binary repository and returns a cleanup function.
func StartMockRepos ¶
func StartupHelper ¶
func StartupHelper(t *testing.T) (func(), *context.T, *v23test.Shell, *application.Envelope, string, string, *testutil.IDProvider)
TODO(rjkroege): This helper is generally useful. Use it to reduce boilerplate across all device manager tests.
func StatsStub ¶
func StatsStub(nameComponents ...string) stats.StatsClientMethods
func TestMainImpl ¶
func TestSuidHelperImpl ¶
TestSuidHelper is testing boilerplate for suidhelper that does not create a runtime because the suidhelper is not a Vanadium application.
func UpdateAppExpectError ¶
func UpdateDeviceExpectError ¶
func VerifyDeviceState ¶
func VerifyFailGlob ¶
func VerifyFailGlob(t *testing.T, ctx *context.T, testcases []GlobTestVector)
VerifyFailGlob verifies that for each GlobTestVector instance that the pattern returns no matches.
func VerifyGlob ¶
func VerifyGlob(t *testing.T, ctx *context.T, appName string, testcases []GlobTestVector, res *globTestRegexHelper)
VerifyGlob verifies that for each GlobTestVector instance that the pattern returns the expected matches.
func VerifyLog ¶
VerifyLog calls Size() on a selection of log file objects to demonstrate that the log files are accessible and have been written by the application.
func VerifyPProfCmdLine ¶
VerifyPProfCmdLine calls CmdLine() on the pprof object to validate that it the proxy correctly accessess pprof names.
func VerifyState ¶
func VerifyStatsValues ¶
VerifyStatsValues call Value() on some of the stats objects to prove that they are correctly being proxied to the device manager.
func WaitForMount ¶
WaitForMount waits (with a reasonable timeout) for the given server's endpoint to be mounted under the given name. Since ctx.WithNewServer and ctx.WithNewDispatchingServer publish the names asynchronously, use WaitForMount if you need a guarantee that the publish has happened.
Types ¶
type Fatalist ¶
type Fatalist interface { Fatal(args ...interface{}) Fatalf(format string, args ...interface{}) }
type GlobTestVector ¶
type PingServer ¶
type PingServer struct {
// contains filtered or unexported fields
}
func SetupPingServer ¶
func SetupPingServer(t *testing.T, ctx *context.T) (PingServer, func())
SetupPingServer creates a server listening for a ping from a child app; it returns a channel on which the app's ping message is returned, and a cleanup function.
func (PingServer) Ping ¶
func (p PingServer) Ping(_ *context.T, _ rpc.ServerCall, arg PingArgs) error
func (PingServer) VerifyPingArgs ¶
func (p PingServer) VerifyPingArgs(t *testing.T, username, flagValue, envValue string) PingArgs
func (PingServer) WaitForPingArgs ¶
func (p PingServer) WaitForPingArgs(t *testing.T) PingArgs