fakerunner

package
v0.0.0-...-b5d9cbe Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 1, 2024 License: BSD-3-Clause Imports: 11 Imported by: 0

Documentation

Overview

Package fakerunner provides a fake implementation of test runners.

We implement fake test runners by mostly delegating to the real implementation of test runners (go.chromium.org/tast/core/internal/runner). Thus we can use the fakebundle package to create fake test bundles executed by fake test runners. On the other hand, other operation modes (e.g. GetDUTInfo, GetSysInfoState etc.) are hooked by this package so that callers can inject custom implementations of them.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	// BundleDir is a path of the directory containing test bundles.
	BundleDir string
	// StaticConfig is a configuration passed to the test runner.
	StaticConfig *runner.StaticConfig
	// GetDUTInfo implements the GetDUTInfo handler.
	GetDUTInfo func(req *protocol.GetDUTInfoRequest) (*protocol.GetDUTInfoResponse, error)
	// GetSysInfoState implements the GetSysInfoState handler.
	GetSysInfoState func(req *protocol.GetSysInfoStateRequest) (*protocol.GetSysInfoStateResponse, error)
	// CollectSysInfo implements the CollectSysInfo handler.
	CollectSysInfo func(req *protocol.CollectSysInfoRequest) (*protocol.CollectSysInfoResponse, error)
	// DownloadPrivateBundles implements the DownloadPrivateBundles handler.
	DownloadPrivateBundles func(req *protocol.DownloadPrivateBundlesRequest) (*protocol.DownloadPrivateBundlesResponse, error)
	// OnRunTestsInit is called on the beginning of RunTests.
	OnRunTestsInit func(init *protocol.RunTestsInit, bcfg *protocol.BundleConfig)
	// StreamFile implements the StreamFile handler.
	StreamFile func(req *protocol.StreamFileRequest, srv protocol.TestService_StreamFileServer) error
}

Config holds configuration values needed to instantiate a fake test runner.

type Runner

type Runner struct {
	// contains filtered or unexported fields
}

Runner represents a fake test runner.

func New

func New(cfg *Config) *Runner

New instantiates a new fake test runner from cfg.

This function does not install the created fake test runner. Call SSHHandlers or Install to actually install it.

Note: This function does not use the functional option pattern. This package is internal to the runtest package so it is easy to rewrite all callers when we introduce new configuration values.

func (*Runner) Install

func (r *Runner) Install(path string) (*fakeexec.Loopback, error)

Install creates a fake executable at path. Call this method to install this as a fake remote test runner.

func (*Runner) RunGRPC

func (r *Runner) RunGRPC(stdin io.Reader, stdout, stderr io.Writer) int

RunGRPC executes the fake test runner logic in gRPC protocol mode.

func (*Runner) SSHHandlers

func (r *Runner) SSHHandlers(path string) []fakesshserver.Handler

SSHHandlers returns a handler to be installed to a fake SSH server. Use this method to install this as a fake local test runner.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL