faketlw

package
v0.0.0-...-d046166 Latest Latest
Warning

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

Go to latest
Published: Dec 10, 2020 License: BSD-3-Clause Imports: 15 Imported by: 0

Documentation

Overview

Package faketlw provides a fake implementation of the TLW service.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func StartWiringServer

func StartWiringServer(t *testing.T, opts ...WiringServerOption) (stopFunc func(), addr string)

StartWiringServer is a convenient method for unit tests which starts a gRPC server serving WiringServer in the background. It also starts an HTTP server for serving cached files by CacheForDUT. Callers are responsible for stopping the server by stopFunc().

Types

type NamePort

type NamePort struct {
	Name string
	Port int32
}

NamePort represents a simple name/port pair.

type WiringServer

type WiringServer struct {
	tls.UnimplementedWiringServer
	longrunning.UnimplementedOperationsServer
	// contains filtered or unexported fields
}

WiringServer is a fake implementation of tls.WiringServer and longrunning.UnimplementedOperationsServer for CacheForDUT.

func NewWiringServer

func NewWiringServer(opts ...WiringServerOption) *WiringServer

NewWiringServer constructs a new WiringServer from given options. The caller is responsible for calling Shutdown() of the returned object.

func (*WiringServer) CacheForDut

CacheForDut implements tls WiringServer.CacheForDUT

func (*WiringServer) CancelOperation

func (s *WiringServer) CancelOperation(ctx context.Context, req *longrunning.CancelOperationRequest) (*empty.Empty, error)

CancelOperation implements longrunning.CancelOperation.

func (*WiringServer) DeleteOperation

func (s *WiringServer) DeleteOperation(ctx context.Context, req *longrunning.DeleteOperationRequest) (*empty.Empty, error)

DeleteOperation implements longrunning.CancelOperation.

func (*WiringServer) GetOperation

GetOperation implements longrunning.GetOperation.

func (*WiringServer) ListOperations

ListOperations implements longrunning.ListOperations.

func (*WiringServer) OpenDutPort

OpenDutPort implements tls.WiringServer.OpenDutPort.

func (*WiringServer) Shutdown

func (s *WiringServer) Shutdown()

Shutdown shuts down the serer.

func (*WiringServer) WaitOperation

WaitOperation implements longrunning.WaitOperation.

type WiringServerOption

type WiringServerOption func(cfg *wiringServerConfig)

WiringServerOption is an option passed to NewWiringServer to customize WiringServer.

func WithCacheFileMap

func WithCacheFileMap(m map[string][]byte) WiringServerOption

WithCacheFileMap returns an option that sets the files to be fetched by CacheForDUT requests.

func WithDUTName

func WithDUTName(n string) WiringServerOption

WithDUTName returns an option that sets the expected DUT name to be requested by CacheForDut requests.

func WithDUTPortMap

func WithDUTPortMap(m map[NamePort]NamePort) WiringServerOption

WithDUTPortMap returns an option that sets the name/port map used to resolve OpenDutPort requests.

Jump to

Keyboard shortcuts

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