testutils

package
v0.0.0-...-3bfe646 Latest Latest
Warning

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

Go to latest
Published: Jun 28, 2023 License: Apache-2.0 Imports: 31 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AddOption

type AddOption func(*S3, S3App)

AddOption represents an object add option

func WithLatest

func WithLatest() AddOption

WithLatest adds the provided app to the latest bucket

func WithStable

func WithStable() AddOption

WithStable adds the provided app to the stable bucket

type AuthClient

type AuthClient struct {
	storage.Backend
}

AuthClient implements Teleport's auth.ClientI interface

func (*AuthClient) AuthenticateSSHUser

func (s *AuthClient) AuthenticateSSHUser(req auth.AuthenticateSSHRequest) (*auth.SSHLoginResponse, error)

func (*AuthClient) AuthenticateWebUser

func (s *AuthClient) AuthenticateWebUser(req auth.AuthenticateUserRequest) (services.WebSession, error)

func (*AuthClient) ChangePassword

func (s *AuthClient) ChangePassword(req services.ChangePasswordReq) error

func (*AuthClient) CheckPassword

func (s *AuthClient) CheckPassword(user string, password []byte, otpToken string) error

func (*AuthClient) Close

func (s *AuthClient) Close() error

func (*AuthClient) CreateGithubAuthRequest

func (s *AuthClient) CreateGithubAuthRequest(req services.GithubAuthRequest) (*services.GithubAuthRequest, error)

func (*AuthClient) CreateOIDCAuthRequest

func (s *AuthClient) CreateOIDCAuthRequest(req services.OIDCAuthRequest) (*services.OIDCAuthRequest, error)

func (*AuthClient) CreateSAMLAuthRequest

func (s *AuthClient) CreateSAMLAuthRequest(req services.SAMLAuthRequest) (*services.SAMLAuthRequest, error)

func (*AuthClient) CreateSAMLConnector

func (s *AuthClient) CreateSAMLConnector(connector services.SAMLConnector) error

func (*AuthClient) CreateSession

func (s *AuthClient) CreateSession(sess session.Session) error

func (*AuthClient) CreateSignupToken

func (s *AuthClient) CreateSignupToken(user services.UserV1, ttl time.Duration) (string, error)

func (*AuthClient) CreateUserWithOTP

func (s *AuthClient) CreateUserWithOTP(token, password, otpToken string) (services.WebSession, error)

func (*AuthClient) CreateUserWithU2FToken

func (s *AuthClient) CreateUserWithU2FToken(token string, password string, u2fRegisterResponse u2f.RegisterResponse) (services.WebSession, error)

func (*AuthClient) CreateUserWithoutOTP

func (s *AuthClient) CreateUserWithoutOTP(token string, password string) (services.WebSession, error)

func (*AuthClient) CreateWebSession

func (s *AuthClient) CreateWebSession(user string) (services.WebSession, error)

func (*AuthClient) DeleteGithubConnector

func (s *AuthClient) DeleteGithubConnector(id string) error

func (*AuthClient) DeleteOIDCConnector

func (s *AuthClient) DeleteOIDCConnector(connectorID string) error

func (*AuthClient) DeleteSAMLConnector

func (s *AuthClient) DeleteSAMLConnector(connectorID string) error

func (*AuthClient) DeleteSession

func (s *AuthClient) DeleteSession(namespace string, id session.ID) error

func (*AuthClient) DeleteToken

func (s *AuthClient) DeleteToken(token string) error

func (*AuthClient) DeleteUser

func (s *AuthClient) DeleteUser(user string) error

func (*AuthClient) DeleteWebSession

func (s *AuthClient) DeleteWebSession(user, sid string) error

func (*AuthClient) EmitAuditEvent

func (s *AuthClient) EmitAuditEvent(event events.Event, fields events.EventFields) error

func (*AuthClient) ExtendWebSession

func (s *AuthClient) ExtendWebSession(user, prevSID string) (services.WebSession, error)

func (*AuthClient) GenerateHostCert

func (s *AuthClient) GenerateHostCert(key []byte, hostID, nodeName string, principals []string, clusterName string, roles teleport.Roles, ttl time.Duration) ([]byte, error)

func (*AuthClient) GenerateKeyPair

func (s *AuthClient) GenerateKeyPair(pass string) ([]byte, []byte, error)

func (*AuthClient) GenerateServerKeys

func (s *AuthClient) GenerateServerKeys(auth.GenerateServerKeysRequest) (*auth.PackedKeys, error)

func (*AuthClient) GenerateToken

func (s *AuthClient) GenerateToken(req auth.GenerateTokenRequest) (string, error)

func (*AuthClient) GenerateUserCert

func (s *AuthClient) GenerateUserCert(key []byte, user string, ttl time.Duration, compatibility string) ([]byte, error)

func (*AuthClient) GenerateUserCerts

func (s *AuthClient) GenerateUserCerts(key []byte, user string, ttl time.Duration, compatibility string) ([]byte, []byte, error)

func (*AuthClient) GetAuthPreference

func (s *AuthClient) GetAuthPreference() (services.AuthPreference, error)

func (*AuthClient) GetClusterCACert

func (s *AuthClient) GetClusterCACert() (*auth.LocalCAResponse, error)

func (*AuthClient) GetClusterConfig

func (s *AuthClient) GetClusterConfig() (services.ClusterConfig, error)

func (*AuthClient) GetClusterName

func (s *AuthClient) GetClusterName() (services.ClusterName, error)

func (*AuthClient) GetDomainName

func (s *AuthClient) GetDomainName() (string, error)

func (*AuthClient) GetOIDCConnector

func (s *AuthClient) GetOIDCConnector(id string, withSecrets bool) (services.OIDCConnector, error)

func (*AuthClient) GetOIDCConnectors

func (s *AuthClient) GetOIDCConnectors(withSecrets bool) ([]services.OIDCConnector, error)

func (*AuthClient) GetSAMLConnector

func (s *AuthClient) GetSAMLConnector(id string, withSecrets bool) (services.SAMLConnector, error)

func (*AuthClient) GetSAMLConnectors

func (s *AuthClient) GetSAMLConnectors(withSecrets bool) ([]services.SAMLConnector, error)

func (*AuthClient) GetSession

func (s *AuthClient) GetSession(namespace string, id session.ID) (*session.Session, error)

func (*AuthClient) GetSessionChunk

func (s *AuthClient) GetSessionChunk(namespace string, sid session.ID, offsetBytes, maxBytes int) ([]byte, error)

func (*AuthClient) GetSessionEvents

func (s *AuthClient) GetSessionEvents(namespace string, sid session.ID, after int, b bool) ([]events.EventFields, error)

func (*AuthClient) GetSessions

func (s *AuthClient) GetSessions(namespace string) ([]session.Session, error)

func (*AuthClient) GetSignupTokenData

func (s *AuthClient) GetSignupTokenData(token string) (user string, otpQRCode []byte, e error)

func (*AuthClient) GetSignupU2FRegisterRequest

func (s *AuthClient) GetSignupU2FRegisterRequest(token string) (*u2f.RegisterRequest, error)

func (*AuthClient) GetStaticTokens

func (s *AuthClient) GetStaticTokens() (services.StaticTokens, error)

func (*AuthClient) GetToken

func (s *AuthClient) GetToken(token string) (*services.ProvisionToken, error)

func (*AuthClient) GetTokens

func (s *AuthClient) GetTokens() (tokens []services.ProvisionToken, err error)

func (*AuthClient) GetU2FSignRequest

func (s *AuthClient) GetU2FSignRequest(user string, password []byte) (*u2f.SignRequest, error)

func (*AuthClient) GetUser

func (s *AuthClient) GetUser(name string) (services.User, error)

func (*AuthClient) GetUsers

func (s *AuthClient) GetUsers() ([]services.User, error)

func (*AuthClient) GetWebSessionInfo

func (s *AuthClient) GetWebSessionInfo(user, sid string) (services.WebSession, error)

func (*AuthClient) PostSessionChunk

func (s *AuthClient) PostSessionChunk(namespace string, sid session.ID, reader io.Reader) error

func (*AuthClient) PostSessionSlice

func (s *AuthClient) PostSessionSlice(events.SessionSlice) error

func (*AuthClient) PreAuthenticatedSignIn

func (s *AuthClient) PreAuthenticatedSignIn(user string) (services.WebSession, error)

func (*AuthClient) ProcessKubeCSR

func (s *AuthClient) ProcessKubeCSR(req auth.KubeCSR) (*auth.KubeCSRResponse, error)

func (*AuthClient) RegisterNewAuthServer

func (s *AuthClient) RegisterNewAuthServer(token string) error

func (*AuthClient) RegisterUsingToken

func (s *AuthClient) RegisterUsingToken(req auth.RegisterUsingTokenRequest) (*auth.PackedKeys, error)

func (*AuthClient) RotateCertAuthority

func (s *AuthClient) RotateCertAuthority(req auth.RotateRequest) error

func (*AuthClient) RotateExternalCertAuthority

func (s *AuthClient) RotateExternalCertAuthority(ca services.CertAuthority) error

func (*AuthClient) SearchEvents

func (s *AuthClient) SearchEvents(fromUTC, toUTC time.Time, query string, i int) ([]events.EventFields, error)

func (*AuthClient) SearchSessionEvents

func (s *AuthClient) SearchSessionEvents(fromUTC time.Time, toUTC time.Time, i int) ([]events.EventFields, error)

func (*AuthClient) SetAuth

func (s *AuthClient) SetAuth(auth.ClientI)

func (*AuthClient) SetAuthPreference

func (s *AuthClient) SetAuthPreference(pref services.AuthPreference) error

func (*AuthClient) SetClusterConfig

func (s *AuthClient) SetClusterConfig(clusterConfig services.ClusterConfig) error

func (*AuthClient) SetClusterName

func (s *AuthClient) SetClusterName(name services.ClusterName) error

func (*AuthClient) SetStaticTokens

func (s *AuthClient) SetStaticTokens(tokens services.StaticTokens) error

func (*AuthClient) SignIn

func (s *AuthClient) SignIn(user string, password []byte) (services.WebSession, error)

func (*AuthClient) UpdateSession

func (s *AuthClient) UpdateSession(req session.UpdateRequest) error

func (*AuthClient) UploadSessionRecording

func (s *AuthClient) UploadSessionRecording(r events.SessionRecording) error

func (*AuthClient) UpsertOIDCConnector

func (s *AuthClient) UpsertOIDCConnector(connector services.OIDCConnector) error

func (*AuthClient) UpsertPassword

func (s *AuthClient) UpsertPassword(user string, password []byte) error

func (*AuthClient) UpsertSAMLConnector

func (s *AuthClient) UpsertSAMLConnector(connector services.SAMLConnector) error

func (*AuthClient) UpsertUser

func (s *AuthClient) UpsertUser(user services.User) error

func (*AuthClient) ValidateGithubAuthCallback

func (s *AuthClient) ValidateGithubAuthCallback(q url.Values) (*auth.GithubAuthResponse, error)

func (*AuthClient) ValidateOIDCAuthCallback

func (s *AuthClient) ValidateOIDCAuthCallback(q url.Values) (*auth.OIDCAuthResponse, error)

func (*AuthClient) ValidateSAMLResponse

func (s *AuthClient) ValidateSAMLResponse(re string) (*auth.SAMLAuthResponse, error)

func (*AuthClient) ValidateTrustedCluster

func (*AuthClient) WaitForDelivery

func (s *AuthClient) WaitForDelivery(context.Context) error

type FakeImageService

type FakeImageService struct{}

func (*FakeImageService) Sync

func (s *FakeImageService) Sync(dir string) ([]docker.TagSpec, error)

func (*FakeImageService) Unwrap

func (s *FakeImageService) Unwrap(image string) string

func (*FakeImageService) Wrap

func (s *FakeImageService) Wrap(image string) string

type FakeRemoteSite

type FakeRemoteSite struct {
	Name          string
	Status        string
	LastConnected time.Time
}

FakeRemoteSite represents a teleport's remote site that is used to configure the fake reverse tunnel in tests

func (FakeRemoteSite) CachingAccessPoint

func (s FakeRemoteSite) CachingAccessPoint() (auth.AccessPoint, error)

func (FakeRemoteSite) ConnectToServer

func (s FakeRemoteSite) ConnectToServer(addr, user string, auth []ssh.AuthMethod) (*ssh.Client, error)

func (FakeRemoteSite) Dial

func (FakeRemoteSite) DialAgentServer

func (s FakeRemoteSite) DialAgentServer() (net.Conn, error)

func (FakeRemoteSite) DialAuthServer

func (s FakeRemoteSite) DialAuthServer() (net.Conn, error)

func (FakeRemoteSite) DialServer

func (s FakeRemoteSite) DialServer(addr string) (net.Conn, error)

func (FakeRemoteSite) DialTCP

func (s FakeRemoteSite) DialTCP(net.Addr, net.Addr) (net.Conn, error)

func (FakeRemoteSite) GetClient

func (s FakeRemoteSite) GetClient() (auth.ClientI, error)

func (FakeRemoteSite) GetLastConnected

func (s FakeRemoteSite) GetLastConnected() time.Time

func (FakeRemoteSite) GetName

func (s FakeRemoteSite) GetName() string

func (FakeRemoteSite) GetStatus

func (s FakeRemoteSite) GetStatus() string

func (FakeRemoteSite) GetTunnelsCount

func (s FakeRemoteSite) GetTunnelsCount() int

type FakeReverseTunnel

type FakeReverseTunnel struct {
	Sites []FakeRemoteSite
}

FakeReverseTunnel allows to configure the state of teleport's reverse tunnel in tests, for example to set up available sites and their states

func (*FakeReverseTunnel) Close

func (*FakeReverseTunnel) Close() error

func (*FakeReverseTunnel) GetSite

func (s *FakeReverseTunnel) GetSite(name string) (teletunnel.RemoteSite, error)

func (*FakeReverseTunnel) GetSites

func (s *FakeReverseTunnel) GetSites() []teletunnel.RemoteSite

func (*FakeReverseTunnel) RemoveSite

func (s *FakeReverseTunnel) RemoveSite(name string) error

func (*FakeReverseTunnel) Shutdown

func (*FakeReverseTunnel) Start

func (*FakeReverseTunnel) Start() error

func (*FakeReverseTunnel) Wait

func (*FakeReverseTunnel) Wait()

type S3

type S3 struct {
	s3iface.S3API
	// Objects is the objects stored in the fake S3
	Objects map[string]S3Object
}

S3 is the mocked S3 API client

func NewS3

func NewS3() *S3

NewS3 returns a new fake S3 implementation

func (*S3) Add

func (s *S3) Add(c *check.C, app S3App, options ...AddOption)

Add adds the provided application to the hub

func (*S3) GetObject

func (s *S3) GetObject(input *s3.GetObjectInput) (*s3.GetObjectOutput, error)

func (*S3) GetObjectWithContext

func (s *S3) GetObjectWithContext(ctx aws.Context, input *s3.GetObjectInput, options ...request.Option) (*s3.GetObjectOutput, error)

func (*S3) ListObjectsV2

func (s *S3) ListObjectsV2(input *s3.ListObjectsV2Input) (*s3.ListObjectsV2Output, error)

type S3App

type S3App struct {
	// Name of the application name
	Name string
	// Version is the application version
	Version string
	// Created is the application creation timestamp
	Created time.Time
	// Data is the application data
	Data []byte
	// Checksum is the application file sha256 checksum
	Checksum string
}

S3App represents a test application

type S3Object

type S3Object struct {
	// Data is the file data
	Data []byte
	// Created is the file creation timestamp
	Created time.Time
}

S3Object represents a file object stored in the fake S3

Jump to

Keyboard shortcuts

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