mock

package
v0.0.0-...-1586018 Latest Latest
Warning

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

Go to latest
Published: Aug 2, 2018 License: Apache-2.0, Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

View Source
const ShimStderrOutput = "Some output on stderr"

ShimStderrOutput is the expected output sent by the mock shim on stderr.

View Source
const ShimStdoutOutput = "Some output on stdout"

ShimStdoutOutput is the expected output sent by the mock shim on stdout.

Variables

View Source
var DefaultMockCCShimBinPath string

DefaultMockCCShimBinPath is populated at link time.

View Source
var DefaultMockHookBinPath string

DefaultMockHookBinPath is populated at link time.

View Source
var DefaultMockKataShimBinPath string

DefaultMockKataShimBinPath is populated at link time.

Functions

func StartShim

func StartShim(config ShimMockConfig) error

StartShim is a common routine for starting a shim mock.

Types

type CCProxyMock

type CCProxyMock struct {
	sync.Mutex

	ShimConnected    chan bool
	Signal           chan ShimSignal
	ShimDisconnected chan bool
	StdinReceived    chan bool
	// contains filtered or unexported fields
}

CCProxyMock is an object mocking clearcontainers Proxy

func NewCCProxyMock

func NewCCProxyMock(t *testing.T, path string) *CCProxyMock

NewCCProxyMock creates a hyperstart instance

func (*CCProxyMock) GetLastStdinStream

func (proxy *CCProxyMock) GetLastStdinStream() []byte

GetLastStdinStream returns the last received stdin stream

func (*CCProxyMock) GetProxyToken

func (proxy *CCProxyMock) GetProxyToken() string

GetProxyToken returns the token that mock proxy uses to verify its client connection

func (*CCProxyMock) SendExitNotification

func (proxy *CCProxyMock) SendExitNotification(payload []byte)

SendExitNotification sends an Exit Notification Frame to connected client

func (*CCProxyMock) SendStderrStream

func (proxy *CCProxyMock) SendStderrStream(payload []byte)

SendStderrStream sends a Stderr Stream Frame to connected client

func (*CCProxyMock) SendStdoutStream

func (proxy *CCProxyMock) SendStdoutStream(payload []byte)

SendStdoutStream sends a Stdout Stream Frame to connected client

func (*CCProxyMock) Start

func (proxy *CCProxyMock) Start()

Start invokes mock proxy instance to start listening.

func (*CCProxyMock) Stop

func (proxy *CCProxyMock) Stop()

Stop causes mock proxy instance to stop listening, close connection to client and close all channels

type ConnectShim

type ConnectShim struct {
	Token string `json:"token"`
}

ConnectShim payload defined here, as it has not been defined in proxy api package yet

type FrameKey

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

FrameKey is a struct composed of the the frame type and opcode, used as a key for retrieving the handler for handling the frame.

type ProxyGRPCMock

type ProxyGRPCMock struct {
	// GRPCImplementer is the structure implementing
	// the GRPC interface we want the proxy to serve.
	GRPCImplementer interface{}

	// GRPCRegister is the registration routine for
	// the GRPC service.
	GRPCRegister func(s *grpc.Server, srv interface{})
	// contains filtered or unexported fields
}

ProxyGRPCMock is the gRPC proxy mock

func (*ProxyGRPCMock) Start

func (p *ProxyGRPCMock) Start(URL string) error

Start starts the gRPC proxy mock

func (*ProxyGRPCMock) Stop

func (p *ProxyGRPCMock) Stop() error

Stop stops the gRPC proxy mock

type ProxyMock

type ProxyMock interface {
	Start(URL string) error
	Stop() error
}

ProxyMock is the proxy mock interface. It allows for implementing different kind of containers proxies front end.

type ProxyUnixMock

type ProxyUnixMock struct {
	ClientHandler func(c net.Conn)
	// contains filtered or unexported fields
}

ProxyUnixMock is the UNIX proxy mock

func (*ProxyUnixMock) Start

func (p *ProxyUnixMock) Start(URL string) error

Start starts the UNIX proxy mock

func (*ProxyUnixMock) Stop

func (p *ProxyUnixMock) Stop() error

Stop stops the UNIX proxy mock

type ShimMockConfig

type ShimMockConfig struct {
	Name               string
	URLParamName       string
	ContainerParamName string
	TokenParamName     string
}

ShimMockConfig is the configuration structure for all virtcontainers shim mock implementations.

type ShimSignal

type ShimSignal struct {
	Signal int `json:"signalNumber"`
	Row    int `json:"rows,omitempty"`
	Column int `json:"columns,omitempty"`
}

ShimSignal is the struct used to represent the signal received from the shim

Jump to

Keyboard shortcuts

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