chaos

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Jan 26, 2022 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrFailEnabled = errors.New("failing switchable appender is failing")

Functions

This section is empty.

Types

type BlockingSwitchable

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

BlockingSwitchable allows to block all messages until it is released.

func NewBlockingSwitchable

func NewBlockingSwitchable(inner zapappender.Appender) *BlockingSwitchable

func NewBlockingSwitchableCtx

func NewBlockingSwitchableCtx(ctx context.Context, inner zapappender.Appender) *BlockingSwitchable

func (*BlockingSwitchable) Break

func (a *BlockingSwitchable) Break()

Break blocks all messages until Fix is called.

func (*BlockingSwitchable) Breaking

func (a *BlockingSwitchable) Breaking() bool

Breaking returns true if messages are currently blocked.

func (*BlockingSwitchable) Fix

func (a *BlockingSwitchable) Fix()

Fix unblocks the messages.

func (*BlockingSwitchable) Sync

func (a *BlockingSwitchable) Sync() error

func (*BlockingSwitchable) Write

func (a *BlockingSwitchable) Write(p []byte, ent zapcore.Entry) (n int, err error)

type FailingSwitchable

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

FailingSwitchable returns an error on all writes while it is Breaking.

func NewFailingSwitchable

func NewFailingSwitchable(inner zapappender.Appender) *FailingSwitchable

func (*FailingSwitchable) Break

func (a *FailingSwitchable) Break()

Break starts failing messages.

func (*FailingSwitchable) Breaking

func (a *FailingSwitchable) Breaking() bool

Breaking returns true if FailingSwitchable is set to fail.

func (*FailingSwitchable) Fix

func (a *FailingSwitchable) Fix()

Fix stops failing messages.

func (*FailingSwitchable) Sync

func (a *FailingSwitchable) Sync() error

func (*FailingSwitchable) Write

func (a *FailingSwitchable) Write(p []byte, ent zapcore.Entry) (n int, err error)

type Switchable

type Switchable interface {
	// Breaking returns true if the failure behaviour is activated.
	Breaking() bool
	// Break starts the failure behaviour.
	Break()
	// Fix stops the failure behaviour.
	Fix()
}

Switchable is the base interface for chaos adapters created for testing.

Jump to

Keyboard shortcuts

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