mock

package
v0.2.3 Latest Latest
Warning

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

Go to latest
Published: Dec 20, 2016 License: Apache-2.0 Imports: 12 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

View Source
const (
	Version        = "version"
	StartPod       = "startpod"
	DestroyPod     = "destroypod"
	ExecCmd        = "execcmd"
	Ready          = "ready"
	Ack            = "ack"
	Error          = "error"
	WinSize        = "winsize"
	Ping           = "ping"
	FinishPod      = "finishpod"
	Next           = "next"
	WriteFile      = "writefile"
	ReadFile       = "readfile"
	NewContainer   = "newcontainer"
	KillContainer  = "killcontainer"
	OnlineCPUMem   = "onlinecpumem"
	SetupInterface = "setupinterface"
	SetupRoute     = "setuproute"
)

Control command string IDs

Variables

This section is empty.

Functions

func GetTmpPath

func GetTmpPath(format string) string

GetTmpPath will return a filename suitable for a tempory file according to the format string given in argument. The format string must contain a single %s which will be replaced by a random string. Eg.:

GetTmpPath("test.foo.%s.sock")

will return something like:

"/tmp/test.foo.832222621.sock"

Types

type Hyperstart

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

Hyperstart is an object mocking the hyperstart agent.

func NewHyperstart

func NewHyperstart(t *testing.T) *Hyperstart

NewHyperstart creates a new hyperstart instance.

func (*Hyperstart) CloseIo

func (h *Hyperstart) CloseIo(seq uint64)

CloseIo closes the I/O stream specified by seq.

func (*Hyperstart) GetLastMessages

func (h *Hyperstart) GetLastMessages() []hyper.DecodedMessage

GetLastMessages returns list of messages received by hyperstart, older first. This function only returns the messages:

  • since Start on the first invocation
  • since the last GetLastMessages for subsequent invocations

func (*Hyperstart) GetSocketPaths

func (h *Hyperstart) GetSocketPaths() (string, string)

GetSocketPaths returns the ctl and io socket paths, respectively

func (*Hyperstart) ReadIo

func (h *Hyperstart) ReadIo(buf []byte) (n int, seq uint64)

ReadIo reads data that has been sent on the I/O channel by a client. It returns the full packet (header & data) as well as the seq number decoded from the header.

func (*Hyperstart) SendExitStatus

func (h *Hyperstart) SendExitStatus(seq uint64, exitStatus uint8)

SendExitStatus sends the exit status on the I/O streams specified by seq. The exit status should only be sent after the stream has been closed with CloseIo.

func (*Hyperstart) SendIo

func (h *Hyperstart) SendIo(seq uint64, data []byte)

SendIo sends a packet of I/O data to a client connected the I/O channel. Multiple I/O streams are multiplexed on that channel. seq specifies which steam the data belongs to.

func (*Hyperstart) SendIoString

func (h *Hyperstart) SendIoString(seq uint64, data string)

SendIoString sends a string a client connected the I/O channel. Multiple I/O streams are multiplexed on that channel. seq specifies which steam the data belongs to.

func (*Hyperstart) SendMessage

func (h *Hyperstart) SendMessage(cmd int, data []byte)

SendMessage makes hyperstart send the hyper command cmd along with optional data on the control channel

func (*Hyperstart) Start

func (h *Hyperstart) Start()

Start will Once finished with the Hyperstart object, Close must be called.

func (*Hyperstart) Stop

func (h *Hyperstart) Stop()

Stop closes all internal resources and waits for goroutines started by Start to finish. Stop shouldn't be called if Start hasn't been called.

Jump to

Keyboard shortcuts

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