utils_test

package
v0.0.0-...-9afe088 Latest Latest
Warning

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

Go to latest
Published: Sep 1, 2019 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var MapOfSequences = map[string]*TestStepSequence{}

MapOfSequences represent a TestStepSequence map

Functions

func NewTestPodLister

func NewTestPodLister(pods []*kapiv1.Pod) kv1.PodLister

NewTestPodLister create a new PodLister. FOR TEST PURPOSE ONLY

func NewTestPodNamespaceLister

func NewTestPodNamespaceLister(pods []*kapiv1.Pod, namespace string) kv1.PodNamespaceLister

NewTestPodNamespaceLister create a new PodNamespaceLister. FOR TEST PURPOSE ONLY

func PodGen

func PodGen(name, namespace string, labels, annotations map[string]string, running, ready bool) *kapiv1.Pod

PodGen generate a pod with some label and status FOR TEST PURPOSE ONLY

func ValidateTestSequence

func ValidateTestSequence(wg *sync.WaitGroup, t *testing.T, duration time.Duration, sequenceTitle string, closingChannels []chan struct{})

ValidateTestSequence is a test helper to validate the sequence of steps FOR TEST PURPOSE ONLY

Types

type TestPodControl

type TestPodControl struct {
	T                                        *testing.T
	Case                                     string
	FailOnUndefinedFunc                      bool
	InitBreakerAnnotationAndLabelFunc        func(name string, p *kapiv1.Pod) (*kapiv1.Pod, error)
	UpdateBreakerAnnotationAndLabelFunc      func(name string, strategy string, p *kapiv1.Pod) (*kapiv1.Pod, error)
	UpdateActivationLabelsAndAnnotationsFunc func(name string, p *kapiv1.Pod) (*kapiv1.Pod, error)
	UpdatePauseLabelsAndAnnotationsFunc      func(name string, p *kapiv1.Pod) (*kapiv1.Pod, error)
	RemoveBreakerAnnotationAndLabelFunc      func(p *kapiv1.Pod) (*kapiv1.Pod, error)
	KillPodFunc                              func(name string, p *kapiv1.Pod) error
}

TestPodControl test mock for podcontro

func (*TestPodControl) InitBreakerAnnotationAndLabel

func (t *TestPodControl) InitBreakerAnnotationAndLabel(name string, p *kapiv1.Pod) (*kapiv1.Pod, error)

InitBreakerAnnotationAndLabel fake implementation for podcontrol

func (*TestPodControl) KillPod

func (t *TestPodControl) KillPod(name string, p *kapiv1.Pod) error

KillPod fake implementation for podcontrol

func (*TestPodControl) RemoveBreakerAnnotationAndLabel

func (t *TestPodControl) RemoveBreakerAnnotationAndLabel(p *kapiv1.Pod) (*kapiv1.Pod, error)

RemoveBreakerAnnotationAndLabel fake implementatin for podcontrol

func (*TestPodControl) UpdateActivationLabelsAndAnnotations

func (t *TestPodControl) UpdateActivationLabelsAndAnnotations(name string, p *kapiv1.Pod) (*kapiv1.Pod, error)

UpdateActivationLabelsAndAnnotations fake implementation for podcontrol

func (*TestPodControl) UpdateBreakerAnnotationAndLabel

func (t *TestPodControl) UpdateBreakerAnnotationAndLabel(name string, strategy string, p *kapiv1.Pod) (*kapiv1.Pod, error)

UpdateBreakerAnnotationAndLabel fake implementation for podcontrol

func (*TestPodControl) UpdatePauseLabelsAndAnnotations

func (t *TestPodControl) UpdatePauseLabelsAndAnnotations(name string, p *kapiv1.Pod) (*kapiv1.Pod, error)

UpdatePauseLabelsAndAnnotations fake implementation for podcontrol

type TestStepSequence

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

TestStepSequence sequence of test steps

func GetTestSequence

func GetTestSequence(t *testing.T, registrationName string) *TestStepSequence

GetTestSequence retrieve test sequence Should be called

func NewTestSequence

func NewTestSequence(t *testing.T, registrationName string, count int, duration time.Duration) *TestStepSequence

NewTestSequence Create a test sequence

func (*TestStepSequence) Completed

func (es *TestStepSequence) Completed() bool

Completed check that all step of the sequence have been completed.

func (*TestStepSequence) Len

func (es *TestStepSequence) Len() int

Len return the number of steps in the sequence

func (*TestStepSequence) PassAtLeastOnce

func (es *TestStepSequence) PassAtLeastOnce(step int)

PassAtLeastOnce to be called when a step in the sequence is considered as passed qnd can't be passed a second time

func (*TestStepSequence) PassOnlyOnce

func (es *TestStepSequence) PassOnlyOnce(step int)

PassOnlyOnce to be called when a step in the sequence is considered as passed and can't be passed a second time else (t.Fatal)

func (*TestStepSequence) ValidateTestSequence

func (es *TestStepSequence) ValidateTestSequence(wg *sync.WaitGroup)

ValidateTestSequence validate that the sequence is completed in order in the given time

func (*TestStepSequence) ValidateTestSequenceNoOrder

func (es *TestStepSequence) ValidateTestSequenceNoOrder(wg *sync.WaitGroup)

ValidateTestSequenceNoOrder validate that the sequence is completed in order in the given time

Directories

Path Synopsis
e2e

Jump to

Keyboard shortcuts

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