chaos

package
v0.8.2 Latest Latest
Warning

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

Go to latest
Published: Oct 22, 2026 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Overview

Package chaos describes the failure scenarios the platform is measured against and the result record they produce.

Index

Constants

View Source
const (
	KillContainer      = "kill-container"
	DaemonUnreachable  = "daemon-unreachable"
	ControlPlaneBounce = "control-plane-restart"
	DiskPressure       = "disk-pressure"
	OOMDuringReadiness = "oom-during-readiness"
	IngressSteady      = "ingress-steady"
	DeployLatency      = "deploy-latency"
	RolloutUnderLoad   = "rollout-under-traffic"
	IngressConcurrency = "ingress-concurrency"
	ReplicaFailover    = "replica-failover"
)

Scenario names, stable because they are stored and used as CLI arguments.

View Source
const (
	StatusPassed  = "passed"
	StatusFailed  = "failed"
	StatusSkipped = "skipped"
)

Result statuses.

Variables

This section is empty.

Functions

func MarkdownRow

func MarkdownRow(r Result) string

MarkdownRow renders one result as a docs/benchmarks.md table row.

func Valid

func Valid(name string) bool

Valid reports whether name is a known scenario.

func WriteTable

func WriteTable(w io.Writer, results []Result)

WriteTable prints results for a human.

Types

type Assertion

type Assertion struct {
	Name   string `json:"name"`
	Passed bool   `json:"passed"`
	Detail string `json:"detail,omitempty"`
}

Assertion is one checked expectation.

type Info

type Info struct {
	Name        string `json:"name"`
	Title       string `json:"title"`
	Expectation string `json:"expectation"`
}

Info is one scenario's catalog entry.

func Catalog

func Catalog() []Info

Catalog lists every scenario in display order.

type Result

type Result struct {
	ID            string      `json:"id,omitempty"`
	Scenario      string      `json:"scenario"`
	Status        string      `json:"status"`
	Summary       string      `json:"summary"`
	RecoveryMS    float64     `json:"recovery_ms"`
	ErrorWindowMS float64     `json:"error_window_ms"`
	Requests      int         `json:"requests"`
	RequestErrors int         `json:"request_errors"`
	Assertions    []Assertion `json:"assertions"`
	Hardware      string      `json:"hardware,omitempty"`
	RanAt         time.Time   `json:"ran_at"`
	DurationMS    float64     `json:"duration_ms"`
}

Result is one measured run of one scenario.

func Latest

func Latest(results []Result) (latest []Result, unmeasured []string)

Latest keeps the newest result per scenario, in catalog order, and names the scenarios never run.

func (*Result) Assert

func (r *Result) Assert(name string, ok bool, detail string)

Assert records one expectation on r and downgrades the status when it fails.

func (*Result) Finish

func (r *Result) Finish()

Finish sets the status from the recorded assertions unless the run was skipped.

type Summary

type Summary struct {
	Hardware string   `json:"hardware"`
	Results  []Result `json:"results"`
	Passed   int      `json:"passed"`
	Failed   int      `json:"failed"`
	Skipped  int      `json:"skipped"`
}

Summary is the machine-readable output of one runner invocation.

func Summarize

func Summarize(hardware string, results []Result) Summary

Summarize tallies results.

Directories

Path Synopsis
Package live runs the chaos scenarios against real local Docker containers that carry a unique name prefix and are always removed afterwards.
Package live runs the chaos scenarios against real local Docker containers that carry a unique name prefix and are always removed afterwards.

Jump to

Keyboard shortcuts

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