chain

package
v0.5.0 Latest Latest
Warning

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

Go to latest
Published: Jul 21, 2026 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FormatTable

func FormatTable(res *Result) string

FormatTable renders the human-readable probe table.

func ToEvents

func ToEvents(runID, project string, res *Result, ts time.Time) []model.Event

ToEvents converts a chain result into model probe events.

Types

type Env

type Env struct {
	FromService      string
	ContainerID      string
	ContainerExists  bool
	ContainerRunning bool
	SharedNetwork    bool
	TargetHost       string
	TargetPort       int
	WantTLS          bool
	WantHTTP         bool
	HTTPPath         string
}

Env describes runtime facts needed before network probes.

type Exec

type Exec func(ctx context.Context, cmd []string) (output string, exitCode int, err error)

Exec runs a command in the probe network context.

type Method

type Method string

Method identifies how the probe was executed.

const (
	MethodNativeExec Method = "native_exec"
	MethodEphemeral  Method = "ephemeral"
)

Probe execution methods.

type Result

type Result struct {
	FromService string
	TargetHost  string
	TargetPort  int
	Method      Method
	Steps       []Step
	HardFailAt  string
}

Result is the full dependency probe chain outcome.

type Runner

type Runner struct {
	// NativeExec runs inside the dependent container (Option A).
	NativeExec Exec
	// EphemeralExec runs from a same-network probe container (Option B).
	EphemeralExec Exec
	// HasTool reports whether a binary exists in the native context.
	// If nil, tools are assumed present when NativeExec is set.
	HasTool func(ctx context.Context, bin string) bool
	Now     func() time.Time
}

Runner orchestrates the dependency probe chain.

func (*Runner) Run

func (r *Runner) Run(ctx context.Context, env Env) *Result

Run executes the 10-step chain, short-circuiting on the first hard FAIL after recording that step. Soft SKIP/WARN do not stop the chain.

type Status

type Status string

Status is the outcome of one chain step.

const (
	StatusPass Status = "PASS"
	StatusFail Status = "FAIL"
	StatusSkip Status = "SKIP"
	StatusWarn Status = "WARN"
)

Step statuses.

type Step

type Step struct {
	Name     string
	Status   Status
	Detail   string
	Duration time.Duration
}

Step is one recorded probe-chain check.

Jump to

Keyboard shortcuts

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