bundle

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: 34 Imported by: 0

Documentation

Overview

Package bundle contains internal code that corresponds to the public bundle package.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Local

func Local(clArgs []string, stdin io.Reader, stdout, stderr io.Writer, reg *testing.Registry, d Delegate) int

Local implements the main function for local test bundles.

Main function of local test bundles should call LocalDefault instead.

func Remote

func Remote(clArgs []string, stdin io.Reader, stdout, stderr io.Writer, reg *testing.Registry, d Delegate) int

Remote implements the main function for remote test bundles.

Main function of remote test bundles should call RemoteDefault instead.

func RunRPCServer

func RunRPCServer(r io.Reader, w io.Writer, scfg *StaticConfig) error

RunRPCServer runs the bundle as an RPC server.

func RunRPCServerTCP

func RunRPCServerTCP(port int, handshakeReq *protocol.HandshakeRequest, stdin io.Reader, stdout, stderr io.Writer, scfg *StaticConfig) error

RunRPCServerTCP runs the bundle as an RPC server listening on TCP.

Types

type Delegate

type Delegate struct {
	// TestHook is called before each test in the test bundle if it is not nil.
	// The returned closure is executed after the test if it is not nil.
	TestHook func(context.Context, *testing.TestHookState) func(context.Context, *testing.TestHookState)

	// RunHook is called at the beginning of a bundle execution if it is not nil.
	// The returned closure is executed at the end if it is not nil.
	// In case of errors, no test in the test bundle will run.
	RunHook func(context.Context) (func(context.Context) error, error)

	// Ready is called at the beginning of a bundle execution if it is not
	// nil and -waituntilready is set to true (default).
	// systemTestsTimeout is the timeout for waiting for system services
	// to be ready in seconds.
	// Local test bundles can specify a function to wait for the DUT to be
	// ready for tests to run. It is recommended to write informational
	// messages with testing.ContextLog to let the user know the reason for
	// the delay. In case of errors, no test in the test bundle will run.
	// This field has an effect only for local test bundles.
	Ready func(ctx context.Context, systemTestsTimeout time.Duration) error

	// BeforeReboot is called before every reboot if it is not nil.
	// This field has an effect only for remote test bundles.
	BeforeReboot func(ctx context.Context, d *dut.DUT) error

	// BeforeDownload is called before the framework attempts to download
	// external data files if it is not nil.
	//
	// Test bundles can install this hook to recover from possible network
	// outage caused by previous tests. Note that it is called only when
	// the framework needs to download one or more external data files.
	//
	// Since no specific timeout is set to ctx, do remember to set a
	// reasonable timeout at the beginning of the hook to avoid blocking
	// for long time.
	BeforeDownload func(ctx context.Context)
}

Delegate injects functions as a part of test bundle framework implementation.

type StaticConfig

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

StaticConfig contains configurations unique to a test bundle.

The supplied functions are used to provide customizations that apply to all entities in a test bundle. They may contain bundle-specific code.

func NewStaticConfig

func NewStaticConfig(reg *testing.Registry, defaultTestTimeout time.Duration, d Delegate) *StaticConfig

NewStaticConfig constructs StaticConfig from given parameters.

Directories

Path Synopsis
Package bundleclient provides bundle services client implementation.
Package bundleclient provides bundle services client implementation.
Package bundletest provides fake test bundles environment.
Package bundletest provides fake test bundles environment.
Package fakebundle provides a fake implementation of test bundles.
Package fakebundle provides a fake implementation of test bundles.
Package legacyjson defines the schema of JSON-based representation of tests used only for -dumptests option in test bundles.
Package legacyjson defines the schema of JSON-based representation of tests used only for -dumptests option in test bundles.

Jump to

Keyboard shortcuts

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