framework

package
v0.0.0-...-f9370be Latest Latest
Warning

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

Go to latest
Published: Aug 15, 2019 License: Apache-2.0 Imports: 28 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var CustomResourceDefinitionTypeMeta = metav1.TypeMeta{
	Kind:       "CustomResourceDefinition",
	APIVersion: "apiextensions.k8s.io/v1beta1",
}

CustomResourceDefinitionTypeMeta sets the default kind/apiversion of CRD

View Source
var SparkTestImage = ""
View Source
var SparkTestNamespace = ""
View Source
var SparkTestServiceAccount = ""

Functions

func CreateClusterRole

func CreateClusterRole(kubeClient kubernetes.Interface, relativePath string) error

func CreateClusterRoleBinding

func CreateClusterRoleBinding(kubeClient kubernetes.Interface, relativePath string) (finalizerFn, error)

func CreateConfigMap

func CreateConfigMap(kubeClient kubernetes.Interface, name string, namespace string) (*v1.ConfigMap, error)

func CreateDeployment

func CreateDeployment(kubeClient kubernetes.Interface, namespace string, d *appsv1.Deployment) error

func CreateJob

func CreateJob(kubeClient kubernetes.Interface, namespace string, job *batchv1.Job) error

func CreateNamespace

func CreateNamespace(kubeClient kubernetes.Interface, name string) (*v1.Namespace, error)

func CreateRole

func CreateRole(kubeClient kubernetes.Interface, ns string, relativePath string) error

func CreateRoleBinding

func CreateRoleBinding(kubeClient kubernetes.Interface, ns string, relativePath string) (finalizerFn, error)

func CreateService

func CreateService(kubeClient kubernetes.Interface, ns string, relativePath string) (finalizerFn, error)

func CreateServiceAccount

func CreateServiceAccount(kubeClient kubernetes.Interface, namespace string, relativPath string) (finalizerFn, error)

func CreateSparkApplication

func CreateSparkApplication(crdclientset crdclientset.Interface, namespace string, sa *v1beta1.SparkApplication) error

func DeleteClusterRole

func DeleteClusterRole(kubeClient kubernetes.Interface, relativePath string) error

func DeleteClusterRoleBinding

func DeleteClusterRoleBinding(kubeClient kubernetes.Interface, relativePath string) error

func DeleteConfigMap

func DeleteConfigMap(kubeClient kubernetes.Interface, name string, namespace string) error

func DeleteDeployment

func DeleteDeployment(kubeClient kubernetes.Interface, namespace, name string) error

func DeleteJob

func DeleteJob(kubeClient kubernetes.Interface, namespace, name string) error

func DeleteNamespace

func DeleteNamespace(kubeClient kubernetes.Interface, name string) error

func DeleteRole

func DeleteRole(kubeClient kubernetes.Interface, ns string, relativePath string) error

func DeleteRoleBinding

func DeleteRoleBinding(kubeClient kubernetes.Interface, ns string, relativePath string) error

func DeleteService

func DeleteService(kubeClient kubernetes.Interface, name string, namespace string) error

func DeleteServiceAccount

func DeleteServiceAccount(kubeClient kubernetes.Interface, namespace string, relativPath string) error

func DeleteSparkApplication

func DeleteSparkApplication(crdclientset crdclientset.Interface, namespace, name string) error

func GetLogs

func GetLogs(kubeClient kubernetes.Interface, namespace string, podName, containerName string) (string, error)

func GetSparkApplication

func GetSparkApplication(crdclientset crdclientset.Interface, namespace, name string) (*v1beta1.SparkApplication, error)

func MakeDeployment

func MakeDeployment(pathToYaml string) (*appsv1.Deployment, error)

func MakeJob

func MakeJob(pathToYaml string) (*batchv1.Job, error)

func MakeSparkApplicationFromYaml

func MakeSparkApplicationFromYaml(pathToYaml string) (*v1beta1.SparkApplication, error)

func PathToOSFile

func PathToOSFile(relativPath string) (*os.File, error)

PathToOSFile gets the absolute path from relative path.

func PodRunningAndReady

func PodRunningAndReady(pod v1.Pod) (bool, error)

PodRunningAndReady returns whether a pod is running and each container has passed it's ready state.

func ProxyGetPod

func ProxyGetPod(kubeClient kubernetes.Interface, namespace string, podName string, port string, path string) *rest.Request

func UpdateSparkApplication

func UpdateSparkApplication(crdclientset crdclientset.Interface, namespace string, sa *v1beta1.SparkApplication) error

func WaitForHTTPSuccessStatusCode

func WaitForHTTPSuccessStatusCode(timeout time.Duration, url string) error

func WaitForPodsReady

func WaitForPodsReady(kubeClient kubernetes.Interface, namespace string, timeout time.Duration, expectedReplicas int, opts metav1.ListOptions) error

WaitForPodsReady waits for a selection of Pods to be running and each container to pass its readiness check.

func WaitForPodsRunImage

func WaitForPodsRunImage(kubeClient kubernetes.Interface, namespace string, expectedReplicas int, image string, opts metav1.ListOptions) error

func WaitForServiceReady

func WaitForServiceReady(kubeClient kubernetes.Interface, namespace string, serviceName string) error

func WaitUntilDeploymentGone

func WaitUntilDeploymentGone(kubeClient kubernetes.Interface, namespace, name string, timeout time.Duration) error

func WaitUntilJobCompleted

func WaitUntilJobCompleted(kubeClient kubernetes.Interface, namespace, name string, timeout time.Duration) error

Types

type Framework

type Framework struct {
	KubeClient             kubernetes.Interface
	SparkApplicationClient crdclientset.Interface
	MasterHost             string
	Namespace              *v1.Namespace
	OperatorPod            *v1.Pod
	DefaultTimeout         time.Duration
}

Framework contains all components required to run the test framework.

func New

func New(ns, sparkNs, kubeconfig, opImage string, opImagePullPolicy string) (*Framework, error)

Sets up a test framework and returns it.

func (*Framework) NewTestCtx

func (f *Framework) NewTestCtx(t *testing.T) TestCtx

func (*Framework) Setup

func (f *Framework) Setup(sparkNs, opImage string, opImagePullPolicy string) error

func (*Framework) Teardown

func (f *Framework) Teardown() error

Teardown tears down a previously initialized test environment.

type TestCtx

type TestCtx struct {
	ID string
	// contains filtered or unexported fields
}

func (*TestCtx) AddFinalizerFn

func (ctx *TestCtx) AddFinalizerFn(fn finalizerFn)

func (*TestCtx) Cleanup

func (ctx *TestCtx) Cleanup(t *testing.T)

func (*TestCtx) CreateNamespace

func (ctx *TestCtx) CreateNamespace(t *testing.T, kubeClient kubernetes.Interface) string

func (*TestCtx) GetObjID

func (ctx *TestCtx) GetObjID() string

GetObjID returns an ascending ID based on the length of cleanUpFns. It is based on the premise that every new object also appends a new finalizerFn on cleanUpFns. This can e.g. be used to create multiple namespaces in the same test context.

Jump to

Keyboard shortcuts

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