integration_tests

package
v0.0.0-...-11a4688 Latest Latest
Warning

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

Go to latest
Published: Oct 9, 2016 License: MIT Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BuildBinary

func BuildBinary(path string) (string, error)

func CheckTravis

func CheckTravis() (bool, error)

Checks if we are running on Travis or not.

func GetAutoRoutePath

func GetAutoRoutePath() string

Gets the path for the version of the autoroute binary.

func GetUnusedPort

func GetUnusedPort() int

func ProduceCommandLine

func ProduceCommandLine(b BinaryOptions) []string

Transforms a BinaryOptions into a valid AutoRoute command line.

func SendPacket

func SendPacket(conn net.Conn, t *testing.T, address types.NodeAddress,
	data []byte)

Sends a new packet with data we specify. Args:

conn: The connection we are sending it on.
t: The test interface we are using.
address: The address of the node where it is going.
data: The actual data.

func WaitForConnection

func WaitForConnection(b AutoRouteBinary, addr string) error

func WaitForID

func WaitForID(b AutoRouteBinary) (string, error)

func WaitForPacket

func WaitForPacket(c net.Conn, t *testing.T, s chan types.Packet)

Waits for a single packet.

func WaitForPackets

func WaitForPackets(c net.Conn, t *testing.T, s chan types.Packet, amt int)

Wait for a number of packets. Args:

c: Connection to read packets from.
t: Testing interface being used.
s: Channel down which to send incomming packets.
amt: The amount of packets to read before exiting.

func WaitForPacketsReceived

func WaitForPacketsReceived(b AutoRouteBinary, src string, amt ...int) error

func WaitForPacketsSent

func WaitForPacketsSent(b AutoRouteBinary, dest string, amt ...int) error

func WaitForSocket

func WaitForSocket(dev string) (net.Conn, error)

Types

type AutoRouteBinary

type AutoRouteBinary struct {
	WrappedBinary
	// contains filtered or unexported fields
}

Represents a binary execution of the autoroute binary.

func NewNodeBinary

func NewNodeBinary(b BinaryOptions) AutoRouteBinary

Produces a AutoRoute Binary which can be run. Must call Start in order to make it start running. Args:

b: Options for the binary.

Returns:

The new autoroute binary.

func (AutoRouteBinary) FetchStatus

func (b AutoRouteBinary) FetchStatus() (*statusStruct, error)

func (AutoRouteBinary) GetConnections

func (b AutoRouteBinary) GetConnections() ([]string, error)

Returns a list of connections

func (AutoRouteBinary) GetID

func (b AutoRouteBinary) GetID() (string, error)

Returns the hex encoded network ID of the binary.

func (AutoRouteBinary) GetPacketsReceived

func (b AutoRouteBinary) GetPacketsReceived() (map[string]int, error)

Returns a map of address -> packets received

func (AutoRouteBinary) GetPacketsSent

func (b AutoRouteBinary) GetPacketsSent() (map[string]int, error)

Returns a map of address -> packets received

type BinaryOptions

type BinaryOptions struct {
	Listen              string
	FakeMoney           bool
	Connect             []string
	Unix                string
	Autodiscover        bool
	AutodiscoverDevices []string
	Tcptun              string
	Tcptunserve         bool
	Keyfile             string
	BTCHost             string
	BTCUser             string
	BTCPass             string
	RouteLogPath        string
}

Represents various options which can be passed to the binary.

type LogFailer

type LogFailer interface {
	Failed() bool
	Log(args ...interface{})
	Logf(format string, args ...interface{})
}

type WrappedBinary

type WrappedBinary struct {
	*exec.Cmd
	// contains filtered or unexported fields
}

This type represents a running binary with some nice features for test integration.

func NewWrappedBinary

func NewWrappedBinary(path string, args ...string) WrappedBinary

func (WrappedBinary) KillAndPrint

func (b WrappedBinary) KillAndPrint(f LogFailer)

Used to print out the binary output in the event that some failure happened.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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