tysmhookactivation

package
v0.1.2 Latest Latest
Warning

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

Go to latest
Published: May 15, 2026 License: GPL-3.0 Imports: 13 Imported by: 0

README

tysm_hook_activation Task

Description

Creates a TTL-bound activation against a TYSM beacon node's hook-control API (POST /tysm/v1/activations).

An activation overlays (enabled, configPatch) on the hook's baseline state for a bounded duration. When the TTL expires (or the activation is deleted via tysm_hook_deactivation), the hook reverts to its baseline. Designed for chaos-style flows where assertoor flips a hook to a non-default state, exercises the network, and then cleans up.

This task is a paired primitive: pair it with tysm_hook_deactivation placed in the test's top-level cleanupTasks: block so the activation is torn down even if the test fails.

Task Behavior
  • POSTs the activation request and returns immediately on 201 Created.
  • Records activation_id and expires_at as task outputs for later use (typically by a deactivation task in cleanup).
  • Fails on any non-201 response, surfacing the server's error message.
  • Does not wait for or assert anything about hook side-effects — that is the responsibility of subsequent tasks in the playbook.

Configuration Parameters

  • endpoint:
    Base URL of the TYSM API, e.g. http://beacon:8080. Required.

  • auth_token:
    Bearer token sent in the Authorization header. Required when the TYSM API has auth enabled. Recommended to supply via configVars so the secret is not hard-coded into the playbook.

  • hook:
    Name of the hook to activate. Must be a hook implementing RuntimeReconfigurable on the server side (currently blob-mutator, data-column-mutator); other names are rejected with 400.

  • enabled:
    Optional boolean override of the hook's enabled flag while the activation is in force. Either this or configPatch (or both) must be supplied.

  • configPatch:
    Optional shallow patch over the hook's baseline configuration. Top-level keys present here wholly replace the corresponding baseline keys; absent keys keep their baseline value.

  • duration:
    Activation TTL as a Go duration string (10m, 1h, ...). Required. The server enforces a hard cap (api.max_activation_duration); requests exceeding it are rejected.

  • replace:
    If true, replace any existing activation against the same hook instead of returning 409 Conflict. Default false.

Defaults

- name: tysm_hook_activation
  config:
    endpoint: ""
    auth_token: ""
    hook: ""
    enabled: null
    configPatch: {}
    duration: "0s"
    replace: false

Outputs

Name Type Description
activation_id string Server-assigned activation ID. Pass to tysm_hook_deactivation.
expires_at string RFC3339 timestamp at which the server-side TTL expires.
hook string Hook the activation targets (echoes the input).

Example

tests:
  - id: kzg_chaos_run
    name: "blob-mutator KZG chaos"
    cleanupTasks:
      - name: tysm_hook_deactivation
        config:
          endpoint: "http://beacon:8080"
        configVars:
          auth_token: "tysmApiToken"
          activation_id: "tasks.kzg_chaos.outputs.activation_id"
    tasks:
      - name: tysm_hook_activation
        id: kzg_chaos
        config:
          endpoint: "http://beacon:8080"
          hook: "blob-mutator"
          enabled: true
          configPatch:
            mutationProbability: 1.0
            enabledStrategies: ["kzg-corruption"]
          duration: "10m"
          replace: false
        configVars:
          auth_token: "tysmApiToken"

      # ... assertions about network behaviour while activation is in force ...

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	TaskName       = "tysm_hook_activation"
	TaskDescriptor = &types.TaskDescriptor{
		Name:        TaskName,
		Description: "Create a TTL-bound activation against a TYSM hook-control API.",
		Category:    "tysm",
		Config:      DefaultConfig(),
		Outputs: []types.TaskOutputDefinition{
			{
				Name:        "activation_id",
				Type:        "string",
				Description: "Server-assigned activation ID; pass to tysm_hook_deactivation as activation_id.",
			},
			{
				Name:        "expires_at",
				Type:        "string",
				Description: "RFC3339 timestamp at which the server-side TTL expires and the hook reverts to baseline.",
			},
			{
				Name:        "hook",
				Type:        "string",
				Description: "Name of the hook the activation targets (echoes the input).",
			},
		},
		NewTask: NewTask,
	}
)

Functions

func NewTask

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

Types

type Config

type Config struct {
	Endpoint    string                 `yaml:"endpoint" json:"endpoint" require:"A" desc:"Base URL of the TYSM API, e.g. http://beacon:8080"`
	AuthToken   string                 `yaml:"auth_token" json:"auth_token" desc:"Bearer token sent in the Authorization header. Prefer supplying via configVars."`
	Hook        string                 `yaml:"hook" json:"hook" require:"A" desc:"Name of the TYSM hook to activate (e.g. blob-mutator)."`
	Enabled     *bool                  `yaml:"enabled,omitempty" json:"enabled,omitempty" desc:"Override the hook's enabled flag while the activation is in force."`
	ConfigPatch map[string]interface{} `` /* 142-byte string literal not displayed */
	Duration    helper.Duration        `` /* 160-byte string literal not displayed */
	Replace     bool                   `` /* 130-byte string literal not displayed */
}

Config drives a single POST to the TYSM hook-control API.

AuthToken is intentionally yaml-tagged with snake_case: it is expected to be supplied via the task's configVars (e.g. configVars: { auth_token: "tysmApiToken" }) so the secret never lives in the playbook source. Inline assignment under config: still works, it is just discouraged.

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