Movatterモバイル変換


[0]ホーム

URL:


integration

package
v2.23.0Latest Latest
Warning

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

Go to latest
Published: Jun 3, 2025 License:AGPL-3.0Imports:37Imported by:0

Details

Repository

github.com/coder/coder

Links

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Client1 =Client{Number:ClientNumber1,ID:uuid.MustParse("00000000-0000-0000-0000-000000000001"),ListenPort:     client1Port,ShouldRunTests:true,}
View Source
var Client2 =Client{Number:ClientNumber2,ID:uuid.MustParse("00000000-0000-0000-0000-000000000002"),ListenPort:     client2Port,ShouldRunTests:false,}

Functions

funcExecBackgroundadded inv2.12.0

func ExecBackground(t *testing.T, processNamestring, netNS *os.File, namestring, args []string) (<-chanerror, func()error)

ExecBackground starts a subprocess with the given flags and returns achannel that will receive the error when the subprocess exits. The returnedfunction can be used to close the subprocess.

processName is used to identify the subprocess in logs.

Optionally, a network namespace can be passed to run the subprocess in.

Do not call close then wait on the channel. Use the returned value from thefunction instead in this case.

Cleanup is handled automatically if you don't care about monitoring theprocess manually.

funcStartClientDERPadded inv2.12.0

func StartClientDERP(t *testing.T, loggerslog.Logger, serverURL *url.URL, derpMap *tailcfg.DERPMap, me, peerClient) *tailnet.Conn

StartClientDERP creates a client connection to the server for coordinationand creates a tailnet.Conn which will only use DERP to connect to the peer.

funcStartClientDERPWebSocketsadded inv2.12.0

func StartClientDERPWebSockets(t *testing.T, loggerslog.Logger, serverURL *url.URL, derpMap *tailcfg.DERPMap, me, peerClient) *tailnet.Conn

StartClientDERPWebSockets does the same thing as StartClientDERP but willonly use DERP WebSocket fallback.

funcStartClientDirectadded inv2.12.0

func StartClientDirect(t *testing.T, loggerslog.Logger, serverURL *url.URL, derpMap *tailcfg.DERPMap, me, peerClient) *tailnet.Conn

StartClientDirect does the same thing as StartClientDERP but disablesBlockEndpoints (which enables Direct connections), and waits for a directconnection to be established between the two peers.

funcTestSuiteadded inv2.12.0

func TestSuite(t *testing.T, _slog.Logger, serverURL *url.URL, conn *tailnet.Conn, _, peerClient)

TODO: instead of reusing one conn for each suite, maybe we should make a newone for each subtest?

Types

typeClientadded inv2.12.0

type Client struct {NumberClientNumberIDuuid.UUIDListenPortuint16ShouldRunTestsbool}

typeClientNumberadded inv2.12.0

type ClientNumberint
const (ClientNumber1ClientNumber = 1ClientNumber2ClientNumber = 2)

typeClientStarteradded inv2.12.0

type ClientStarter struct {Options *tailnet.Options}

typeNGINXServerOptionsadded inv2.12.0

type NGINXServerOptions struct {SimpleServerOptions}

func (NGINXServerOptions)StartServeradded inv2.12.0

func (oNGINXServerOptions) StartServer(t *testing.T, loggerslog.Logger, listenAddrstring)

typeServerStarteradded inv2.12.0

type ServerStarter interface {// StartServer should start the server and return once it's listening. It// should not block once it's listening. Cleanup should be handled by// t.Cleanup.StartServer(t *testing.T, loggerslog.Logger, listenAddrstring)}

typeSimpleServerOptionsadded inv2.12.0

type SimpleServerOptions struct {// FailUpgradeDERP will make the DERP server fail to handle the initial DERP// upgrade in a way that causes the client to fallback to// DERP-over-WebSocket fallback automatically.// Incompatible with DERPWebsocketOnly.FailUpgradeDERPbool// DERPWebsocketOnly will make the DERP server only accept WebSocket// connections. If a DERP request is received that is not using WebSocket// fallback, the test will fail.// Incompatible with FailUpgradeDERP.DERPWebsocketOnlybool}

func (SimpleServerOptions)Routeradded inv2.12.0

func (oSimpleServerOptions) Router(t *testing.T, loggerslog.Logger) *chi.Mux

func (SimpleServerOptions)StartServeradded inv2.12.0

func (oSimpleServerOptions) StartServer(t *testing.T, loggerslog.Logger, listenAddrstring)

typeTestNetworking

type TestNetworking struct {ServerTestNetworkingServerSTUNs   []TestNetworkingSTUNClient1TestNetworkingClientClient2TestNetworkingClient}

funcSetupNetworkingEasyNATadded inv2.12.0

func SetupNetworkingEasyNAT(t *testing.T, _slog.Logger)TestNetworking

SetupNetworkingEasyNAT creates a fake internet and sets up "easy NAT"forwarding rules.See createFakeInternet.NAT is achieved through a single iptables masquerade rule.

funcSetupNetworkingEasyNATWithSTUNadded inv2.12.0

func SetupNetworkingEasyNATWithSTUN(t *testing.T, _slog.Logger)TestNetworking

SetupNetworkingEasyNATWithSTUN does the same as SetupNetworkingEasyNAT, butalso creates a namespace and bridge address for a STUN server.

funcSetupNetworkingHardNATEasyNATDirectadded inv2.12.0

func SetupNetworkingHardNATEasyNATDirect(t *testing.T, _slog.Logger)TestNetworking

funcSetupNetworkingLoopback

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

SetupNetworkingLoopback creates a network namespace with a loopback interfacefor all tests to share. This is the simplest networking setup. The networknamespace only exists for isolation on the host and doesn't serve any routingpurpose.

typeTestNetworkingClientadded inv2.12.0

type TestNetworkingClient struct {ProcessTestNetworkingProcess// ServerAccessURL is the hostname and port that the client uses to access// the server over HTTP for coordination.ServerAccessURLstring// DERPMap is the DERP map that the client uses. If nil, a basic DERP map// containing only a single DERP with `ServerAccessURL` is used with no// STUN servers.DERPMap *tailcfg.DERPMap}

func (TestNetworkingClient)ResolveDERPMapadded inv2.12.0

func (cTestNetworkingClient) ResolveDERPMap() (*tailcfg.DERPMap,error)

typeTestNetworkingProcess

type TestNetworkingProcess struct {// NetNS to enter. If nil, the current network namespace is used.NetNS *os.File}

typeTestNetworkingSTUNadded inv2.12.0

type TestNetworkingSTUN struct {ProcessTestNetworkingProcessIPstringListenAddrstring}

typeTestNetworkingServeradded inv2.12.0

type TestNetworkingServer struct {ProcessTestNetworkingProcessListenAddrstring}

typeTestTopology

type TestTopology struct {Namestring// 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, loggerslog.Logger)TestNetworking// Server is the server starter for the test. It is executed in the server// subprocess.ServerServerStarter// 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, loggerslog.Logger, serverURL *url.URL, derpMap *tailcfg.DERPMap, meClient, peerClient) *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, loggerslog.Logger, serverURL *url.URL, conn *tailnet.Conn, meClient, peerClient)}

Source Files

View all Source files

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f orF : Jump to
y orY : Canonical URL
go.dev uses cookies from Google to deliver and enhance the quality of its services and to analyze traffic.Learn more.

[8]ページ先頭

©2009-2025 Movatter.jp