Documentation ¶
Overview ¶
Package crash provides a framework for adding probabilistic crash points. The package provides a global singleton that can be used to register, configure, and trigger crashes.
Index ¶
- func Config(crashPointConfig map[string]float64)
- func Here(crashPointID string)
- func InitFlags() *flag.FlagSet
- func ListRegisteredCrashPoints() []string
- func LoadViperArgValues()
- func OverrideGlobalOptions(options CrasherOptions)
- func RegisterCrashPoints(crashPointIDs ...string)
- type Crasher
- func (c *Crasher) Config(crashPointConfig map[string]float64)
- func (c *Crasher) Here(crashPointID string)
- func (c *Crasher) InitFlags() *flag.FlagSet
- func (c *Crasher) ListRegisteredCrashPoints() []string
- func (c *Crasher) LoadViperArgValues()
- func (c *Crasher) RegisterCrashPoints(crashPointIDs ...string)
- type CrasherOptions
- type RandomProvider
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Here ¶
func Here(crashPointID string)
Here invokes the global crasher to crash at this point based on the passed in crashPointID's probability.
func InitFlags ¶
InitFlags creates flags from the registered crash points and registers those flags with Viper.
func ListRegisteredCrashPoints ¶
func ListRegisteredCrashPoints() []string
ListRegisteredCrashPoints lists the registered crash points for the global Crasher instance.
func LoadViperArgValues ¶
func LoadViperArgValues()
LoadViperArgValues loads viper arg values into the crash point config of the global crasher.
func OverrideGlobalOptions ¶
func OverrideGlobalOptions(options CrasherOptions)
OverrideGlobalOptions overrides global crasher options.
func RegisterCrashPoints ¶
func RegisterCrashPoints(crashPointIDs ...string)
RegisterCrashPoints registers crash points with the global Crasher instance.
Types ¶
type Crasher ¶
type Crasher struct { CrashPointConfig map[string]float64 CrashMethod func() CLIPrefix string Rand RandomProvider // contains filtered or unexported fields }
Crasher is a crash controller.
func (*Crasher) Here ¶
Here crashes at this point based on the passed in crashPointID's probability.
func (*Crasher) InitFlags ¶
InitFlags creates flags from the registered crash points and registers those flags with Viper.
func (*Crasher) ListRegisteredCrashPoints ¶
ListRegisteredCrashPoints lists the registered crash points for a Crasher instance.
func (*Crasher) LoadViperArgValues ¶
func (c *Crasher) LoadViperArgValues()
LoadViperArgValues loads viper arg values into the crash point config.
func (*Crasher) RegisterCrashPoints ¶
RegisterCrashPoints registers crash points for a Crasher instance.
type CrasherOptions ¶
type CrasherOptions struct { CrashMethod func() CLIPrefix string Rand RandomProvider CallerSkip int }
CrasherOptions options used to create a new crasher.
type RandomProvider ¶
type RandomProvider interface {
Float64() float64
}
RandomProvider interface that provides a Float64 random.