test

package
v0.9.0 Latest Latest
Warning

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

Go to latest
Published: Apr 1, 2024 License: Apache-2.0 Imports: 19 Imported by: 0

Documentation

Index

Constants

View Source
const (
	TokenName     = "oldTokenWithLengthOf32Characters"
	NewTokenName  = "newTokenWithLengthOf32Characters"
	ClusterName   = "test-cluster"
	AppName       = "app-name"
	NamespaceName = "test-namespace"
	ClusterKey    = "cluster"
	TokenTypeKey  = "type"
	JoinTokenKey  = "joinToken"

	TokenTypeKube = "kube"
	TokenTypeNode = "node"

	AppCatalog            = "app-catalog"
	AppVersion            = "appVersion"
	ManagementClusterName = "management-cluster"
	ProxyAddr             = "127.0.0.1"
	IdentityFileValue     = "identity-file-value"
	TeleportVersion       = "1.0.0"

	ConfigMapValuesFormat = "authToken: %s\nproxyAddr: %s\nroles: kube\nkubeClusterName: %s\nteleportVersionOverride: %s"
)

Variables

View Source
var LastReadValue = time.Now()

Functions

func CheckCluster

func CheckCluster(t *testing.T, expected, actual *capi.Cluster)

func CheckConfigMap

func CheckConfigMap(t *testing.T, expected, actual *corev1.ConfigMap)

func CheckError

func CheckError(t *testing.T, expectError bool, err error)

func CheckK8sServers

func CheckK8sServers(t *testing.T, expected, actual []types.KubeServer)

func CheckSecret

func CheckSecret(t *testing.T, expected, actual *corev1.Secret)

func CheckToken

func CheckToken(t *testing.T, expected, actual types.ProvisionToken)

func CheckTokens

func CheckTokens(t *testing.T, expected, actual []types.ProvisionToken)

func NewCluster

func NewCluster(name, namespace string, finalizers []string, deletionTimestamp time.Time) *capi.Cluster

func NewConfigMap

func NewConfigMap(clusterName, appName, namespaceName, tokenName string) *corev1.ConfigMap

func NewFakeK8sClient

func NewFakeK8sClient(runtimeObjects []runtime.Object) (client.Client, error)

func NewIdentitySecret added in v0.6.0

func NewIdentitySecret(namespaceName, identityFile string) *corev1.Secret

func NewKubeServer

func NewKubeServer(clusterName, hostId, hostName string) teleportTypes.KubeServer

func NewMockTokenGenerator

func NewMockTokenGenerator(token string) token.Generator

func NewSecret

func NewSecret(clusterName, namespaceName, tokenName string) *corev1.Secret

func NewToken

func NewToken(tokenName, clusterName, tokenType string) teleportTypes.ProvisionToken

func ObjectKeyFromObjectMeta

func ObjectKeyFromObjectMeta(objectMeta metav1.ObjectMeta) client.ObjectKey

Types

type FakeTeleportClient

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

func NewTeleportClient

func NewTeleportClient(config FakeTeleportClientConfig) *FakeTeleportClient

func (*FakeTeleportClient) CreateToken

func (c *FakeTeleportClient) CreateToken(ctx context.Context, token types.ProvisionToken) error

func (*FakeTeleportClient) DeleteToken

func (c *FakeTeleportClient) DeleteToken(ctx context.Context, name string) error

func (*FakeTeleportClient) GetToken

func (*FakeTeleportClient) GetTokens

func (*FakeTeleportClient) Ping

func (*FakeTeleportClient) UpsertToken

func (c *FakeTeleportClient) UpsertToken(ctx context.Context, token types.ProvisionToken) error

type FakeTeleportClientConfig

type FakeTeleportClientConfig struct {
	FailsPing   bool
	FailsGet    bool
	FailsList   bool
	FailsCreate bool
	FailsUpsert bool
	FailsDelete bool
	Tokens      []types.ProvisionToken
}

type MockTokenGenerator

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

func (*MockTokenGenerator) Generate

func (g *MockTokenGenerator) Generate() string

Jump to

Keyboard shortcuts

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