testutil

package
v0.0.0-...-c4caace Latest Latest
Warning

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

Go to latest
Published: Aug 27, 2024 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func PingTCP

func PingTCP(t *testing.T, ip net.IP, port int) net.Conn

PingTCP connects to the provided IP address over TCP/TCPv6, sends the string "ping", reads from the connection, and returns the open connection for further use/inspection.

func PingUDP

func PingUDP(t *testing.T, ip net.IP, port int) net.Conn

PingUDP connects to the provided IP address over UDP/UDPv6, sends the string "ping", and returns the open connection for further use/inspection.

func RunCommands

func RunCommands(t *testing.T, cmds []string, ignoreErrors bool) []string

RunCommands runs each command in cmds individually and returns the output as a []string, with each element corresponding to the respective command. If ignoreErrors is true, it will fail the test via t.Fatal immediately upon error. Otherwise, the output on errors will be logged via t.Log.

func StartServerTCP

func StartServerTCP(t *testing.T, ip net.IP, port int) io.Closer

StartServerTCP starts a TCP server listening at provided IP address and port. It will respond to any connection with "hello" and then close the connection. It returns an io.Closer that should be Close'd when you are finished with it.

func StartServerTCPNs

func StartServerTCPNs(t *testing.T, ip net.IP, port int, ns string) io.Closer

StartServerTCPNs is identical to StartServerTCP, but it operates with the network namespace provided by name.

func StartServerUDP

func StartServerUDP(t *testing.T, ip net.IP, port int) io.Closer

StartServerUDP starts a UDP server listening at provided IP address and port. It does not respond in any fashion to sent datagrams. It returns an io.Closer that should be Close'd when you are finished with it.

func StartServerUDPNs

func StartServerUDPNs(t *testing.T, ip net.IP, port int, ns string) io.Closer

StartServerUDPNs is identical to StartServerUDP, but it operates with the network namespace provided by name.

Types

This section is empty.

Jump to

Keyboard shortcuts

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