Documentation ¶
Index ¶
- Variables
- func CompleteOnSignalWorker(totalCompleteCount int32, name string, opts ...cap.WorkerOpt) (cap.Node, func())
- func FailOnSignalDynSubtree(totalErrCount int32, name string, spawnerOpts []cap.Opt, ...) (cap.Node, func(bool))
- func FailOnSignalWorker(totalErrCount int32, name string, opts ...cap.WorkerOpt) (cap.Node, func(bool))
- func FailStartWorker(name string) cap.Node
- func FailTerminationWorker(name string, err error, opts ...cap.WorkerOpt) cap.Node
- func NeverTerminateWorker(name string) cap.Node
- func ObserveDynSupervisor(ctx0 context.Context, rootName string, childNodes []cap.Node, opts0 []cap.Opt, ...) ([]cap.Event, []error)
- func ObserveSupervisor(ctx context.Context, rootName string, buildNodes cap.BuildNodesFn, ...) ([]cap.Event, error)
- func ObserveSupervisorWithNotifiers(ctx0 context.Context, rootName string, buildNodes cap.BuildNodesFn, ...) ([]cap.Event, error)
- func PanicOnSignalWorker(totalErrCount int32, name string, opts ...cap.WorkerOpt) (cap.Node, func(bool))
- func PanicStartWorker(name string) cap.Node
- func WaitDoneDynSubtree(name string, spawnerOpts []cap.Opt, workerOpts []cap.WorkerOpt, ...) cap.Node
- func WaitDoneWorker(name string) cap.Node
- func WorkerFailedWith(name, errMsg string) smtest.EventP[cap.Event]
- func WorkerStartFailed(name string) smtest.EventP[cap.Event]
- func WorkerStarted(name string) smtest.EventP[cap.Event]
- type AndP
- type ErrorMsgP
- type EventManager
- type EventP
- func ProcessName(name string) EventP
- func SupervisorFailed(name string) EventP
- func SupervisorStartFailed(name string) EventP
- func SupervisorStarted(name string) EventP
- func SupervisorTerminated(name string) EventP
- func WorkerCompleted(name string) EventP
- func WorkerFailed(name string) EventP
- func WorkerTerminated(name string) EventP
- type EventTagP
- type ProcessNameP
- type ProcessNodeTagP
Constants ¶
This section is empty.
Variables ¶
var AssertExactMatch = smtest.AssertExactMatch[cap.Event]
AssertExactMatch is an assertion that checks the input slice of EventP predicate match 1 to 1 with a given list of supervision system events.
var NewEventManager = smtest.NewEventManager[cap.Event]
NewEventManager returns an EventManager instance that can be used to wait for events to happen on the observed supervision system
Functions ¶
func CompleteOnSignalWorker ¶
func CompleteOnSignalWorker( totalCompleteCount int32, name string, opts ...cap.WorkerOpt, ) (cap.Node, func())
CompleteOnSignalWorker creates a cap.Node that runs a goroutine that will complete at at as soon as the returned start signal is called.
func FailOnSignalDynSubtree ¶
func FailOnSignalDynSubtree( totalErrCount int32, name string, spawnerOpts []cap.Opt, workerOpts []cap.WorkerOpt, children ...cap.Node, ) (cap.Node, func(bool))
FailOnSignalDynSubtree creates a cap.Node that runs a dynamic subtree that will fail at least the given number of times as soon as the returned start signal is called. Once this number of times has been reached, it waits until the given `context.Done` channel indicates a supervisor termination.
func FailOnSignalWorker ¶
func FailOnSignalWorker( totalErrCount int32, name string, opts ...cap.WorkerOpt, ) (cap.Node, func(bool))
FailOnSignalWorker creates a cap.Node that runs a goroutine that will fail at least the given number of times as soon as the returned start signal is called. Once this number of times has been reached, it waits until the given `context.Done` channel indicates a supervisor termination.
func FailStartWorker ¶
FailStartWorker creates a `cap.Node` that runs a goroutine that fails on start
func FailTerminationWorker ¶
FailTerminationWorker creates a `cap.Node` that runs a goroutine that blocks until the `context.Done` channel indicates a supervisor termination, then, it returns a given error
func NeverTerminateWorker ¶
NeverTerminateWorker creates a `cap.Node` that runs a goroutine that never stops when asked to, causing the goroutine to leak in the runtime
func ObserveDynSupervisor ¶
func ObserveDynSupervisor( ctx0 context.Context, rootName string, childNodes []cap.Node, opts0 []cap.Opt, callback func(cap.DynSupervisor, EventManager), ) ([]cap.Event, []error)
ObserveDynSupervisor is an utility function that receives all the arguments required to build a DynSupervisor, and a callback that when executed will block until some point in the future (after we performed the side-effects we are testing). This function returns the list of events that happened in the monitored supervised tree, as well as any crash errors.
func ObserveSupervisor ¶
func ObserveSupervisor( ctx context.Context, rootName string, buildNodes cap.BuildNodesFn, opts0 []cap.Opt, callback func(EventManager), ) ([]cap.Event, error)
ObserveSupervisor is an utility function that receives all the arguments required to build a SupervisorSpec, and a callback that when executed will block until some point in the future (after we performed the side-effects we are testing). This function returns the list of events that happened in the monitored supervised tree, as well as any crash errors.
func ObserveSupervisorWithNotifiers ¶
func ObserveSupervisorWithNotifiers( ctx0 context.Context, rootName string, buildNodes cap.BuildNodesFn, opts0 []cap.Opt, notifiers []cap.EventNotifier, callback func(EventManager), ) ([]cap.Event, error)
ObserveSupervisorWithNotifiers is an utility function that receives all the arguments required to build a SupervisorSpec, and a callback that when executed will block until some point in the future (after we performed the side-effects we are testing). This function returns the list of events that happened in the monitored supervised tree, as well as any crash errors.
func PanicOnSignalWorker ¶
func PanicOnSignalWorker( totalErrCount int32, name string, opts ...cap.WorkerOpt, ) (cap.Node, func(bool))
PanicOnSignalWorker creates a cap.Node that runs a goroutine that will panic at least the given number of times as soon as the returned start signal is called. Once this number of times has been reached, it waits until the given context.Done channel indicates a supervisor termination.
func PanicStartWorker ¶ added in v0.5.0
PanicStartWorker creates a `cap.Node` that runs a goroutine that panics on start
func WaitDoneDynSubtree ¶
func WaitDoneDynSubtree( name string, spawnerOpts []cap.Opt, workerOpts []cap.WorkerOpt, children ...cap.Node, ) cap.Node
WaitDoneDynSubtree creates a `cap.Node` that runs a goroutine with a spawner that will spawn the given children. It blocks until the `context.Done` channel indicates a supervisor termination
func WaitDoneWorker ¶
WaitDoneWorker creates a `cap.Node` that runs a goroutine that blocks until the `context.Done` channel indicates a supervisor termination
func WorkerFailedWith ¶
WorkerFailedWith is a predicate to assert an event represents a process that failed
func WorkerStartFailed ¶
WorkerStartFailed is a predicate to assert an event represents a process that failed on start
Types ¶
type AndP ¶
AndP is a predicate that builds the conjunction of a group EventP predicates (e.g. join EventP predicates with &&)
type ErrorMsgP ¶
type ErrorMsgP struct {
// contains filtered or unexported fields
}
ErrorMsgP is a predicate that asserts the message of an error is the one specified
type EventManager ¶
type EventManager = smtest.EventManager[cap.Event]
EventManager provides an API that allows to block a goroutine for particular events in a test system
type EventP ¶
EventP represents a predicate function that allows us to assert properties of an Event signaled by the supervision system
func ProcessName ¶
ProcessName is a predicate to assert an event was triggered by the given runtime process name
func SupervisorFailed ¶
SupervisorFailed is a predicate to assert an event represents a process that failed
func SupervisorStartFailed ¶
SupervisorStartFailed is a predicate to assert an event represents a process that failed on start
func SupervisorStarted ¶
SupervisorStarted is a predicate to assert an event represents a process that got started
func SupervisorTerminated ¶
SupervisorTerminated is a predicate to assert an event represents a process that got stopped by its parent supervisor
func WorkerCompleted ¶
WorkerCompleted is a predicate to assert an event represents a worker process that got completed
func WorkerFailed ¶
WorkerFailed is a predicate to assert an event represents a process that failed
func WorkerTerminated ¶
WorkerTerminated is a predicate to assert an event represents a process that got stopped by its parent supervisor
type EventTagP ¶
type EventTagP struct {
// contains filtered or unexported fields
}
EventTagP is a predicate that asserts the `cap.EventTag` of a given `capataz.Event` matches an expected `cap.EventTag`
type ProcessNameP ¶
type ProcessNameP struct {
// contains filtered or unexported fields
}
ProcessNameP is a predicate that asserts the name of the `Child` that triggered the event matches the expected name
func (ProcessNameP) Call ¶
func (p ProcessNameP) Call(ev cap.Event) bool
Call will execute predicate that checks the name of the process that triggered the event
func (ProcessNameP) String ¶
func (p ProcessNameP) String() string
type ProcessNodeTagP ¶
type ProcessNodeTagP struct {
// contains filtered or unexported fields
}
ProcessNodeTagP is a predicate that asserts the ChildTag of the `Child` that triggered the event matches the expect ChildTag
func (ProcessNodeTagP) Call ¶
func (p ProcessNodeTagP) Call(ev cap.Event) bool
Call will execute predicate that checks the ChildTag of the process that triggered the event matches the expected ChildTag
func (ProcessNodeTagP) String ¶
func (p ProcessNodeTagP) String() string