lib

package module
v0.0.0-...-80ad060 Latest Latest
Warning

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

Go to latest
Published: Oct 28, 2022 License: MIT Imports: 17 Imported by: 9

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Check

func Check(model string, testId TestId, runId RunId) bool

func DBPath

func DBPath() string

func EmitEvent

func EmitEvent(db *sql.DB, event string, meta interface{}, data interface{})

func MarshalUnscheduledEvents

func MarshalUnscheduledEvents(from string, corrId int, oevs []OutEvent) json.RawMessage

func OpenDB

func OpenDB() *sql.DB

func Post

func Post(command string, parameters interface{}) []byte

func PostParse

func PostParse(command string, parameters interface{}, target interface{})

func Register

func Register(testId TestId)

func RegisterExecutor

func RegisterExecutor(executorId string, components []string)

func Reset

func Reset()

func Run

func Run()

func Setup

func Setup(f func())

func Status

func Status() map[string]interface{}

func Step

func Step() json.RawMessage

func Teardown

func Teardown(srv *http.Server)

func UnmarshalScheduledEvent

func UnmarshalScheduledEvent(m Marshaler, input []byte, output *ScheduledEvent) error

Types

type Agenda

type Agenda = []ScheduledEvent

type Args

type Args interface{ Args() }

type ClientRequest

type ClientRequest struct {
	Id      uint64
	Request Request
}

func (ClientRequest) InEvent

func (_ ClientRequest) InEvent()

type ClientResponse

type ClientResponse struct {
	Id       uint64   `json:"id"`
	Response Response `json:"response"`
}

func (ClientResponse) Args

func (_ ClientResponse) Args()

func (ClientResponse) ResponseEvent

func (c ClientResponse) ResponseEvent() string

type Crash

type Crash struct {
	From string
	At   int
}

func (Crash) FaultArgs

func (_ Crash) FaultArgs()

type CreateRunEvent

type CreateRunEvent struct {
	Seed          Seed
	Faults        Faults
	TickFrequency float64
	MinTimeNs     time.Duration
	MaxTimeNs     time.Duration
}

type DeploymentInfo

type DeploymentInfo struct {
	Reactor string          `json:"reactor"`
	Type    string          `json:"type"`
	Args    json.RawMessage `json:"args"`
}

func DeploymentInfoForTest

func DeploymentInfoForTest(testId TestId) ([]DeploymentInfo, error)

type Event

type Event interface{ IsEvent() }

func OutEventsToEvents

func OutEventsToEvents(from string, oevs []OutEvent) []Event

type FailSpec

type FailSpec struct {
	EFF         int // End (time) of finite failures.
	Crashes     int // Max amount of node (permanent) crashes.
	EOT         int // End of time, for the test.
	LimitFaults int // Have a limit of how many faults may be generated, 0 is no limit
}

type Fault

type Fault struct {
	Kind string
	Args FaultArgs
}

func (*Fault) UnmarshalJSON

func (f *Fault) UnmarshalJSON(bs []byte) error

type FaultArgs

type FaultArgs interface{ FaultArgs() }

type Faults

type Faults = struct {
	Faults []Fault `json:"faults"`
}

func Ldfi

func Ldfi(testId TestId, failedRunIds []RunId, fail FailSpec) Faults

type InEvent

type InEvent interface{ InEvent() }

type InternalMessage

type InternalMessage struct {
	Message Message `json:"message"`
}

func (InternalMessage) Args

func (_ InternalMessage) Args()

func (InternalMessage) InEvent

func (_ InternalMessage) InEvent()

func (InternalMessage) MarshalJSON

func (im InternalMessage) MarshalJSON() ([]byte, error)

func (InternalMessage) MessageEvent

func (im InternalMessage) MessageEvent() string

type Item

type Item struct {
	Name    string
	Reactor Reactor
}

type LTLResult

type LTLResult struct {
	Result bool   `json:"result"`
	Reason string `json:"reason"`
}

func LtlChecker

func LtlChecker(testId TestId, runId RunId, formula string) LTLResult

type Marshaler

type Marshaler interface {
	UnmarshalRequest(request string, input json.RawMessage, output *Request) error
	UnmarshalMessage(message string, input json.RawMessage, output *Message) error
}

type Message

type Message interface {
	MessageEvent() string
}

type MetaInfo

type MetaInfo struct {
	TestId      TestId `json:"test-id"`
	RunId       RunId  `json:"run-id"`
	LogicalTime int    `json:"logical-time"`
}

type Omission

type Omission struct {
	From string
	To   string
	At   int
}

func (Omission) FaultArgs

func (_ Omission) FaultArgs()

type OutEvent

type OutEvent struct {
	To   []Receiver // Assumed to be a set.
	Args Args
}

type QueueSize

type QueueSize struct {
	QueueSize int `json:"queue-size"`
}

func LoadTest

func LoadTest(testId TestId) QueueSize

type Reactor

type Reactor interface {
	Receive(at time.Time, from string, event InEvent) []OutEvent
	Tick(at time.Time) []OutEvent
	Timer(at time.Time) []OutEvent
	Init() []OutEvent
}

type Receiver

type Receiver = string

func Set

func Set(to ...Receiver) []Receiver

func Singleton

func Singleton(to Receiver) []Receiver

type Request

type Request interface {
	RequestEvent() string
}

type Response

type Response interface {
	ResponseEvent() string
}

type RunId

type RunId struct {
	RunId int
}

func CreateRun

func CreateRun(testId TestId, event CreateRunEvent) RunId

func ParseRunId

func ParseRunId(s string) (RunId, error)

func (RunId) MarshalJSON

func (runId RunId) MarshalJSON() ([]byte, error)

func (*RunId) UnmarshalJSON

func (runId *RunId) UnmarshalJSON(b []byte) error

type ScheduledEvent

type ScheduledEvent struct {
	At    time.Time
	From  string
	To    string
	Event InEvent
	Meta  MetaInfo
}

type SchedulerFault

type SchedulerFault struct {
	Kind string `json:"kind"`
	From string `json:"from"`
	To   string `json:"to"`
	At   int    `json:"at"` // should be time.Time?
}

type SchedulerRequest

type SchedulerRequest struct {
	Command    string      `json:"command"`
	Parameters interface{} `json:"parameters"`
}

type Seed

type Seed int

type TestId

type TestId struct {
	TestId int
}

func GenerateTest

func GenerateTest(test string) TestId

func GenerateTestFromTopologyAndAgenda

func GenerateTestFromTopologyAndAgenda(topology Topology, agenda Agenda) TestId

func ParseTestId

func ParseTestId(s string) (TestId, error)

func (TestId) MarshalJSON

func (testId TestId) MarshalJSON() ([]byte, error)

func (*TestId) UnmarshalJSON

func (testId *TestId) UnmarshalJSON(b []byte) error

type TimeFromString

type TimeFromString time.Time

func (*TimeFromString) Scan

func (tf *TimeFromString) Scan(src interface{}) error

type TimePico

type TimePico time.Time

func (*TimePico) UnmarshalJSON

func (t *TimePico) UnmarshalJSON(data []byte) error

type Timer

type Timer struct {
	Duration time.Duration `json:"duration"`
}

func (Timer) Args

func (_ Timer) Args()

type Topology

type Topology struct {
	// contains filtered or unexported fields
}

func NewTopology

func NewTopology(init ...Item) Topology

func (Topology) Insert

func (t Topology) Insert(reactorName string, reactor Reactor)

func (Topology) Len

func (t Topology) Len() int

func (Topology) Reactor

func (t Topology) Reactor(reactorName string) Reactor

func (Topology) Reactors

func (t Topology) Reactors() []string

Jump to

Keyboard shortcuts

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