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: 0

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