integration

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Oct 6, 2021 License: Apache-2.0 Imports: 21 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// SCIOND is a placeholder for the SCIOND server in the arguments.
	SCIOND = "<SCIOND>"
	// ServerPortReplace is a placeholder for the server port in the arguments.
	ServerPortReplace = "<ServerPort>"
	// SrcIAReplace is a placeholder for the source IA in the arguments.
	SrcIAReplace = "<SRCIA>"
	// SrcHostReplace is a placeholder for the source host in the arguments.
	SrcHostReplace = "<SRCHost>"
	// SrcAddrPattern is a placeholder for the source address in the arguments.
	SrcAddrPattern = SrcIAReplace + ",[" + SrcHostReplace + "]"
	// DstIAReplace is a placeholder for the destination IA in the arguments.
	DstIAReplace = "<DSTIA>"
	// DstHostReplace is a placeholder for the destination host in the arguments.
	DstHostReplace = "<DSTHost>"
	// DstAddrPattern is a placeholder for the destination address in the arguments.
	DstAddrPattern = DstIAReplace + ",[" + DstHostReplace + "]"
	// ReadySignal should be written to Stdout by the server once it is read to accept clients.
	// The message should always be `Listening ia=<IA>`
	// where <IA> is the IA the server is listening on.
	ReadySignal = "Listening ia="
	// GoIntegrationEnv is an environment variable that is set for the binary under test.
	// It can be used to guard certain statements, like printing the ReadySignal,
	// in a program under test.
	GoIntegrationEnv = "SCION_GO_INTEGRATION"

	// Default client startup timeout
	DefaultClientTimeout = 10 * time.Second
)

Variables

View Source
var HostAddr sintegration.HostAddr = func(ia addr.IA) *snet.UDPAddr {
	daemon, err := getSCIONDAddress(ia)
	if err != nil {
		log.Error("Failed to get sciond address", "err", err)
		return nil
	}
	hostIP, err := DefaultLocalIPAddress(daemon)
	if err != nil {
		log.Error("Failed to get valid host IP", "err", err)
		return nil
	}
	return &snet.UDPAddr{IA: ia, Host: &net.UDPAddr{IP: hostIP, Port: 0}}
}

HostAddr gets _a_ host address, the same way appnet does, for a given IA

Functions

func AppBinPath

func AppBinPath(name string) string

AppBinPath returns the path to a scion-apps binary built with the projects Makefile.

func Contains

func Contains(expected string) func(prev bool, line string) bool

func DefaultLocalIPAddress

func DefaultLocalIPAddress(sciondAddress string) (net.IP, error)

func IAPairs

func IAPairs(hostAddr sintegration.HostAddr) []sintegration.IAPair

IAPairs returns all IAPairs that should be tested.

func Init

func Init(name string) (err error)

Init initializes the integration test, it adds and validates the command line flags, and initializes logging.

func NoPanic

func NoPanic() func(prev bool, line string) bool

func RegExp

func RegExp(regularExpression string) func(prev bool, line string) bool

func RunTests

func RunTests(in sintegration.Integration, pairs []sintegration.IAPair, clientTimeout time.Duration, clientDelay time.Duration) error

RunTests runs the client and server for each IAPair. In case of an error the function is terminated immediately.

func StartServer

func StartServer(in sintegration.Integration, dst *snet.UDPAddr) (io.Closer, error)

StartServer runs a server. The server can be stopped by calling Close() on the returned Closer. To start a server with a custom context use in.StartServer directly.

Types

type ScionAppsIntegration

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

func NewAppsIntegration

func NewAppsIntegration(name string, test string, clientCmd string, serverCmd string, clientArgs, serverArgs []string, keepLogs bool) *ScionAppsIntegration

NewAppsIntegration returns an implementation of the Integration interface. Start{Client|Server} will run the binary program with name and use the given arguments for the client/server. Use SrcIAReplace and DstIAReplace in arguments as placeholder for the source and destination IAs. When starting a client/server the placeholders will be replaced with the actual values. The server should output the ReadySignal to Stdout once it is ready to accept clients. If keepLog is true, also store client and server error logs.

func (*ScionAppsIntegration) ClientStderr

func (sai *ScionAppsIntegration) ClientStderr(errMatch func(bool, string) bool)

func (*ScionAppsIntegration) ClientStdout

func (sai *ScionAppsIntegration) ClientStdout(outMatch func(bool, string) bool)

func (*ScionAppsIntegration) Name

func (sai *ScionAppsIntegration) Name() string

func (*ScionAppsIntegration) ServerStderr

func (sai *ScionAppsIntegration) ServerStderr(errMatch func(bool, string) bool)

func (*ScionAppsIntegration) ServerStdout

func (sai *ScionAppsIntegration) ServerStdout(outMatch func(bool, string) bool)

func (*ScionAppsIntegration) StartClient

func (sai *ScionAppsIntegration) StartClient(ctx context.Context,
	src, dst *snet.UDPAddr) (sintegration.Waiter, error)

func (*ScionAppsIntegration) StartServer

func (sai *ScionAppsIntegration) StartServer(ctx context.Context,
	dst *snet.UDPAddr) (sintegration.Waiter, error)

StartServer starts a server and blocks until the ReadySignal is received on Stdout.

Directories

Path Synopsis
Package sintegration simplifies the creation of integration tests.
Package sintegration simplifies the creation of integration tests.

Jump to

Keyboard shortcuts

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