testutil

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Jun 26, 2020 License: Apache-2.0 Imports: 43 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// OverrideGoldenEnv is the environment variable signalling the golden files should be overwritten
	OverrideGoldenEnv = "FIX_GOLDEN"
)

Variables

View Source
var (
	WithTimeout = util.WithClientWatcherTimeout
)

Functions

func ConditionStatusEqual

func ConditionStatusEqual(obj runtime.Object, ConditionType, ConditionStatus interface{}) error

func DeleteAndWaitUntilNotFound

func DeleteAndWaitUntilNotFound(ctx context.Context, c *RecordingClient, obj runtime.Object, options ...util.ClientWatcherOption) error

func DexFakeClientCredentialsGrant added in v0.2.0

func DexFakeClientCredentialsGrant(ctx context.Context, log logr.Logger, client *http.Client, providerURI, username, password string) (token string, err error)

func E2EOperatorCheck added in v0.2.0

func E2EOperatorCheck(
	ctx context.Context,
	t *testing.T,
	serviceClient *RecordingClient,
	serviceScheme *runtime.Scheme,
)

func KubeCarrierCheck added in v0.2.0

func KubeCarrierCheck(
	ctx context.Context,
	t *testing.T,
	managementClient *RecordingClient,
	managementScheme *runtime.Scheme,
)

func KubeCarrierOperatorCheck added in v0.2.0

func KubeCarrierOperatorCheck(
	ctx context.Context,
	t *testing.T,
	managementClient *RecordingClient,
	managementScheme *runtime.Scheme,
)

func LoadTestDataFile added in v0.2.0

func LoadTestDataFile(t *testing.T, fname string) string

LoadTestDataFile copies from testdata VFS to the temp file system, returning the file name

func LoadTestDataObject added in v0.2.0

func LoadTestDataObject(t *testing.T, fname string, obj runtime.Object)

func LogObject

func LogObject(t *testing.T, obj interface{})

func NewCatalog added in v0.2.0

func NewCatalog(name, namespace string, catalogEntrySelector, tenantSelector *metav1.LabelSelector) *catalogv1alpha1.Catalog

func NewCatalogEntry added in v0.2.0

func NewCatalogEntry(name, namespace, crdName string) *catalogv1alpha1.CatalogEntry

func NewFakeCouchDBCRD added in v0.2.0

func NewFakeCouchDBCRD(group string) *apiextensionsv1.CustomResourceDefinition

func NewFakeDB added in v0.2.0

func NewFakeDB(name, namespace string) *fakev1alpha1.DB

func NewProviderAccount added in v0.2.0

func NewProviderAccount(name string, subjects ...rbacv1.Subject) *catalogv1alpha1.Account

func NewServiceCluster added in v0.2.0

func NewServiceCluster(name, namespace, secret string) *corev1alpha1.ServiceCluster

func NewTenantAccount added in v0.2.0

func NewTenantAccount(name string, subjects ...rbacv1.Subject) *catalogv1alpha1.Account

func WaitUntilCondition

func WaitUntilCondition(ctx context.Context, c *RecordingClient, obj runtime.Object, ConditionType, conditionStatus interface{}, options ...util.ClientWatcherOption) error

func WaitUntilFound

func WaitUntilFound(ctx context.Context, c *RecordingClient, obj runtime.Object, options ...util.ClientWatcherOption) error

func WaitUntilNotFound

func WaitUntilNotFound(ctx context.Context, c *RecordingClient, obj runtime.Object, options ...util.ClientWatcherOption) error

func WaitUntilReady

func WaitUntilReady(ctx context.Context, c *RecordingClient, obj runtime.Object, options ...util.ClientWatcherOption) error

Types

type CleanUpStrategy added in v0.2.0

type CleanUpStrategy string
const (
	CleanupAlways    CleanUpStrategy = "always"
	CleanupOnSuccess CleanUpStrategy = "on-success"
	CleanupNever     CleanUpStrategy = "never"
)

type Framework added in v0.2.0

type Framework struct {
	ManagementScheme *runtime.Scheme

	ServiceScheme *runtime.Scheme
	// contains filtered or unexported fields
}

func New added in v0.2.0

func New(c FrameworkConfig) (f *Framework, err error)

func (*Framework) Config added in v0.2.0

func (f *Framework) Config() FrameworkConfig

func (*Framework) ManagementClient added in v0.2.0

func (f *Framework) ManagementClient(t *testing.T, options ...func(config *restclient.Config) error) (*RecordingClient, error)

func (*Framework) ServiceClient added in v0.2.0

func (f *Framework) ServiceClient(t *testing.T, options ...func(config *restclient.Config) error) (*RecordingClient, error)

func (*Framework) SetupServiceCluster added in v0.2.0

func (f *Framework) SetupServiceCluster(ctx context.Context, cl *RecordingClient, t *testing.T, name string, account *catalogv1alpha1.Account) *corev1alpha1.ServiceCluster

type FrameworkConfig added in v0.2.0

type FrameworkConfig struct {
	TestID string

	ManagementExternalKubeconfigPath string
	ManagementInternalKubeconfigPath string
	ServiceExternalKubeconfigPath    string
	ServiceInternalKubeconfigPath    string
	CleanUpStrategy                  CleanUpStrategy
}

func (*FrameworkConfig) Default added in v0.2.0

func (c *FrameworkConfig) Default()

func (*FrameworkConfig) ManagementClusterName added in v0.2.0

func (c *FrameworkConfig) ManagementClusterName() string

func (*FrameworkConfig) ServiceClusterName added in v0.2.0

func (c *FrameworkConfig) ServiceClusterName() string

type Logger

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

Logger implements logr.Logger and logs to testing.T to preserve the order of log lines in tests.

func NewLogger

func NewLogger(t *testing.T) *Logger

NewLogger returns a new Logger flushing to testing.T.

func (*Logger) Enabled

func (l *Logger) Enabled() bool

Enabled implements logr.Logger.Enabled

func (*Logger) Error

func (l *Logger) Error(err error, msg string, kvs ...interface{})

Error implements logr.Logger.Error

func (*Logger) Info

func (l *Logger) Info(msg string, kvs ...interface{})

Info implements logr.Logger.Info

func (*Logger) V

func (l *Logger) V(level int) logr.InfoLogger

V implements logr.Logger.V

func (*Logger) WithName

func (l *Logger) WithName(name string) logr.Logger

WithName implements logr.Logger.WithName

func (*Logger) WithValues

func (l *Logger) WithValues(kvs ...interface{}) logr.Logger

WithValues implements logr.Logger.WithValues

type RecordingClient added in v0.2.0

type RecordingClient struct {
	*util.ClientWatcher
	// contains filtered or unexported fields
}

func (*RecordingClient) CleanUpFunc added in v0.2.0

func (rc *RecordingClient) CleanUpFunc(ctx context.Context) func()

func (*RecordingClient) Create added in v0.2.0

func (rc *RecordingClient) Create(ctx context.Context, obj runtime.Object, opts ...client.CreateOption) error

func (*RecordingClient) Delete added in v0.2.0

func (rc *RecordingClient) Delete(ctx context.Context, obj runtime.Object, opts ...client.DeleteOption) error

func (*RecordingClient) EnsureCreated added in v0.2.0

func (rc *RecordingClient) EnsureCreated(ctx context.Context, obj runtime.Object, opts ...client.CreateOption) error

func (*RecordingClient) RegisterForCleanup added in v0.2.0

func (rc *RecordingClient) RegisterForCleanup(obj runtime.Object)

func (*RecordingClient) UnregisterForCleanup added in v0.2.0

func (rc *RecordingClient) UnregisterForCleanup(obj runtime.Object)

type TestingLogWriter added in v0.2.0

type TestingLogWriter struct {
	T *testing.T
}

func (*TestingLogWriter) Write added in v0.2.0

func (ls *TestingLogWriter) Write(p []byte) (n int, err error)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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