Documentation ¶
Overview ¶
Package runtest provides fake implementations needed to test Tast CLI.
Index ¶
- Constants
- type DUTOption
- func WithBootID(f func() (bootID string, err error)) DUTOption
- func WithCollectSysInfo(...) DUTOption
- func WithDownloadPrivateBundles(...) DUTOption
- func WithExtraSSHHandlers(handlers []fakesshserver.Handler) DUTOption
- func WithGetDUTInfo(f func(req *protocol.GetDUTInfoRequest) (*protocol.GetDUTInfoResponse, error)) DUTOption
- func WithGetSysInfoState(...) DUTOption
- func WithOnRunLocalTestsInit(f func(init *protocol.RunTestsInit, bcfg *protocol.BundleConfig)) DUTOption
- func WithStreamFile(...) DUTOption
- type Env
- type EnvOption
- type EnvOrDUTOption
Constants ¶
const ( // LocalTestRunnerPath is the path to the fake local test runner // available on the SSH server. LocalTestRunnerPath = "/fake/mock_local_test_runner" )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type DUTOption ¶
type DUTOption func(*dutConfig)
DUTOption can be passed to SetUp to configure the primary DUT, or to WithCompanionDUT to configure a companion DUT.
func WithBootID ¶
WithBootID specifies a function called to compute a boot ID.
func WithCollectSysInfo ¶
func WithCollectSysInfo(f func(req *protocol.CollectSysInfoRequest) (*protocol.CollectSysInfoResponse, error)) DUTOption
WithCollectSysInfo specifies a function that implements CollectSysInfo handler.
func WithDownloadPrivateBundles ¶
func WithDownloadPrivateBundles(f func(req *protocol.DownloadPrivateBundlesRequest) (*protocol.DownloadPrivateBundlesResponse, error)) DUTOption
WithDownloadPrivateBundles specifies a function that implements DownloadPrivateBundles handler.
func WithExtraSSHHandlers ¶
func WithExtraSSHHandlers(handlers []fakesshserver.Handler) DUTOption
WithExtraSSHHandlers specifies extra SSH handlers installed to a fake SSH server.
func WithGetDUTInfo ¶
func WithGetDUTInfo(f func(req *protocol.GetDUTInfoRequest) (*protocol.GetDUTInfoResponse, error)) DUTOption
WithGetDUTInfo specifies a function that implements GetDUTInfo handler.
func WithGetSysInfoState ¶
func WithGetSysInfoState(f func(req *protocol.GetSysInfoStateRequest) (*protocol.GetSysInfoStateResponse, error)) DUTOption
WithGetSysInfoState specifies a function that implements GetSysInfoState handler.
func WithOnRunLocalTestsInit ¶
func WithOnRunLocalTestsInit(f func(init *protocol.RunTestsInit, bcfg *protocol.BundleConfig)) DUTOption
WithOnRunLocalTestsInit specifies a function that is called on the beginning of RunTests for the local test runner.
func WithStreamFile ¶
func WithStreamFile(f func(req *protocol.StreamFileRequest, srv protocol.TestService_StreamFileServer) error) DUTOption
WithStreamFile specifies a function that implements StreamFile handler.
type Env ¶
type Env struct {
// contains filtered or unexported fields
}
Env contains information needed to interact with the testing environment set up.
func SetUp ¶
func SetUp(t *gotesting.T, opts ...EnvOrDUTOption) *Env
SetUp sets up a testing environment for Tast CLI.
Call this function at the beginning of unit tests to set up various fakes commonly needed by Tast CLI, e.g. a fake SSH server and fake test runners.
The environment is cleaned up automatically on the end of the current unit test.
func (*Env) Config ¶
func (e *Env) Config(mod func(cfg *config.MutableConfig)) *config.Config
Config returns a Config struct with reasonable default values to be used in unit tests. Callers can pass non-nil mod to alter values of a returned Config struct if needed to customize Tast CLI component behavior.
func (*Env) Context ¶
Context returns a background context. loggingtest.Logger is attached to the context so that logs are routed to unit test logs.
func (*Env) State ¶
func (e *Env) State() *config.DeprecatedState
State returns a State struct to be used in unit tests. It is cleaned up on the end of the current unit test.
type EnvOption ¶
type EnvOption func(*envConfig)
EnvOption can be passed to SetUp to customize the testing environment.
func WithCompanionDUT ¶
WithCompanionDUT adds a companion DUT.
func WithLocalBundles ¶
WithLocalBundles specifies fake local test bundles to be installed.
func WithOnRunRemoteTestsInit ¶
func WithOnRunRemoteTestsInit(f func(init *protocol.RunTestsInit, bcfg *protocol.BundleConfig)) EnvOption
WithOnRunRemoteTestsInit specifies a function that is called on the beginning of RunTests for the remote test runner.
func WithRemoteBundles ¶
WithRemoteBundles specifies fake remote test bundles to be installed.
type EnvOrDUTOption ¶
type EnvOrDUTOption interface {
// contains filtered or unexported methods
}
EnvOrDUTOption is an interface satisfied by EnvOption and DUTOption.
Directories ¶
Path | Synopsis |
---|---|
internal
|
|
fakerunner
Package fakerunner provides a fake implementation of test runners.
|
Package fakerunner provides a fake implementation of test runners. |