fault

package
v0.0.0-debug-20260702 Latest Latest
Warning

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

Go to latest
Published: Jul 2, 2026 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Overview

A very simple fault injection tool.

Index

Constants

View Source
const (
	STOP = iota
	LOOKUP
	ADD
	REMOVE
	TRIGGER
	LIST
)
View Source
const (
	RETURN = iota
	GETCOUNT
	SLEEP
	WAIT
	GETWAITERS
	NOTIFY
	NOTIFYALL
	PANIC
	ECHO
)
View Source
const (
	// PANIC with non-moerr
	PanicUseNonMoErr = 0
	// PANIC with moerr.NewXXXErr
	PanicUseMoErr = 1
)
View Source
const (
	EnableFault  = "ENABLE_FAULT_INJECTION"
	DisableFault = "DISABLE_FAULT_INJECTION"
	StatusFault  = "STATUS_FAULT_POINT"
	ListFault    = "LIST_FAULT_POINT"
	AddFault     = "ADD_FAULT_POINT"
	RemoveFault  = "REMOVE_FAULT_POINT"
)

Variables

This section is empty.

Functions

func AddFaultPoint

func AddFaultPoint(ctx context.Context, name string, freq string, action string, iarg int64, sarg string, constant bool) error

func AddFaultPointInDomain

func AddFaultPointInDomain(ctx context.Context, domain Domain, name string, freq string, action string, iarg int64, sarg string, constant bool) error

func Disable

func Disable() bool

Disable fault injection

func DisableDomain

func DisableDomain(domain Domain) bool

func Enable

func Enable() bool

Enable fault injection

func EnableDomain

func EnableDomain(domain Domain) bool

func HandleFaultInject

func HandleFaultInject(
	ctx context.Context,
	name string,
	parameter string,
) (res string)

func ListAllFaultPoints

func ListAllFaultPoints() string

func ListAllFaultPointsInDomain

func ListAllFaultPointsInDomain(domain Domain) string

func RemoveFaultPoint

func RemoveFaultPoint(ctx context.Context, name string) (bool, error)

func RemoveFaultPointFromDomain

func RemoveFaultPointFromDomain(ctx context.Context, domain Domain, name string) (bool, error)

func Status

func Status() bool

func StatusOfDomain

func StatusOfDomain(domain Domain) bool

func TriggerFault

func TriggerFault(name string) (iret int64, sret string, exist bool)

Trigger a fault point.

func TriggerFaultInDomain

func TriggerFaultInDomain(domain Domain, name string) (iret int64, sret string, exist bool)

Types

type Domain

type Domain int

Domain is the business domain of injection !!!It always less than DomainMax

const (
	DomainDefault  Domain = 0
	DomainTest     Domain = 1
	DomainFrontend Domain = 2
	DomainMax      Domain = 4096
)

type Point

type Point struct {
	Name string `json:"name"`
	Iarg int64  `json:"iarg"`
	Sarg string `json:"sarg"`

	Constant bool `json:"constant"`
}

Jump to

Keyboard shortcuts

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