util

package
v0.5.1 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CheckRequiredEnv added in v0.5.1

func CheckRequiredEnv(ctx context.Context) (err error)

Check if required environment variables are present

func CheckTmInfo added in v0.5.1

func CheckTmInfo(ctx context.Context, database *ndbv1alpha1.Database, tmResponse *ndb_api.TimeMachineResponse) (err error)

Checking that TM info that was specified in yaml is returned in TM response

func CreateTypeFromPath

func CreateTypeFromPath(theType any, path string) (err error)

CreateTypeFromPath reads a file path, converts it to json, and unmarshals json to a pointer. Ensure that theType is a pointer.

func GetLogger

func GetLogger(ctx context.Context) *log.Logger

Gets logger from context

func SetupContext

func SetupContext(ctx context.Context, logger *log.Logger) context.Context

Setup up Context with Logger

func SetupKubeconfig

func SetupKubeconfig(ctx context.Context) (config *rest.Config, err error)

Setup kubeconfig

func SetupLogger

func SetupLogger(path string, rootName string) (*log.Logger, error)

Setup a logger with a unique file path

func SetupSchemeAndClientSet

func SetupSchemeAndClientSet(ctx context.Context, config *rest.Config) (v1alpha1ClientSet *clientsetv1alpha1.V1alpha1Client, clientset *kubernetes.Clientset, err error)

Setup scheme and clientsets

Types

type CloningTestSuiteManager added in v0.5.1

type CloningTestSuiteManager struct{}

func (*CloningTestSuiteManager) GetAppResponse added in v0.5.1

func (cm *CloningTestSuiteManager) GetAppResponse(ctx context.Context, st *SetupTypes, clientset *kubernetes.Clientset, localPort string) (res http.Response, err error)

func (*CloningTestSuiteManager) GetDatabaseOrCloneResponse added in v0.5.1

func (cm *CloningTestSuiteManager) GetDatabaseOrCloneResponse(ctx context.Context, st *SetupTypes, clientset *kubernetes.Clientset, v1alpha1ClientSet *clientsetv1alpha1.V1alpha1Client) (databaseResponse *ndb_api.DatabaseResponse, err error)

func (*CloningTestSuiteManager) GetTimemachineResponseByDatabaseId added in v0.5.1

func (dm *CloningTestSuiteManager) GetTimemachineResponseByDatabaseId(ctx context.Context, st *SetupTypes, clientset *kubernetes.Clientset, v1alpha1ClientSet *clientsetv1alpha1.V1alpha1Client) (timemachineResponse *ndb_api.TimeMachineResponse, err error)

EMPTY STUB

func (*CloningTestSuiteManager) Setup added in v0.5.1

func (cm *CloningTestSuiteManager) Setup(ctx context.Context, st *SetupTypes, clientset *kubernetes.Clientset, v1alpha1ClientSet *clientsetv1alpha1.V1alpha1Client, t *testing.T) (err error)

func (*CloningTestSuiteManager) TearDown added in v0.5.1

func (cm *CloningTestSuiteManager) TearDown(ctx context.Context, st *SetupTypes, clientset *kubernetes.Clientset, v1alpha1ClientSet *clientsetv1alpha1.V1alpha1Client, t *testing.T) (err error)

type ProvisioningTestSuiteManager added in v0.5.1

type ProvisioningTestSuiteManager struct{}

func (*ProvisioningTestSuiteManager) GetAppResponse added in v0.5.1

func (pm *ProvisioningTestSuiteManager) GetAppResponse(ctx context.Context, st *SetupTypes, clientset *kubernetes.Clientset, localPort string) (res http.Response, err error)

func (*ProvisioningTestSuiteManager) GetDatabaseOrCloneResponse added in v0.5.1

func (pm *ProvisioningTestSuiteManager) GetDatabaseOrCloneResponse(ctx context.Context, st *SetupTypes, clientset *kubernetes.Clientset, v1alpha1ClientSet *clientsetv1alpha1.V1alpha1Client) (databaseResponse *ndb_api.DatabaseResponse, err error)

func (*ProvisioningTestSuiteManager) GetTimemachineResponseByDatabaseId added in v0.5.1

func (pm *ProvisioningTestSuiteManager) GetTimemachineResponseByDatabaseId(ctx context.Context, st *SetupTypes, clientset *kubernetes.Clientset, v1alpha1ClientSet *clientsetv1alpha1.V1alpha1Client) (timemachineResponse *ndb_api.TimeMachineResponse, err error)

Tests TM Response

func (*ProvisioningTestSuiteManager) Setup added in v0.5.1

func (pm *ProvisioningTestSuiteManager) Setup(ctx context.Context, st *SetupTypes, clientset *kubernetes.Clientset, v1alpha1ClientSet *clientsetv1alpha1.V1alpha1Client, t *testing.T) (err error)

func (*ProvisioningTestSuiteManager) TearDown added in v0.5.1

func (pm *ProvisioningTestSuiteManager) TearDown(ctx context.Context, st *SetupTypes, clientset *kubernetes.Clientset, v1alpha1ClientSet *clientsetv1alpha1.V1alpha1Client, t *testing.T) (err error)

type SetupTypes

type SetupTypes struct {
	NdbServer *ndbv1alpha1.NDBServer
	Database  *ndbv1alpha1.Database
	NdbSecret *corev1.Secret
	DbSecret  *corev1.Secret
	AppPod    *corev1.Pod
}

YAML Resource types

func SetupTypeTemplates

func SetupTypeTemplates(ctx context.Context) (setupTypes *SetupTypes, err error)

Setup yaml types. Uses paths specified in automation.constants.go

type TestSuiteManager added in v0.5.1

type TestSuiteManager interface {
	Setup(
		ctx context.Context,
		st *SetupTypes,
		clientset *kubernetes.Clientset,
		v1alpha1ClientSet *clientsetv1alpha1.V1alpha1Client,
		t *testing.T) (err error)
	TearDown(
		ctx context.Context,
		st *SetupTypes,
		clientset *kubernetes.Clientset,
		v1alpha1ClientSet *clientsetv1alpha1.V1alpha1Client,
		t *testing.T) (err error)
	GetDatabaseOrCloneResponse(
		ctx context.Context,
		st *SetupTypes,
		clientset *kubernetes.Clientset,
		v1alpha1ClientSet *clientsetv1alpha1.V1alpha1Client) (databaseResponse *ndb_api.DatabaseResponse, err error)
	GetAppResponse(
		ctx context.Context,
		st *SetupTypes,
		clientset *kubernetes.Clientset,
		localPort string) (res http.Response, err error)
	GetTimemachineResponseByDatabaseId(
		ctx context.Context,
		st *SetupTypes,
		clientset *kubernetes.Clientset,
		v1alpha1ClientSet *clientsetv1alpha1.V1alpha1Client) (timemachineResponse *ndb_api.TimeMachineResponse, err error)
}

func GetTestSuiteManager added in v0.5.1

func GetTestSuiteManager(ctx context.Context, st SetupTypes) (manager TestSuiteManager)

Jump to

Keyboard shortcuts

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