Documentation ¶
Index ¶
- func ForEachTarget(pluginName string, ctx xcontext.Context, ch test.TestStepChannels, ...) (json.RawMessage, error)
- func ForEachTargetWithResume(ctx xcontext.Context, ch test.TestStepChannels, resumeState json.RawMessage, ...) (json.RawMessage, error)
- func MarshalState(state interface{}, version int) (json.RawMessage, error)
- type PerTargetFunc
- type PerTargetWithResumeFunc
- type TargetWithData
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ForEachTarget ¶
func ForEachTarget(pluginName string, ctx xcontext.Context, ch test.TestStepChannels, f PerTargetFunc) (json.RawMessage, error)
ForEachTarget is a simple helper to write plugins that apply a given PerTargetFunc independenly to each target. This helper handles routing through the in/out channels, and forwards cancel/pause signals to the PerTargetFunc. Note this helper does NOT saving state and pausing a test step, so it is only suited for short-running tests or for environments that don't use job resumption. Use ForEachTargetWithResume below for a similar helper with full resumption support. This function wraps the logic that handles target routing through the in/out The implementation of the per-target function is responsible for reacting to cancel/pause signals and return quickly.
func ForEachTargetWithResume ¶
func ForEachTargetWithResume(ctx xcontext.Context, ch test.TestStepChannels, resumeState json.RawMessage, currentStepStateVersion int, f PerTargetWithResumeFunc) (json.RawMessage, error)
ForEachTargetWithResume is a helper to write plugins that support job resumption. This helper is for plugins that want to apply a single function to all targets, independently. This helper calls the supplied PerTargetWithResumeFunc immediately for each target received, in a separate goroutine. When the function returns, the target is sent to the output channels so it can run through the next test step. This helper directly accepts the resumeState from the Run method of the TestStep interface, and the return value can directly be passed back to the framework. The helper automatically manages data returned on pause and makes sure the function is called again with the same data on job resumption. The helper will not call functions again that succeeded or failed before the pause signal was received. The supplied PerTargetWithResumeFunc must react to pause and cancellation signals as normal.
func MarshalState ¶
func MarshalState(state interface{}, version int) (json.RawMessage, error)
MarshalState serializes the provided state struct as JSON. It sets the Version field to the specified value.
Types ¶
type PerTargetFunc ¶
PerTargetFunc is a function type that is called on each target by the ForEachTarget function below.
type PerTargetWithResumeFunc ¶
type PerTargetWithResumeFunc func(ctx xcontext.Context, target *TargetWithData) error
PerTargetWithResumeFunc is the function that is called per target by ForEachTargetWithResume It must obey the context and quickly return on cancellation and pause signals. Functions can modify target and store any data required for resumption in target.data.
type TargetWithData ¶
type TargetWithData struct { Target *target.Target Data json.RawMessage }
TargetWithData holds a step target and the pause/resumption data for it Each per-target function gets this passed in and can store any data required to resume in data.
Directories ¶
Path | Synopsis |
---|---|
The CPUCmd plugin implements an CPU command executor step.
|
The CPUCmd plugin implements an CPU command executor step. |
Package waitport provides an ability of waiting for a port on remote host to be opened for listening
|
Package waitport provides an ability of waiting for a port on remote host to be opened for listening |