workload

package
v3.0.10+incompatible Latest Latest
Warning

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

Go to latest
Published: Feb 27, 2019 License: Apache-2.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func HaveConnectivityTo

func HaveConnectivityTo(target connectionTarget, explicitPort ...uint16) types.GomegaMatcher

Types

type ConnectivityChecker

type ConnectivityChecker struct {
	ReverseDirection bool
	Protocol         string // "tcp" or "udp"
	// contains filtered or unexported fields
}

ConnectivityChecker records a set of connectivity expectations and supports calculating the actual state of the connectivity between the given workloads. It is expected to be used like so:

var cc = &workload.ConnectivityChecker{}
cc.ExpectNone(w[2], w[0], 1234)
cc.ExpectSome(w[1], w[0], 5678)
Eventually(cc.ActualConnectivity, "10s", "100ms").Should(Equal(cc.ExpectedConnectivity()))

Note that the ActualConnectivity method is passed to Eventually as a function pointer to allow Ginkgo to re-evaluate the result as needed.

func (*ConnectivityChecker) ActualConnectivity

func (c *ConnectivityChecker) ActualConnectivity() []string

ActualConnectivity calculates the current connectivity for all the expected paths. One string is returned for each expectation, in the order they were recorded. The strings are intended to be human readable, and they are in the same order and format as those returned by ExpectedConnectivity().

func (*ConnectivityChecker) CheckConnectivity

func (c *ConnectivityChecker) CheckConnectivity(optionalDescription ...interface{})

func (*ConnectivityChecker) CheckConnectivityOffset

func (c *ConnectivityChecker) CheckConnectivityOffset(offset int, optionalDescription ...interface{})

func (*ConnectivityChecker) CheckConnectivityWithTimeout

func (c *ConnectivityChecker) CheckConnectivityWithTimeout(timeout time.Duration, optionalDescription ...interface{})

func (*ConnectivityChecker) CheckConnectivityWithTimeoutOffset

func (c *ConnectivityChecker) CheckConnectivityWithTimeoutOffset(callerSkip int, timeout time.Duration, optionalDescription ...interface{})

func (*ConnectivityChecker) ExpectNone

func (c *ConnectivityChecker) ExpectNone(from connectionSource, to connectionTarget, explicitPort ...uint16)

func (*ConnectivityChecker) ExpectSome

func (c *ConnectivityChecker) ExpectSome(from connectionSource, to connectionTarget, explicitPort ...uint16)

func (*ConnectivityChecker) ExpectedConnectivity

func (c *ConnectivityChecker) ExpectedConnectivity() []string

ExpectedConnectivity returns one string per recorded expection in order, encoding the expected connectivity in the same format used by ActualConnectivity().

func (*ConnectivityChecker) ResetExpectations

func (c *ConnectivityChecker) ResetExpectations()

type IP

type IP string // Just so we can define methods on it...

func (IP) ToMatcher

func (s IP) ToMatcher(explicitPort ...uint16) *connectivityMatcher

type Port

type Port struct {
	*Workload
	Port uint16
}

func (*Port) CanConnectTo

func (p *Port) CanConnectTo(ip, port, protocol string) bool

func (*Port) SourceName

func (w *Port) SourceName() string

func (*Port) ToMatcher

func (p *Port) ToMatcher(explicitPort ...uint16) *connectivityMatcher

ToMatcher implements the connectionTarget interface, allowing this port to be used as target.

type Workload

type Workload struct {
	C             *containers.Container
	Name          string
	InterfaceName string
	IP            string
	Ports         string
	DefaultPort   string

	WorkloadEndpoint *api.WorkloadEndpoint
	Protocol         string // "tcp" or "udp"
	// contains filtered or unexported fields
}

func Run

func Run(c *containers.Container, name, interfaceName, ip, ports string, protocol string) (w *Workload)

func (*Workload) CanConnectTo

func (w *Workload) CanConnectTo(ip, port, protocol string) bool

func (*Workload) Configure

func (w *Workload) Configure(client client.Interface)

func (*Workload) IPNet

func (w *Workload) IPNet() string

func (*Workload) NameSelector

func (w *Workload) NameSelector() string

func (*Workload) Port

func (w *Workload) Port(port uint16) *Port

func (*Workload) SourceName

func (w *Workload) SourceName() string

func (*Workload) Stop

func (w *Workload) Stop()

func (*Workload) ToMatcher

func (w *Workload) ToMatcher(explicitPort ...uint16) *connectivityMatcher

Jump to

Keyboard shortcuts

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