integration

package
v2.11.2 Latest Latest
Warning

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

Go to latest
Published: May 22, 2024 License: AGPL-3.0 Imports: 28 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	Client1ID = uuid.MustParse("00000000-0000-0000-0000-000000000001")
	Client2ID = uuid.MustParse("00000000-0000-0000-0000-000000000002")
)

IDs used in tests.

Functions

func StartClientBasic

func StartClientBasic(t *testing.T, logger slog.Logger, serverURL *url.URL, myID uuid.UUID, peerID uuid.UUID) *tailnet.Conn

func StartServerBasic

func StartServerBasic(t *testing.T, logger slog.Logger, listenAddr string)

Types

type TestNetworking

type TestNetworking struct {
	// ServerListenAddr is the IP address and port that the server listens on,
	// passed to StartServer.
	ServerListenAddr string
	// ServerAccessURLClient1 is the hostname and port that the first client
	// uses to access the server.
	ServerAccessURLClient1 string
	// ServerAccessURLClient2 is the hostname and port that the second client
	// uses to access the server.
	ServerAccessURLClient2 string

	// Networking settings for each subprocess.
	ProcessServer  TestNetworkingProcess
	ProcessClient1 TestNetworkingProcess
	ProcessClient2 TestNetworkingProcess
}

func SetupNetworkingLoopback

func SetupNetworkingLoopback(t *testing.T, _ slog.Logger) TestNetworking

type TestNetworkingProcess

type TestNetworkingProcess struct {
	// NetNS to enter. If zero, the current network namespace is used.
	NetNSFd int
}

type TestTopology

type TestTopology struct {
	Name string
	// SetupNetworking creates interfaces and network namespaces for the test.
	// The most simple implementation is NetworkSetupDefault, which only creates
	// a network namespace shared for all tests.
	SetupNetworking func(t *testing.T, logger slog.Logger) TestNetworking

	// StartServer gets called in the server subprocess. It's expected to start
	// the coordinator server in the background and return.
	StartServer func(t *testing.T, logger slog.Logger, listenAddr string)
	// StartClient gets called in each client subprocess. It's expected to
	// create the tailnet.Conn and ensure connectivity to it's peer.
	StartClient func(t *testing.T, logger slog.Logger, serverURL *url.URL, myID uuid.UUID, peerID uuid.UUID) *tailnet.Conn

	// RunTests is the main test function. It's called in each of the client
	// subprocesses. If tests can only run once, they should check the client ID
	// and return early if it's not the expected one.
	RunTests func(t *testing.T, logger slog.Logger, serverURL *url.URL, myID uuid.UUID, peerID uuid.UUID, conn *tailnet.Conn)
}

Jump to

Keyboard shortcuts

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