integration

package
v1.3.3-0...-f31c912 Latest Latest
Warning

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

Go to latest
Published: Jan 9, 2024 License: AGPL-3.0 Imports: 39 Imported by: 0

Documentation

Index

Constants

View Source
const DefaultLicensePath = "/var/lib/teleport/license.pem"
View Source
const IntegrationAdminRole = "integration-admin"

Variables

This section is empty.

Functions

This section is empty.

Types

type Addr

type Addr struct {
	Host string
	Port string
}

func (Addr) IsEmpty

func (addr Addr) IsEmpty() bool

func (Addr) String

func (addr Addr) String() string

type AppI

type AppI interface {
	// Run starts the application
	Run(ctx context.Context) error
	// WaitReady waits till the application finishes initialization
	WaitReady(ctx context.Context) (bool, error)
	// Err returns last error
	Err() error
	// Shutdown shuts the application down
	Shutdown(ctx context.Context) error
}

AppI is an app that can be spawned along with running test.

type Auth

type Auth interface {
	AuthAddr() Addr
}

type AuthService

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

func (*AuthService) AuthAddr

func (auth *AuthService) AuthAddr() Addr

AuthAddr returns auth service external address.

func (*AuthService) ConfigPath

func (auth *AuthService) ConfigPath() string

ConfigPath returns auth service config file path.

func (*AuthService) Err

func (auth *AuthService) Err() error

Err returns auth server error. It's nil If process is not done yet.

func (*AuthService) IsReady

func (auth *AuthService) IsReady() bool

IsReady indicates if auth server is initialized properly.

func (*AuthService) Run

func (auth *AuthService) Run(ctx context.Context) error

Run spawns an auth server instance.

func (*AuthService) Shutdown

func (auth *AuthService) Shutdown(ctx context.Context) error

Shutdown terminates the auth server process and waits for its completion.

func (*AuthService) Stderr

func (auth *AuthService) Stderr() string

Stderr returns a collected auth server process stderr.

func (*AuthService) Stdout

func (auth *AuthService) Stdout() string

Stdout returns a collected auth server process stdout.

func (*AuthService) WaitReady

func (auth *AuthService) WaitReady(ctx context.Context) (bool, error)

WaitReady waits for auth server initialization.

type AuthServiceOption

type AuthServiceOption func(yaml string) string

func WithCache

func WithCache() AuthServiceOption

type AuthSetup

type AuthSetup struct {
	BaseSetup
	Auth         *AuthService
	CacheEnabled bool
}

func (*AuthSetup) SetupService

func (s *AuthSetup) SetupService(authServiceOptions ...AuthServiceOption)

func (*AuthSetup) SetupSuite

func (s *AuthSetup) SetupSuite(t *testing.T)

type BaseSetup

type BaseSetup struct {
	Suite
	Integration *Integration
}

func (*BaseSetup) SetupService

func (s *BaseSetup) SetupService()

func (*BaseSetup) SetupSuite

func (s *BaseSetup) SetupSuite(t *testing.T)

type BinPaths

type BinPaths struct {
	Teleport string
	Tctl     string
	Tsh      string
}

func GetEnterprise

func GetEnterprise(ctx context.Context, ver, outDir string) (BinPaths, error)

GetEnterprise downloads a Teleport Enterprise distribution.

func GetOSS

func GetOSS(ctx context.Context, ver, outDir string) (BinPaths, error)

GetOSS downloads a Teleport OSS distribution.

type Bootstrap

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

func (*Bootstrap) Add

func (bootstrap *Bootstrap) Add(resource types.Resource)

func (*Bootstrap) AddRole

func (bootstrap *Bootstrap) AddRole(name string, spec types.RoleSpecV6) (types.Role, error)

func (*Bootstrap) AddUserWithRoles

func (bootstrap *Bootstrap) AddUserWithRoles(name string, roles ...string) (types.User, error)

func (*Bootstrap) Resources

func (bootstrap *Bootstrap) Resources() []types.Resource

type Client

type Client struct {
	*client.Client
}

Client is a wrapper around *client.Client with some additional methods helpful for testing.

func (*Client) ApproveAccessRequest

func (api *Client) ApproveAccessRequest(ctx context.Context, reqID, reason string) error

ApproveAccessRequest sets an access request state to APPROVED.

func (*Client) DenyAccessRequest

func (api *Client) DenyAccessRequest(ctx context.Context, reqID, reason string) error

ApproveAccessRequest sets an access request state to DENIED.

func (*Client) GetAccessRequest

func (api *Client) GetAccessRequest(ctx context.Context, reqID string) (types.AccessRequest, error)

GetAccessRequest loads an access request.

func (*Client) PollAccessRequestPluginData

func (api *Client) PollAccessRequestPluginData(ctx context.Context, plugin, reqID string) (map[string]string, error)

PollAccessRequestPluginData waits until plugin data for a give request became available.

func (*Client) SearchAccessRequestEvents

func (api *Client) SearchAccessRequestEvents(ctx context.Context, reqID string) ([]*events.AccessRequestCreate, error)

SearchAccessRequestEvents searches for recent access request events in audit log.

func (*Client) SubmitAccessRequestReview

func (api *Client) SubmitAccessRequestReview(ctx context.Context, reqID string, review types.AccessReview) error

SubmitAccessRequestReview is a simpler version of SubmitAccessReview.

type Integration

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

func New

func New(ctx context.Context, paths BinPaths, licenseStr string) (*Integration, error)

New initializes a Teleport installation.

func NewFromEnv

func NewFromEnv(ctx context.Context) (*Integration, error)

NewFromEnv initializes Teleport installation reading binary paths from environment variables such as TELEPORT_BINARY, TELEPORT_BINARY_TCTL or just PATH.

func (*Integration) Bootstrap

func (integration *Integration) Bootstrap(ctx context.Context, auth *AuthService, resources []types.Resource) error

func (*Integration) Close

func (integration *Integration) Close()

Close stops all the spawned processes and does a cleanup.

func (*Integration) MakeAdmin

func (integration *Integration) MakeAdmin(ctx context.Context, auth *AuthService, userName string) (*Client, error)

func (*Integration) NewAuthService

func (integration *Integration) NewAuthService(opts ...AuthServiceOption) (*AuthService, error)

NewAuthService creates a new auth server instance.

func (*Integration) NewClient

func (integration *Integration) NewClient(ctx context.Context, auth *AuthService, userName string) (*Client, error)

NewClient builds an API client for a given user.

func (*Integration) NewProxyService

func (integration *Integration) NewProxyService(auth Auth) (*ProxyService, error)

NewProxyService creates a new auth server instance.

func (*Integration) NewSSHService

func (integration *Integration) NewSSHService(auth Auth) (*SSHService, error)

NewSSHService creates a new auth server instance.

func (*Integration) NewSignedClient

func (integration *Integration) NewSignedClient(ctx context.Context, auth Auth, identityPath, userName string) (*Client, error)

NewSignedClient builds a client for a given user given the identity file.

func (*Integration) NewTsh

func (integration *Integration) NewTsh(proxyAddr, identityPath string) tsh.Tsh

NewTsh makes a new tsh runner.

func (*Integration) SetCAPin

func (integration *Integration) SetCAPin(ctx context.Context, auth *AuthService) error

SetCAPin sets integration with the auth service's CA Pin.

func (*Integration) Sign

func (integration *Integration) Sign(ctx context.Context, auth *AuthService, userName string) (string, error)

Sign generates a credentials file for the user and returns an identity file path.

func (*Integration) SignTLS

func (integration *Integration) SignTLS(ctx context.Context, auth *AuthService, userName string) (*SignTLSPaths, error)

SignTLS generates a set of files to be used for generating the TLS Config: Cert, Key and RootCAs

func (*Integration) Version

func (integration *Integration) Version() Version

Version returns an auth server version.

type ProxyService

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

func (*ProxyService) AuthAddr

func (proxy *ProxyService) AuthAddr() Addr

AuthAddr returns auth service external address.

func (*ProxyService) Err

func (proxy *ProxyService) Err() error

Err returns proxy service error. It's nil If process is not done yet.

func (*ProxyService) IsReady

func (proxy *ProxyService) IsReady() bool

IsReady indicates if proxy service is initialized properly.

func (*ProxyService) ReverseTunnelAddr

func (proxy *ProxyService) ReverseTunnelAddr() Addr

ReverseTunnelAddr returns reverse tunnel external address.

func (*ProxyService) Run

func (proxy *ProxyService) Run(ctx context.Context) error

Run spawns an proxy service instance.

func (*ProxyService) SSHProxyAddr

func (proxy *ProxyService) SSHProxyAddr() Addr

SSHProxyAddr returns SSH Proxy external address.

func (*ProxyService) Shutdown

func (proxy *ProxyService) Shutdown(ctx context.Context) error

Shutdown terminates the proxy service process and waits for its completion.

func (*ProxyService) Stderr

func (proxy *ProxyService) Stderr() string

Stderr returns a collected proxy service process stderr.

func (*ProxyService) Stdout

func (proxy *ProxyService) Stdout() string

Stdout returns a collected proxy service process stdout.

func (*ProxyService) WaitReady

func (proxy *ProxyService) WaitReady(ctx context.Context) (bool, error)

WaitReady waits for proxy service initialization.

func (*ProxyService) WebAndSSHProxyAddr

func (proxy *ProxyService) WebAndSSHProxyAddr() string

WebAndSSHProxyAddr returns string in a format "host:webport,sshport" needed as tsh --proxy option.

func (*ProxyService) WebProxyAddr

func (proxy *ProxyService) WebProxyAddr() Addr

WebProxyAddr returns Web Proxy external address.

type ProxySetup

type ProxySetup struct {
	AuthSetup
	Proxy *ProxyService
}

func (*ProxySetup) SetupService

func (s *ProxySetup) SetupService()

func (*ProxySetup) SetupSuite

func (s *ProxySetup) SetupSuite(t *testing.T)

type SSHService

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

func (*SSHService) Addr

func (ssh *SSHService) Addr() Addr

Addr returns SSH external address.

func (*SSHService) Err

func (ssh *SSHService) Err() error

Err returns ssh service error. It's nil If process is not done yet.

func (*SSHService) IsReady

func (ssh *SSHService) IsReady() bool

IsReady indicates if ssh service is initialized properly.

func (*SSHService) Run

func (ssh *SSHService) Run(ctx context.Context) error

Run spawns an ssh service instance.

func (*SSHService) Shutdown

func (ssh *SSHService) Shutdown(ctx context.Context) error

Shutdown terminates the ssh service process and waits for its completion.

func (*SSHService) Stderr

func (ssh *SSHService) Stderr() string

Stderr returns a collected ssh service process stderr.

func (*SSHService) Stdout

func (ssh *SSHService) Stdout() string

Stdout returns a collected ssh service process stdout.

func (*SSHService) WaitReady

func (ssh *SSHService) WaitReady(ctx context.Context) (bool, error)

WaitReady waits for ssh service initialization.

type SSHSetup

type SSHSetup struct {
	ProxySetup
	SSH *SSHService
}

func (*SSHSetup) SetupService

func (s *SSHSetup) SetupService()

func (*SSHSetup) SetupSuite

func (s *SSHSetup) SetupSuite(t *testing.T)

type Service

type Service interface {
	Run(context.Context) error
	WaitReady(ctx context.Context) (bool, error)
	Err() error
	Shutdown(context.Context) error
}

type SignTLSPaths

type SignTLSPaths struct {
	CertPath   string
	KeyPath    string
	RootCAPath string
}

type Suite

type Suite struct {
	suite.Suite
	// contains filtered or unexported fields
}

Suite is a basic testing suite enhanced with context management.

func (*Suite) Context

func (s *Suite) Context() context.Context

Context returns a current test context.

func (*Suite) NewTmpFile

func (s *Suite) NewTmpFile(pattern string) *os.File

NewTmpFile creates a new temporary file.

func (*Suite) SetContextTimeout

func (s *Suite) SetContextTimeout(timeout time.Duration) context.Context

SetContextTimeout limits the lifetime of test and app contexts.

func (*Suite) SetT

func (s *Suite) SetT(t *testing.T)

SetT sets the current *testing.T context.

func (*Suite) StartApp

func (s *Suite) StartApp(app AppI)

StartApp spawns an app in parallel with the running test/suite.

type Version

type Version struct {
	*version.Version
	IsEnterprise bool
}

Jump to

Keyboard shortcuts

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