testutil

package
v0.0.0-...-51da36d Latest Latest
Warning

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

Go to latest
Published: Feb 20, 2024 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

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 SetupCrossNsDNAT

func SetupCrossNsDNAT(t *testing.T)

SetupCrossNsDNAT sets up a network namespace, named "test", a veth pair, and a NAT rule in the "test" network namespace

func SetupDNAT

func SetupDNAT(t *testing.T)

SetupDNAT sets up a NAT translation from: * 2.2.2.2 to 1.1.1.1 (OUTPUT Chain) * 3.3.3.3 to 1.1.1.1 (PREROUTING Chain)

func SetupDNAT6

func SetupDNAT6(t *testing.T)

SetupDNAT6 sets up a NAT translation from fd00::2 to fd00::1

func SetupVethPair

func SetupVethPair(t *testing.T)

SetupVethPair sets up a network namespace, named "test", along with two IP addresses 2.2.2.3 and 2.2.2.4 to be used for namespace aware tests. 2.2.2.4 is within the "test" namespace, while 2.2.2.3 is a peer in the root namespace.

func TeardownCrossNsDNAT

func TeardownCrossNsDNAT(t *testing.T)

TeardownCrossNsDNAT cleans up the resources created by SetupCrossNsDNAT

func TeardownDNAT

func TeardownDNAT(t *testing.T)

TeardownDNAT cleans up the resources created by SetupDNAT

func TeardownDNAT6

func TeardownDNAT6(t *testing.T)

TeardownDNAT6 cleans up the resources created by SetupDNAT6

func TeardownVethPair

func TeardownVethPair(t *testing.T)

TeardownVethPair cleans up the resources created by SetupVethPair

Types

This section is empty.

Jump to

Keyboard shortcuts

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