kubernetes: k8s.io/kubernetes/test/e2e/chaosmonkey Index | Files

package chaosmonkey

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

Index

Package Files

chaosmonkey.go

type Chaosmonkey Uses

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

Chaosmonkey is the type that holds the necessary content for chaosmonkey test

func New Uses

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.

func (*Chaosmonkey) Do Uses

func (cm *Chaosmonkey) Do()

Do performs the Disruption while testing the registered Tests. Once the caller has registered all Tests with the Chaosmonkey, they call Do. Do starts each registered test asynchronously and waits for each test to signal that it is ready by calling sem.Ready(). Do will then do the Disruption, and when it's complete, close sem.StopCh to signal to the registered Tests that the Disruption is over, and wait for all Tests to return.

func (*Chaosmonkey) Register Uses

func (cm *Chaosmonkey) Register(test Test)

Register registers the given Test with the Chaosmonkey, so that the test will run over the Disruption.

func (*Chaosmonkey) RegisterInterface Uses

func (cm *Chaosmonkey) RegisterInterface(in Interface)

RegisterInterface registers the given Interface with the Chaosmonkey, so the Chaosmonkey will call Setup, Test, and Teardown properly. Test can tell that the Disruption is finished when stopCh is closed.

type Disruption Uses

type Disruption func()

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

type Interface Uses

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 Uses

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 Uses

func (sem *Semaphore) Ready()

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

type Test Uses

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.

Package chaosmonkey imports 1 packages (graph) and is imported by 117 packages. Updated 2019-06-03. Refresh now. Tools for package owners.