chaos

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Mar 25, 2026 License: GPL-3.0 Imports: 3 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package chaos provides protocol chaos engineering tools.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CorruptField

func CorruptField(data []byte) []byte

CorruptField randomly corrupts a byte in the data.

Types

type Fault

type Fault struct {
	Type        FaultType `json:"type"`
	Probability float64   `json:"probability"` // 0.0-1.0
	Config      string    `json:"config"`
}

Fault represents a chaos fault injection.

type FaultType

type FaultType string

FaultType represents a chaos fault type.

const (
	FaultCorrupt FaultType = "corrupt"
	FaultDelay   FaultType = "delay"
	FaultDrop    FaultType = "drop"
	FaultReorder FaultType = "reorder"
	FaultDegrade FaultType = "degrade"
)

type Scenario

type Scenario struct {
	Name     string  `json:"name"`
	Protocol string  `json:"protocol"`
	Target   string  `json:"target"`
	Faults   []Fault `json:"faults"`
}

Scenario represents a chaos test scenario.

func NewScenario

func NewScenario(name, protocol, target string) *Scenario

NewScenario creates a new chaos scenario.

func (*Scenario) AddFault

func (s *Scenario) AddFault(ft FaultType, prob float64, config string)

AddFault adds a fault injection.

func (*Scenario) Describe

func (s *Scenario) Describe() string

Describe returns a scenario description.

Jump to

Keyboard shortcuts

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