tests

package
v0.0.0-...-c16e2ab Latest Latest
Warning

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

Go to latest
Published: May 19, 2022 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ClientInterface

type ClientInterface interface {
	CreateKubernetesSecret(namespace, id string) error
	DeleteSecretManagerSecret(project, id string) error
	CleanupKubernetesNamespace(namespace string) error
	CleanupKubernetesSecrets(namespace string) error
	client.Interface
}

type E2eTestClient

type E2eTestClient struct {
	*client.Client
}

func (*E2eTestClient) CleanupKubernetesNamespace

func (cl *E2eTestClient) CleanupKubernetesNamespace(namespace string) error

CleanupKubernetesNamespace deletes the given namespace in the cluster. Returns nil if succeeded, otherwise error.

func (*E2eTestClient) CleanupKubernetesSecrets

func (cl *E2eTestClient) CleanupKubernetesSecrets(namespace string) error

CleanupKubernetesSecrets deletes all secrets expect for default-token-* under the given namespace in the cluster. Returns nil if succeeded, otherwise error.

func (*E2eTestClient) CreateKubernetesSecret

func (cl *E2eTestClient) CreateKubernetesSecret(namespace, id string) error

CreateKubernetesSecret creates an empty K8s secret under namespace. Returns nil if successful, error otherwise

func (*E2eTestClient) DeleteSecretManagerSecret

func (cl *E2eTestClient) DeleteSecretManagerSecret(project, id string) error

DeleteSecretManagerSecret deletes the secret in the given project. Returns nil if succeeded, otherwise error.

type Fixture

type Fixture struct {
	// map of namespace to secret to key to value
	Kubernetes map[string]map[string]map[string]string
	// map of project to secret to value
	SecretManager map[string]map[string]string
}

func NewFixture

func NewFixture(config []byte) (f Fixture, err error)

func (Fixture) Reset

func (f Fixture) Reset(cl ClientInterface) error

Reset clears or re-creates the K8s secrets with the Fixture and the given client. Returns nil if successful, error otherwise

func (Fixture) Setup

func (f Fixture) Setup(cl ClientInterface) error

Setup sets up the Secret Manager secrets and K8s namespaces with the Fixture and the given client. Returns nil if successful, error otherwise

func (Fixture) Teardown

func (f Fixture) Teardown(cl ClientInterface) error

Teardown deletes all Secret Manager secrets and Kubernetes secrets and namespaces created by Setup(). Returns nil if successful, error otherwise

type MockClient

type MockClient struct {
	K8sSecret           map[string]map[string]map[string][]byte
	SecretManagerSecret map[string]map[string][]byte
}

func NewMockClient

func NewMockClient(namespaces []string) *MockClient

func (*MockClient) CleanupKubernetesNamespace

func (cl *MockClient) CleanupKubernetesNamespace(namespace string) error

func (*MockClient) CleanupKubernetesSecrets

func (cl *MockClient) CleanupKubernetesSecrets(namespace string) error

func (*MockClient) CreateKubernetesNamespace

func (cl *MockClient) CreateKubernetesNamespace(namespace string) error

func (*MockClient) CreateKubernetesSecret

func (cl *MockClient) CreateKubernetesSecret(namespace, id string) error

func (*MockClient) DeleteSecretManagerSecret

func (cl *MockClient) DeleteSecretManagerSecret(project, id string) error

func (*MockClient) GetKubernetesSecretValue

func (cl *MockClient) GetKubernetesSecretValue(namespace, id, key string) ([]byte, error)

func (*MockClient) GetSecretManagerSecretValue

func (cl *MockClient) GetSecretManagerSecretValue(project, id string) ([]byte, error)

func (*MockClient) UpsertKubernetesSecret

func (cl *MockClient) UpsertKubernetesSecret(namespace, id, key string, data []byte) error

func (*MockClient) UpsertSecretManagerSecret

func (cl *MockClient) UpsertSecretManagerSecret(project, id string, data []byte) error

func (*MockClient) ValidateKubernetesNamespace

func (cl *MockClient) ValidateKubernetesNamespace(namespace string) error

func (*MockClient) ValidateKubernetesSecret

func (cl *MockClient) ValidateKubernetesSecret(namespace, id string) error

Jump to

Keyboard shortcuts

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