checkclientsarehealthy

package
v0.1.1 Latest Latest
Warning

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

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

README

check_clients_are_healthy Task

Description

The check_clients_are_healthy task is designed to ensure the health of specified clients. It verifies if the clients are reachable and synchronized on the same network.

Task Behavior
  • The task polls clients at regular intervals to check their health status.
  • By default, the task returns immediately when the health criteria are met.
  • Use continueOnPass: true to keep monitoring even after success (useful for continuous health monitoring).

Configuration Parameters

  • clientPattern:
    A regular expression pattern used to specify which clients to check. This allows for targeted health checks of specific clients or groups of clients within the network. A blank pattern targets all clients.

  • pollInterval:
    The interval at which the health check is performed. Set this to define how frequently the task should check the clients' health. Default: 5s.

  • skipConsensusCheck:
    A boolean value that, when set to true, skips the health check for consensus clients. Useful if you only want to focus on execution clients. Default: false.

  • skipExecutionCheck:
    A boolean value that, when set to true, skips the health check for execution clients. Use this to exclusively check the health of consensus clients. Default: false.

  • expectUnhealthy:
    A boolean value that inverts the expected result of the health check. When true, the task succeeds if the clients are not ready or unhealthy. This can be useful in test scenarios where client unavailability is expected or being tested. Default: false.

  • minClientCount:
    The minimum number of clients that must match the clientPattern and pass the health checks for the task to succeed. A value of 0 indicates that all matching clients need to pass the health check. Default: 0.

  • maxUnhealthyCount:
    Specifies the maximum number of unhealthy clients allowed before the health check fails. A value of -1 means unlimited unhealthy clients are allowed. A value of 0 means that any unhealthy client will cause the health check to fail. Default: -1.

  • failOnCheckMiss:
    Determines the task's behavior when a health check fails. If true, the task reports a failure upon the first unsuccessful health check. If false, the task continues to poll the clients until a successful check occurs. Default: false.

  • continueOnPass:
    If set to true, the task continues monitoring client health even after the criteria are met. This is useful for continuous health monitoring during long-running tests. If false (default), the task exits immediately on success.

Defaults

These are the default settings for the check_clients_are_healthy task:

- name: check_clients_are_healthy
  config:
    clientPattern: ""
    pollInterval: 5s
    skipConsensusCheck: false
    skipExecutionCheck: false
    expectUnhealthy: false
    minClientCount: 0
    maxUnhealthyCount: -1
    failOnCheckMiss: false
    continueOnPass: false

Outputs

This task does not produce any outputs.

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	TaskName       = "check_clients_are_healthy"
	TaskDescriptor = &types.TaskDescriptor{
		Name:        TaskName,
		Description: "Checks if clients are healthy.",
		Category:    "utility",
		Config:      DefaultConfig(),
		Outputs: []types.TaskOutputDefinition{
			{
				Name:        "goodClients",
				Type:        "array",
				Description: "Array of healthy client info objects.",
			},
			{
				Name:        "failedClients",
				Type:        "array",
				Description: "Array of unhealthy client info objects.",
			},
			{
				Name:        "totalCount",
				Type:        "int",
				Description: "Total number of clients checked.",
			},
			{
				Name:        "failedCount",
				Type:        "int",
				Description: "Number of clients that failed health check.",
			},
			{
				Name:        "goodCount",
				Type:        "int",
				Description: "Number of clients that passed health check.",
			},
		},
		NewTask: NewTask,
	}
)

Functions

func NewTask

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

Types

type ClientInfo

type ClientInfo struct {
	Name     string `json:"name"`
	ClRPCURL string `json:"clRpcUrl"`
	ElRPCURL string `json:"elRpcUrl"`
}

type Config

type Config struct {
	ClientPattern         string          `yaml:"clientPattern" json:"clientPattern" desc:"Regex pattern to select specific client endpoints for health checking."`
	PollInterval          helper.Duration `yaml:"pollInterval" json:"pollInterval" desc:"Interval between health check polls (e.g., '5s', '1m')."`
	SkipConsensusCheck    bool            `yaml:"skipConsensusCheck" json:"skipConsensusCheck" desc:"If true, skip consensus client health checks."`
	SkipExecutionCheck    bool            `yaml:"skipExecutionCheck" json:"skipExecutionCheck" desc:"If true, skip execution client health checks."`
	ExpectUnhealthy       bool            `yaml:"expectUnhealthy" json:"expectUnhealthy" desc:"If true, expect clients to be unhealthy (inverts success condition)."`
	MinClientCount        int             `yaml:"minClientCount" json:"minClientCount" desc:"Minimum number of healthy clients required."`
	MaxUnhealthyCount     int             `yaml:"maxUnhealthyCount" json:"maxUnhealthyCount" desc:"Maximum number of unhealthy clients allowed (-1 for unlimited)."`
	FailOnCheckMiss       bool            `yaml:"failOnCheckMiss" json:"failOnCheckMiss" desc:"If true, fail the task when health check condition is not met."`
	ExecutionRPCResultVar string          `yaml:"executionRpcResultVar" json:"executionRpcResultVar" deprecated:"true" desc:"Deprecated: Use task outputs instead."`
	ConsensusRPCResultVar string          `yaml:"consensusRpcResultVar" json:"consensusRpcResultVar" deprecated:"true" desc:"Deprecated: Use task outputs instead."`
	ContinueOnPass        bool            `` /* 137-byte string literal not displayed */
}

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