Movatterモバイル変換


[0]ホーム

URL:


integration

package
v1.92.2Latest Latest
Warning

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

Go to latest
Published: Dec 10, 2025 License:BSD-3-ClauseImports:81Imported by:4

Details

Repository

github.com/tailscale/tailscale

Links

Documentation

Overview

Package integration contains Tailscale integration tests.

This package is considered internal and the public API is subjectto change without notice.

Index

Constants

This section is empty.

Variables

MainError is an error that's set if an error conditions happens outside of acontext where a testing.TB is available. The caller can check it in its TestMainas a last ditch place to report errors.

Functions

funcRunDERPAndSTUNadded inv1.12.0

func RunDERPAndSTUN(ttesting.TB, logflogger.Logf, ipAddressstring) (derpMap *tailcfg.DERPMap)

RunDERPAndSTUN runs a local DERP and STUN server for tests, returning the derpMapthat clients should use. This creates resources that must be cleaned up with thereturned cleanup function.

Types

typeBinaries

type Binaries struct {DirstringTailscaleBinaryInfoTailscaledBinaryInfo}

Binaries contains the paths to the tailscale and tailscaled binaries.

funcGetBinariesadded inv1.84.0

func GetBinaries(tbtesting.TB) *Binaries

GetBinaries create a temp directory using tb and builds (or copies previouslybuilt) cmd/tailscale and cmd/tailscaled binaries into that directory.

It fails tb if the build or binary copies fail.

typeBinaryInfoadded inv1.84.0

type BinaryInfo struct {Pathstring// abs path to tailscale or tailscaled binarySizeint64// FD and FDmu are set on Unix to efficiently copy the binary to a new// test's automatically-cleaned-up temp directory.FD   *os.File// for Unix (macOS, Linux, ...)FDMusync.Locker// Contents is used on Windows instead of FD to copy the binary between// test directories. (On Windows you can't keep an FD open while an earlier// test's temp directories are deleted.)// This burns some memory and costs more in I/O, but oh well.Contents []byte}

BinaryInfo describes a tailscale or tailscaled binary.

func (BinaryInfo)CopyToadded inv1.84.0

func (bBinaryInfo) CopyTo(dirstring) (BinaryInfo,error)

typeConfigureControladded inv1.84.0

type ConfigureControl func(*testcontrol.Server)

ConfigureControl is a test option that configures the test control server.

func (ConfigureControl)ModifyTestEnvadded inv1.84.0

func (fConfigureControl) ModifyTestEnv(te *TestEnv)

typeDaemonadded inv1.84.0

type Daemon struct {Process *os.Process}

func (*Daemon)MustCleanShutdownadded inv1.84.0

func (d *Daemon) MustCleanShutdown(ttesting.TB)

typeLogCatcheradded inv1.12.0

type LogCatcher struct {// contains filtered or unexported fields}

LogCatcher is a minimal logcatcher for the logtail upload client.

func (*LogCatcher)Resetadded inv1.12.0

func (lc *LogCatcher) Reset()

Reset clears the buffered logs from memory.

func (*LogCatcher)ServeHTTPadded inv1.12.0

func (lc *LogCatcher) ServeHTTP(whttp.ResponseWriter, r *http.Request)

func (*LogCatcher)StoreRawJSONadded inv1.22.0

func (lc *LogCatcher) StoreRawJSON()

StoreRawJSON instructs lc to save the raw JSON uploads, rather than just the text.

func (*LogCatcher)UseLogfadded inv1.12.0

func (lc *LogCatcher) UseLogf(fnlogger.Logf)

UseLogf makes the logcatcher implementation use a given logf functionto dump all logs to.

typeTestEnvadded inv1.84.0

type TestEnv struct {LogCatcher       *LogCatcherLogCatcherServer *httptest.ServerControl       *testcontrol.ServerControlServer *httptest.ServerTrafficTrap       *trafficTrapTrafficTrapServer *httptest.Server// contains filtered or unexported fields}

TestEnv contains the test environment (set of servers) used by oneor more nodes.

funcNewTestEnvadded inv1.84.0

func NewTestEnv(ttesting.TB, opts ...TestEnvOpt) *TestEnv

NewTestEnv starts a bunch of services and returns a new test environment.NewTestEnv arranges for the environment's resources to be cleaned up on exit.

func (*TestEnv)ControlURLadded inv1.84.0

func (e *TestEnv) ControlURL()string

ControlURL returns e.ControlServer.URL, panicking if it's the empty string,which it should never be in tests.

typeTestEnvOptadded inv1.84.0

type TestEnvOpt interface {ModifyTestEnv(*TestEnv)}

TestEnvOpt represents an option that can be passed to NewTestEnv.

typeTestNodeadded inv1.84.0

type TestNode struct {// contains filtered or unexported fields}

TestNode is a machine with a tailscale & tailscaled.Currently, the test is simplistic and user==node==machine.That may grow complexity later to test more.

funcNewTestNodeadded inv1.84.0

func NewTestNode(t *testing.T, env *TestEnv) *TestNode

NewTestNode allocates a temp directory for a new test node.The node is not started automatically.

func (*TestNode)AwaitBackendStateadded inv1.84.0

func (n *TestNode) AwaitBackendState(statestring)

func (*TestNode)AwaitIP4added inv1.84.0

func (n *TestNode) AwaitIP4()netip.Addr

AwaitIP4 returns the IPv4 address of n.

func (*TestNode)AwaitIP6added inv1.84.0

func (n *TestNode) AwaitIP6()netip.Addr

AwaitIP6 returns the IPv6 address of n.

func (*TestNode)AwaitIPsadded inv1.84.0

func (n *TestNode) AwaitIPs() []netip.Addr

func (*TestNode)AwaitListeningadded inv1.84.0

func (n *TestNode) AwaitListening()

AwaitListening waits for the tailscaled to be serving local clientsover its localhost IPC mechanism. (Unix socket, etc)

func (*TestNode)AwaitNeedsLoginadded inv1.84.0

func (n *TestNode) AwaitNeedsLogin()

AwaitNeedsLogin waits for n to reach the IPN state "NeedsLogin".

func (*TestNode)AwaitRespondingadded inv1.84.0

func (n *TestNode) AwaitResponding()

AwaitResponding waits for n's tailscaled to be up enough to beresponding, but doesn't wait for any particular state.

func (*TestNode)AwaitRunningadded inv1.84.0

func (n *TestNode) AwaitRunning()

AwaitRunning waits for n to reach the IPN state "Running".

func (*TestNode)AwaitSocksAddradded inv1.84.0

func (n *TestNode) AwaitSocksAddr(ch <-chanstring)string

func (*TestNode)LocalClientadded inv1.84.0

func (n *TestNode) LocalClient() *local.Client

func (*TestNode)MustDownadded inv1.84.0

func (n *TestNode) MustDown()

func (*TestNode)MustLogOutadded inv1.84.0

func (n *TestNode) MustLogOut()

func (*TestNode)MustStatusadded inv1.84.0

func (n *TestNode) MustStatus() *ipnstate.Status

func (*TestNode)MustUpadded inv1.84.0

func (n *TestNode) MustUp(extraArgs ...string)

func (*TestNode)NLPublicKeyadded inv1.92.0

func (n *TestNode) NLPublicKey()string

NLPublicKey returns the hex-encoded network lock public key ofthis node, e.g. `tlpub:123456abc`

func (*TestNode)Pingadded inv1.84.0

func (n *TestNode) Ping(otherNode *TestNode)error

func (*TestNode)PublicKeyadded inv1.92.0

func (n *TestNode) PublicKey()string

PublicKey returns the hex-encoded public key of this node,e.g. `nodekey:123456abc`

func (*TestNode)StartDaemonadded inv1.84.0

func (n *TestNode) StartDaemon() *Daemon

StartDaemon starts the node's tailscaled, failing if it fails to start.StartDaemon ensures that the process will exit when the test completes.

func (*TestNode)StartDaemonAsIPNGOOSadded inv1.84.0

func (n *TestNode) StartDaemonAsIPNGOOS(ipnGOOSstring) *Daemon

func (*TestNode)Statusadded inv1.84.0

func (n *TestNode) Status() (*ipnstate.Status,error)

func (*TestNode)Tailscaleadded inv1.84.0

func (n *TestNode) Tailscale(arg ...string) *exec.Cmd

Tailscale returns a command that runs the tailscale CLI with the provided arguments.It does not start the process.

func (*TestNode)TailscaleForOutputadded inv1.84.0

func (n *TestNode) TailscaleForOutput(arg ...string) *exec.Cmd

Source Files

View all Source files

Directories

PathSynopsis
Package testcontrol contains a minimal control plane server for testing purposes.
Package testcontrol contains a minimal control plane server for testing purposes.
Package vms does VM-based integration/functional tests by using qemu and a bank of pre-made VM images.
Package vms does VM-based integration/functional tests by using qemu and a bank of pre-made VM images.

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