bundletest

package
v0.0.0-...-15a9a0c Latest Latest
Warning

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

Go to latest
Published: May 19, 2023 License: BSD-3-Clause Imports: 16 Imported by: 0

Documentation

Overview

Package bundletest provides fake test bundles environment.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DUTConfig

type DUTConfig struct {
	ExtraSSHHandlers []fakesshserver.Handler
}

DUTConfig contains configurations of a fake DUT.

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 ...Option) *Env

SetUp sets up fake bundles with given parameters. Returned Env contains handles to interact with the environment that has been set up. connect instructs to make connections to remote bundles.

func (*Env) CompanionDUTs

func (e *Env) CompanionDUTs() map[string]string

CompanionDUTs returns companion DUTs' role to address mapping.

func (*Env) DialRemoteBundle

func (e *Env) DialRemoteBundle(ctx context.Context, t *gotesting.T, name string) *grpc.ClientConn

DialRemoteBundle makes a connection to the remote bundle with the given name.

func (*Env) KeyFile

func (e *Env) KeyFile() string

KeyFile returns key file path.

func (*Env) LocalBundleDir

func (e *Env) LocalBundleDir() string

LocalBundleDir returns absolute path of the local bundle directory.

func (*Env) LocalDataDir

func (e *Env) LocalDataDir() string

LocalDataDir returns absolute path of the local bundle directory.

func (*Env) LocalOutDir

func (e *Env) LocalOutDir() string

LocalOutDir returns the absolute path to the local bundle's temporary output directory.

func (*Env) PrimaryServer

func (e *Env) PrimaryServer() string

PrimaryServer returns primary server address.

func (*Env) RemoteBundleDir

func (e *Env) RemoteBundleDir() string

RemoteBundleDir returns absolute path of the remote bundle directory.

func (*Env) RemoteDataDir

func (e *Env) RemoteDataDir() string

RemoteDataDir returns absolute path of the remote bundle directory.

func (*Env) RemoteOutDir

func (e *Env) RemoteOutDir() string

RemoteOutDir returns the absolute path to the remote bundle's temporary output directory.

func (*Env) RunConfig

func (e *Env) RunConfig() *protocol.RunConfig

RunConfig returns a RunConfig struct with reasonable default values to be used in unit tests.

type Option

type Option func(*config)

Option can be passed to SetUp to customize the testing environment.

func WithCompanionDUTs

func WithCompanionDUTs(ds map[string]*DUTConfig) Option

WithCompanionDUTs specifies fake companion DUTs.

func WithLocalBundles

func WithLocalBundles(reg ...*testing.Registry) Option

WithLocalBundles specifies fake local test bundles to be installed.

func WithLocalData

func WithLocalData(m map[string]string) Option

WithLocalData specifies local data. m should be a mapping from filepath to file content, where filepath is relative to the local data directory.

func WithPrimaryDUT

func WithPrimaryDUT(d *DUTConfig) Option

WithPrimaryDUT specifies fake primary DUT configuration.

func WithRemoteBundles

func WithRemoteBundles(reg ...*testing.Registry) Option

WithRemoteBundles specifies fake remote test bundles to be installed.

func WithRemoteData

func WithRemoteData(m map[string]string) Option

WithRemoteData specifies remote data. m should be a mapping from filepath to file content, where filepath is relative to the remote data directory.

Jump to

Keyboard shortcuts

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