runtaskoptions

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Apr 14, 2026 License: GPL-3.0 Imports: 8 Imported by: 0

README

run_task_options Task

Description

The run_task_options task is designed to execute a single task with configurable behaviors and response actions. This flexibility allows for precise control over how the task's outcome is handled and how it interacts with the overall test environment.

Task Behavior
  • Executes the child task and waits for it to complete naturally.
  • Supports retry logic for failed tasks.
  • Can transform the result (invert, ignore, expect failure).

Configuration Parameters

  • task:
    The task to be executed. This is defined following the standard task definition format.

  • retryOnFailure:
    If set to true, the task will retry the execution of the child task if it fails, up to the maximum number of retries specified by maxRetryCount. Default: false.

  • maxRetryCount:
    The maximum number of times the child task will be retried if it fails and retryOnFailure is true. Default: 0 (no retries).

  • invertResult:
    When true, the result of the child task is inverted. This means the run_task_options task will fail if the child task succeeds and succeed if the child task fails. This can be used to validate negative test scenarios. Default: false.

  • expectFailure:
    Alias for invertResult. If set to true, this option expects the child task to fail. The run_task_options task will fail if the child task does not end with a "failure" result. Default: false.

  • ignoreResult:
    When true, any failure result from the child task is ignored, and the run_task_options task will return a success result instead. This is useful for cases where the child task's failure is an acceptable outcome. Default: false.

  • newVariableScope:
    Determines whether to create a new variable scope for the child task. If false, the current scope is passed through, allowing the child task to share the same variable context as the run_task_options task. Default: false.

Defaults

Default settings for the run_task_options task:

- name: run_task_options
  config:
    task: null
    retryOnFailure: false
    maxRetryCount: 0
    invertResult: false
    expectFailure: false
    ignoreResult: false
    newVariableScope: false

Outputs

This task does not produce any outputs.

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	TaskName       = "run_task_options"
	TaskDescriptor = &types.TaskDescriptor{
		Name:        TaskName,
		Description: "Runs task with configurable behaviour.",
		Category:    "flow-control",
		Config:      DefaultConfig(),
		Outputs:     []types.TaskOutputDefinition{},
		NewTask:     NewTask,
	}
)

Functions

func NewTask

func NewTask(ctx *types.TaskContext, options *types.TaskOptions) (types.Task, error)

Types

type Config

type Config struct {
	Task             *helper.RawMessageMasked `yaml:"task" json:"task" require:"A" desc:"The task to execute with additional options."`
	NewVariableScope bool                     `yaml:"newVariableScope" json:"newVariableScope" desc:"If true, create a new variable scope for the child task."`

	// Retry behavior
	RetryOnFailure bool `yaml:"retryOnFailure" json:"retryOnFailure" desc:"If true, retry the task on failure."`
	MaxRetryCount  uint `yaml:"maxRetryCount" json:"maxRetryCount" desc:"Maximum number of retry attempts."`

	// Result transformation
	InvertResult  bool `yaml:"invertResult" json:"invertResult" desc:"If true, swap success and failure results."`
	IgnoreResult  bool `yaml:"ignoreResult" json:"ignoreResult" desc:"If true, always report success regardless of child task result."`
	IgnoreFailure bool `yaml:"ignoreFailure" json:"ignoreFailure" desc:"If true, ignore the failure of the child task."`
	ExpectFailure bool `yaml:"expectFailure" json:"expectFailure" desc:"Alias for invertResult - expect the task to fail."`
}

func DefaultConfig

func DefaultConfig() Config

func (*Config) Validate

func (c *Config) Validate() error

type Task

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

func (*Task) Config

func (t *Task) Config() interface{}

func (*Task) Execute

func (t *Task) Execute(ctx context.Context) error

func (*Task) LoadConfig

func (t *Task) LoadConfig() error

func (*Task) Timeout

func (t *Task) Timeout() time.Duration

Jump to

Keyboard shortcuts

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