testing

package
v0.5.0 Latest Latest
Warning

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

Go to latest
Published: Jan 28, 2021 License: Apache-2.0 Imports: 27 Imported by: 0

Documentation

Overview

Package testing contains methods to create test data. It's a seaparate package to avoid import cycles. Helper functions can be found in the package `testhelper`.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func KubeApply

func KubeApply(b []byte) error

func KubeApplyNamespace

func KubeApplyNamespace(b []byte, n string) error

func KubeClean

func KubeClean() error

func Kubectl

func Kubectl(envs []string, args ...string) (string, error)

func NewContext

func NewContext() context.Context

NewContext returns a non-nil empty context, for usage when it is unclear which context to use. Mostly used in tests.

Types

type Catalog

type Catalog struct {
	ServicePort int32
	KindHost    string
}

Catalog provides several instances for test, based on the cf-operator's catalog

func NewCatalog

func NewCatalog() Catalog

NewCatalog returns a Catalog, our helper for test cases

func (*Catalog) EiriniAppYaml

func (c *Catalog) EiriniAppYaml() []byte

EiriniAppYaml returns a fake Eirini app yaml

func (*Catalog) EiriniStagingAppYaml

func (c *Catalog) EiriniStagingAppYaml() []byte

EiriniStagingAppYaml returns a fake Eirini staging app yaml

func (*Catalog) IntegrationManager

func (c *Catalog) IntegrationManager() eirinix.Manager

IntegrationManager returns an Extensions manager which is used by integration tests

func (*Catalog) IntegrationManagerFiltered

func (c *Catalog) IntegrationManagerFiltered(b bool, n string) eirinix.Manager

IntegrationManagerFiltered returns an Extensions manager which is used by integration tests which filters or not eirini apps

func (*Catalog) IntegrationManagerNoRegister

func (c *Catalog) IntegrationManagerNoRegister() eirinix.Manager

IntegrationManagerNoRegister returns an Extensions manager which is used by integration tests, which doesn't register extensions again

func (*Catalog) RegisterEiriniXService

func (c *Catalog) RegisterEiriniXService() error

RegisterEiriniXService register the service generated in ServiceYaml()

func (*Catalog) ServiceYaml

func (c *Catalog) ServiceYaml() []byte

ServiceYaml returns the yaml of the endpoint + service used to reach eiriniX returned in IntegrationManager

func (*Catalog) SimpleExtension

func (c *Catalog) SimpleExtension() eirinix.Extension

SimpleExtension it's returning a fake dummy Eirini extension

func (*Catalog) SimpleManager

func (c *Catalog) SimpleManager() eirinix.Manager

SimpleManager returns a dummy Extensions manager

func (*Catalog) SimpleManagerService

func (c *Catalog) SimpleManagerService() eirinix.Manager

SimpleManagerService returns a dummy Extensions manager configured to run as a service

func (*Catalog) SimpleReconciler

func (c *Catalog) SimpleReconciler() eirinix.Reconciler

SimpleReconciler it's returning a dummy Eirini reconciler extension which adds the annotation "touched": "yes" to all created pods.

func (*Catalog) SimpleWatcher

func (c *Catalog) SimpleWatcher() eirinix.Watcher

SimpleWatcher returns a dummy watcher

func (*Catalog) SimpleWatcherWithChannel

func (c *Catalog) SimpleWatcherWithChannel(channel chan watch.Event) eirinix.Watcher

SimpleWatcher returns a dummy watcher

func (*Catalog) StartEiriniApp

func (c *Catalog) StartEiriniApp() (*EiriniApp, error)

StartEiriniApp starts EiriniAppYaml with kubernetes

func (*Catalog) StartEiriniAppInNamespace

func (c *Catalog) StartEiriniAppInNamespace(n string) (*EiriniApp, error)

StartEiriniApp starts EiriniAppYaml with kubernetes

func (*Catalog) StartEiriniStagingApp

func (c *Catalog) StartEiriniStagingApp() (*EiriniApp, error)

StartEiriniApp starts EiriniAppYaml with kubernetes

func (*Catalog) StartEiriniStagingAppInNamespace

func (c *Catalog) StartEiriniStagingAppInNamespace(n string) (*EiriniApp, error)

StartEiriniApp starts EiriniAppYaml with kubernetes

type Container

type Container struct {
	Name  string         `json:"name"`
	Image string         `json:"image"`
	Envs  []ContainerEnv `json:"env"`
}

type ContainerEnv

type ContainerEnv struct {
	Name  string `json:"name"`
	Value string `json:"value"`
}

type EditEnvExtension

type EditEnvExtension struct{}

func (*EditEnvExtension) Handle

func (e *EditEnvExtension) Handle(ctx context.Context, eiriniManager eirinix.Manager, pod *corev1.Pod, req admission.Request) admission.Response

type EditImageReconciler

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

func (*EditImageReconciler) Reconcile

func (r *EditImageReconciler) Reconcile(request reconcile.Request) (reconcile.Result, error)

func (*EditImageReconciler) Register

func (r *EditImageReconciler) Register(m eirinix.Manager) error

type EiriniApp

type EiriniApp struct {
	Name, Namespace string
	Pod             *Pod
}

func (*EiriniApp) Delete

func (c *EiriniApp) Delete() error

func (*EiriniApp) IsRunning

func (c *EiriniApp) IsRunning() (bool, error)

StartEiriniApp starts EiriniAppYaml with kubernetes

func (*EiriniApp) Sync

func (c *EiriniApp) Sync() error

type ObjectMeta

type ObjectMeta struct {
	Annotations map[string]string `json:"annotations"`
}

type Pod

type Pod struct {
	Metadata  ObjectMeta `json:"metadata"`
	Spec      PodSpec    `json:"spec"`
	PodStatus PodStatus  `json:"status"`
}

func KubePodStatus

func KubePodStatus(podname, n string) (*Pod, error)

func (*Pod) IsRunning

func (p *Pod) IsRunning() bool

type PodSpec

type PodSpec struct {
	Containers []Container `json:"containers"`
}

type PodStatus

type PodStatus struct {
	Phase string `json:"phase"`
}

type SimpleWatch

type SimpleWatch struct {
	Handled []watch.Event
}

func (*SimpleWatch) Handle

func (sw *SimpleWatch) Handle(m eirinix.Manager, e watch.Event)

type SimpleWatcherWithChannel

type SimpleWatcherWithChannel struct {
	Received chan watch.Event
}

func (*SimpleWatcherWithChannel) Handle

Directories

Path Synopsis
Code generated by counterfeiter.
Code generated by counterfeiter.

Jump to

Keyboard shortcuts

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