Documentation
¶
Overview ¶
Package strategies provides the framework to define testing strategies.
Test strategy can incorporate any exploration logic and run for a specified number of iterations. The package provides some inbuilt strategies like PCTCP and unittest (running a unit test for many iterations)
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Action ¶ added in v0.1.3
type Action struct {
// Unique name for the action
Name string
// Function that performs the action
Do func(*Context, *apiserver.APIServer) error
}
Action that the strategy can perform
func ActionSequence ¶ added in v0.1.4
ActionSequence actions executes actions in a sequence
func DeliverMany ¶ added in v0.2.2
DeliverMany action delivered all the specified messages
func DeliverMessage ¶ added in v0.1.3
DeliverMessage action that delivered the given message using apiserver.APIServer
type Context ¶ added in v0.1.1
type Context struct {
*sm.Context
// ActionSequence stores the sequence of actions performed in the current iteration
ActionSequence *types.List[*Action]
// contains filtered or unexported fields
}
Context here references to the execution context of a strategy
func (*Context) CurIteration ¶ added in v0.1.3
CurIteration returns the current iteration number
type Driver ¶
type Driver struct {
*types.BaseService
// contains filtered or unexported fields
}
Driver runs the strategy with the specified configuration
func NewStrategyDriver ¶ added in v0.1.3
func NewStrategyDriver( config *config.Config, mp types.MessageParser, strategy Strategy, sConfig *StrategyConfig, ) *Driver
NewStrategyDriver creates a strategy and initializes the APIServer
func (*Driver) SetupRouter ¶
func (srv *Driver) SetupRouter(router *gin.RouterGroup)
SetupRouter for setting up the dashboard routes implements DashboardRouter
type Strategy ¶
type Strategy interface {
types.Service
// ActionsCh should return a channel that is used to
// communicate the actions that needs to be performed
ActionsCh() *types.Channel[*Action]
// Step is called for each event, actions to be performed can be decided within the step call
Step(*types.Event, *Context)
// EndCurIteration is called at the end of every iteration
EndCurIteration(*Context)
// NextIteration is called at the beginning of every iteration
NextIteration(*Context)
// Finalize is called after executing all the iteration.
// This function can be used to record/log telemetry or other stats
Finalize(*Context)
}
Strategy interface to define an exploration strategy An exploration strategy should be encoded in this strategy
func NewStrategyWithProperty ¶ added in v0.2.0
func NewStrategyWithProperty(strategy Strategy, prop *sm.StateMachine) Strategy
Creates a new StrategyWithProperty
type StrategyConfig ¶ added in v0.1.4
type StrategyConfig struct {
// Iterations the number of iterations to be run
Iterations int `json:"iterations"`
// IterationTimeout timeout for each iteration
IterationTimeout time.Duration `json:"iteration_timeout"`
// SetupFunc invoked at the start of every iteration
SetupFunc func(*Context)
// StepFunc invoked for every event in all iterations
StepFunc func(*types.Event, *Context)
// FinalizeFunc is invoked after all the iterations are completed
FinalizeFunc func(*Context)
}
StrategyConfig store the config used for running strategies
type StrategyWithProperty ¶ added in v0.2.0
type StrategyWithProperty struct {
Strategy
Property *sm.StateMachine
// contains filtered or unexported fields
}
StrategyWithProperty encapsulates a strategy with a property The property is specified as a state machine
func (*StrategyWithProperty) EndCurIteration ¶ added in v0.2.0
func (s *StrategyWithProperty) EndCurIteration(ctx *Context)
func (*StrategyWithProperty) Finalize ¶ added in v0.2.0
func (s *StrategyWithProperty) Finalize(ctx *Context)
func (*StrategyWithProperty) NextIteration ¶ added in v0.2.0
func (s *StrategyWithProperty) NextIteration(ctx *Context)
Directories
¶
| Path | Synopsis |
|---|---|
|
Package pct defines the PCTCP testing strategy
|
Package pct defines the PCTCP testing strategy |
|
Package timeout encodes a strategy where timeout durations are chosen non deterministically
|
Package timeout encodes a strategy where timeout durations are chosen non deterministically |
|
Package unittest strategy runs the same unit test for each iteration
|
Package unittest strategy runs the same unit test for each iteration |