util

package
v0.5.0 Latest Latest
Warning

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

Go to latest
Published: Nov 7, 2023 License: Apache-2.0 Imports: 26 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

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 GetAppResponse

func GetAppResponse(ctx context.Context, clientset *kubernetes.Clientset, pod *corev1.Pod, localPort string) (res http.Response, err error)

Tests if pod is able to connect to database

func GetDatabaseResponse

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

Wrapper function called in all TestSuite TestProvisioningSuccess methods. Returns a DatabaseResponse which indicates if provison was succesful

func GetLogger

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

Gets logger from context

func LoadEnv

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

Load Environment Variables

func ProvisioningTestSetup

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

This function is called from the SetupSuite() function of all testsuites. It loads environment variables, instantiate resources, waits for db to be ready, and pod to start.

func ProvisioningTestTeardown

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

This function is called from the TeardownSuite() function of all testsuites. Delete resources and de-provision database.

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) (*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 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

Jump to

Keyboard shortcuts

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