runtaskoptions

package
v0.0.9 Latest Latest
Warning

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

Go to latest
Published: May 7, 2024 License: GPL-3.0 Imports: 7 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.

Configuration Parameters

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

  • propagateResult:
    This setting controls how the result of the child task influences the result of the run_task_options task. If set to true, any change in the result of the child task (success or failure) is immediately reflected in the result of the parent run_task_options task. If false, the child task's result is only propagated to the parent task after the child task has completed its execution.

  • exitOnResult:
    If set to true, the task will cancel the child task as soon as it sets a result, whether it is "success" or "failure." This option is useful for scenarios where immediate response to the child task's result is necessary.

  • 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.

  • expectFailure:
    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, ensuring that failure scenarios are handled as expected.

  • ignoreFailure:
    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.

  • 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.

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

  • 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.

Defaults

Default settings for the run_task_options task:

- name: run_task_options
  config:
    task: null
    propagateResult: false
    exitOnResult: false
    invertResult: false
    expectFailure: false
    ignoreFailure: false
    retryOnFailure: false
    maxRetryCount: 0
    newVariableScope: false

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.",
		Config:      DefaultConfig(),
		NewTask:     NewTask,
	}
)

Functions

func NewTask

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

Types

type Config

type Config struct {
	Task             *helper.RawMessage `yaml:"task" json:"tasks"`
	PropagateResult  bool               `yaml:"propagateResult" json:"propagateResult"`
	ExitOnResult     bool               `yaml:"exitOnResult" json:"exitOnResult"`
	InvertResult     bool               `yaml:"invertResult" json:"invertResult"`
	ExpectFailure    bool               `yaml:"expectFailure" json:"expectFailure"`
	IgnoreFailure    bool               `yaml:"ignoreFailure" json:"ignoreFailure"`
	RetryOnFailure   bool               `yaml:"retryOnFailure" json:"retryOnFailure"`
	MaxRetryCount    uint               `yaml:"maxRetryCount" json:"maxRetryCount"`
	NewVariableScope bool               `yaml:"newVariableScope" json:"newVariableScope"`
}

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) Description

func (t *Task) Description() string

func (*Task) Execute

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

func (*Task) LoadConfig

func (t *Task) LoadConfig() error

func (*Task) Logger

func (t *Task) Logger() logrus.FieldLogger

func (*Task) Name

func (t *Task) Name() string

func (*Task) Timeout

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

func (*Task) Title

func (t *Task) Title() string

Jump to

Keyboard shortcuts

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