kubernetesk8s.io/kubernetes/test/e2e/chaosmonkey Index | Files

package chaosmonkey

import "k8s.io/kubernetes/test/e2e/chaosmonkey"

Index

Functions

func New

func New(disruption Disruption) *chaosmonkey

New creates and returns a chaosmonkey, with which the caller should register Tests and call Do. See Do for more information.

Types

type Disruption

type Disruption func()

Disruption is the type to construct a chaosmonkey with; see Do for more information.

type Interface

type Interface interface {
	Setup()
	Test(stopCh <-chan struct{})
	Teardown()
}

Interface can be implemented if you prefer to define tests without dealing with a Semaphore. You may define a struct that implements Interface's three methods (Setup, Test, and Teardown) and RegisterInterface. See RegisterInterface for more information.

type Semaphore

type Semaphore struct {
	StopCh <-chan struct{}
	// contains filtered or unexported fields
}

Semaphore is taken by a Test and provides: Ready(), for the Test to call when it's ready for the disruption to start; and StopCh, the closure of which signals to the Test that the disruption is finished.

func (*Semaphore) Ready

func (sem *Semaphore) Ready()

Ready is called by the Test to signal that the Test is ready for the disruption to start.

type Test

type Test func(sem *Semaphore)

Test is the type to register with a chaosmonkey. A test will run asynchronously across the chaosmonkey's Disruption. A Test takes a Semaphore as an argument. It should call sem.Ready() once it's ready for the disruption to start and should then wait until sem.StopCh (which is a <-chan struct{}) is closed, which signals that the disruption is over. It should then clean up and return. See Do and Semaphore for more information.

Source Files

chaosmonkey.go

Version
v1.14.6
Published
Aug 16, 2019
Platform
js/wasm
Imports
1 packages
Last checked
11 minutes ago

Tools for package owners.