integration

package
v0.17.1 Latest Latest
Warning

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

Go to latest
Published: Dec 5, 2022 License: BSD-3-Clause Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	TailscaleVersions = append(
		tailscaleVersions2021,
		tailscaleVersions2019...,
	)
)

Functions

This section is empty.

Types

type ControlServer

type ControlServer interface {
	Shutdown() error
	Execute(command []string) (string, error)
	GetHealthEndpoint() string
	GetEndpoint() string
	WaitForReady() error
	CreateNamespace(namespace string) error
	CreateAuthKey(namespace string) (*v1.PreAuthKey, error)
	ListMachinesInNamespace(namespace string) ([]*v1.Machine, error)
	GetCert() []byte
	GetHostname() string
	GetIP() string
}

type Namespace

type Namespace struct {
	Clients map[string]TailscaleClient
	// contains filtered or unexported fields
}

type Scenario

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

TODO(kradalby): make control server configurable, test correctness with Tailscale SaaS.

func NewScenario

func NewScenario() (*Scenario, error)

func (*Scenario) CountTailscale

func (s *Scenario) CountTailscale() int

func (*Scenario) CreateHeadscaleEnv

func (s *Scenario) CreateHeadscaleEnv(
	namespaces map[string]int,
	tsOpts []tsic.Option,
	opts ...hsic.Option,
) error

CreateHeadscaleEnv is a conventient method returning a set up Headcale test environment with nodes of all versions, joined to the server with X namespaces.

func (*Scenario) CreateNamespace

func (s *Scenario) CreateNamespace(namespace string) error

func (*Scenario) CreatePreAuthKey

func (s *Scenario) CreatePreAuthKey(namespace string) (*v1.PreAuthKey, error)

func (*Scenario) CreateTailscaleNodesInNamespace

func (s *Scenario) CreateTailscaleNodesInNamespace(
	namespaceStr string,
	requestedVersion string,
	count int,
	opts ...tsic.Option,
) error

func (*Scenario) GetClients

func (s *Scenario) GetClients(namespace string) ([]TailscaleClient, error)

func (*Scenario) GetIPs

func (s *Scenario) GetIPs(namespace string) ([]netip.Addr, error)

func (*Scenario) Headscale

func (s *Scenario) Headscale(opts ...hsic.Option) (ControlServer, error)

TODO(kradalby): make port and headscale configurable, multiple instances support?

func (*Scenario) ListTailscaleClients

func (s *Scenario) ListTailscaleClients(namespaces ...string) ([]TailscaleClient, error)

func (*Scenario) ListTailscaleClientsFQDNs

func (s *Scenario) ListTailscaleClientsFQDNs(namespaces ...string) ([]string, error)

func (*Scenario) ListTailscaleClientsIPs

func (s *Scenario) ListTailscaleClientsIPs(namespaces ...string) ([]netip.Addr, error)

func (*Scenario) Namespaces

func (s *Scenario) Namespaces() []string

func (*Scenario) RunTailscaleUp

func (s *Scenario) RunTailscaleUp(
	namespaceStr, loginServer, authKey string,
) error

func (*Scenario) Shutdown

func (s *Scenario) Shutdown() error

func (*Scenario) WaitForTailscaleSync

func (s *Scenario) WaitForTailscaleSync() error

type TailscaleClient

type TailscaleClient interface {
	Hostname() string
	Shutdown() error
	Version() string
	Execute(command []string) (string, string, error)
	Up(loginServer, authKey string) error
	UpWithLoginURL(loginServer string) (*url.URL, error)
	IPs() ([]netip.Addr, error)
	FQDN() (string, error)
	Status() (*ipnstate.Status, error)
	WaitForReady() error
	WaitForPeers(expected int) error
	Ping(hostnameOrIP string) error
	ID() string
}

nolint

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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