Documentation ¶
Index ¶
- Constants
- type Addr
- type AppI
- type Auth
- type AuthService
- func (auth *AuthService) AuthAddr() Addr
- func (auth *AuthService) ConfigPath() string
- func (auth *AuthService) Err() error
- func (auth *AuthService) IsReady() bool
- func (auth *AuthService) Run(ctx context.Context) error
- func (auth *AuthService) Shutdown(ctx context.Context) error
- func (auth *AuthService) Stderr() string
- func (auth *AuthService) Stdout() string
- func (auth *AuthService) WaitReady(ctx context.Context) (bool, error)
- type AuthServiceOption
- type AuthSetup
- type BaseSetup
- type BinPaths
- type Bootstrap
- func (bootstrap *Bootstrap) Add(resource types.Resource)
- func (bootstrap *Bootstrap) AddRole(name string, spec types.RoleSpecV6) (types.Role, error)
- func (bootstrap *Bootstrap) AddUserWithRoles(name string, roles ...string) (types.User, error)
- func (bootstrap *Bootstrap) Resources() []types.Resource
- type Client
- func (api *Client) ApproveAccessRequest(ctx context.Context, reqID, reason string) error
- func (api *Client) DenyAccessRequest(ctx context.Context, reqID, reason string) error
- func (api *Client) GetAccessRequest(ctx context.Context, reqID string) (types.AccessRequest, error)
- func (api *Client) PollAccessRequestPluginData(ctx context.Context, plugin, reqID string) (map[string]string, error)
- func (api *Client) SearchAccessRequestEvents(ctx context.Context, reqID string) ([]*events.AccessRequestCreate, error)
- func (api *Client) SubmitAccessRequestReview(ctx context.Context, reqID string, review types.AccessReview) error
- type Integration
- func (integration *Integration) Bootstrap(ctx context.Context, auth *AuthService, resources []types.Resource) error
- func (integration *Integration) Close()
- func (integration *Integration) MakeAdmin(ctx context.Context, auth *AuthService, userName string) (*Client, error)
- func (integration *Integration) NewAuthService(opts ...AuthServiceOption) (*AuthService, error)
- func (integration *Integration) NewClient(ctx context.Context, auth *AuthService, userName string) (*Client, error)
- func (integration *Integration) NewProxyService(auth Auth) (*ProxyService, error)
- func (integration *Integration) NewSSHService(auth Auth) (*SSHService, error)
- func (integration *Integration) NewSignedClient(ctx context.Context, auth Auth, identityPath, userName string) (*Client, error)
- func (integration *Integration) NewTsh(proxyAddr, identityPath string) tsh.Tsh
- func (integration *Integration) SetCAPin(ctx context.Context, auth *AuthService) error
- func (integration *Integration) Sign(ctx context.Context, auth *AuthService, userName string) (string, error)
- func (integration *Integration) SignTLS(ctx context.Context, auth *AuthService, userName string) (*SignTLSPaths, error)
- func (integration *Integration) Version() Version
- type ProxyService
- func (proxy *ProxyService) AuthAddr() Addr
- func (proxy *ProxyService) Err() error
- func (proxy *ProxyService) IsReady() bool
- func (proxy *ProxyService) ReverseTunnelAddr() Addr
- func (proxy *ProxyService) Run(ctx context.Context) error
- func (proxy *ProxyService) SSHProxyAddr() Addr
- func (proxy *ProxyService) Shutdown(ctx context.Context) error
- func (proxy *ProxyService) Stderr() string
- func (proxy *ProxyService) Stdout() string
- func (proxy *ProxyService) WaitReady(ctx context.Context) (bool, error)
- func (proxy *ProxyService) WebAndSSHProxyAddr() string
- func (proxy *ProxyService) WebProxyAddr() Addr
- type ProxySetup
- type SSHService
- func (ssh *SSHService) Addr() Addr
- func (ssh *SSHService) Err() error
- func (ssh *SSHService) IsReady() bool
- func (ssh *SSHService) Run(ctx context.Context) error
- func (ssh *SSHService) Shutdown(ctx context.Context) error
- func (ssh *SSHService) Stderr() string
- func (ssh *SSHService) Stdout() string
- func (ssh *SSHService) WaitReady(ctx context.Context) (bool, error)
- type SSHSetup
- type Service
- type SignTLSPaths
- type Suite
- type Version
Constants ¶
const DefaultLicensePath = "/var/lib/teleport/license.pem"
const IntegrationAdminRole = "integration-admin"
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
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 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.
type AuthServiceOption ¶
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 ¶
type BaseSetup ¶
type BaseSetup struct { Suite Integration *Integration }
func (*BaseSetup) SetupService ¶
func (s *BaseSetup) SetupService()
func (*BaseSetup) SetupSuite ¶
type BinPaths ¶
func GetEnterprise ¶
GetEnterprise downloads a Teleport Enterprise distribution.
type Bootstrap ¶
type Bootstrap struct {
// contains filtered or unexported fields
}
func (*Bootstrap) AddUserWithRoles ¶
type Client ¶
Client is a wrapper around *client.Client with some additional methods helpful for testing.
func (*Client) ApproveAccessRequest ¶
ApproveAccessRequest sets an access request state to APPROVED.
func (*Client) DenyAccessRequest ¶
ApproveAccessRequest sets an access request state to DENIED.
func (*Client) GetAccessRequest ¶
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 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) 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.
type SSHSetup ¶
type SSHSetup struct { ProxySetup SSH *SSHService }
func (*SSHSetup) SetupService ¶
func (s *SSHSetup) SetupService()
func (*SSHSetup) SetupSuite ¶
type SignTLSPaths ¶
type Suite ¶
Suite is a basic testing suite enhanced with context management.
func (*Suite) NewTmpFile ¶
NewTmpFile creates a new temporary file.
func (*Suite) SetContextTimeout ¶
SetContextTimeout limits the lifetime of test and app contexts.