killpoint

package
v0.11.1 Latest Latest
Warning

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

Go to latest
Published: Nov 12, 2026 License: Apache-2.0 Imports: 5 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package killpoint holds the migration FSMs' three test-only seams.

The kill point lets a live resume test deterministically simulate an abrupt kcp exit (a Ctrl-C, lost network, power loss) at a chosen point: it cancels the run context right after a named checkpoint and the run returns, leaving the world an exit at that point would leave. A real Ctrl-C ends the process wherever it is (kcp installs no signal handler); the kill point makes the stopping point exact.

The failure hook makes a named workflow step fail instead of running, so a live test can drive a step failure (and the rollback it triggers) deterministically. The step fails through the same handling a real failure of that step takes.

The hold point pauses the run right after a named checkpoint until a release file appears, so a live test can change the world mid-run (edit the Gateway CR, say) and then let the run carry on. The run signals it is holding by creating "<file>.held"; the test creates "<file>" to release it.

All three are inert unless their environment variable is set, so they never fire in production. Each env var is a per-invocation switch the e2e harness sets on the kcp process under test; a normal run never sets them.

Index

Constants

View Source
const AfterPromoteAccepted = "promote_accepted"

AfterPromoteAccepted is an intra-step checkpoint (not an FSM state name): it fires inside the promote loop right after a promote request is accepted (error_code 0) but before the mirror is confirmed STOPPED, leaving mirrors in PENDING_STOPPED — the state a resume must handle without re-promoting.

View Source
const EnvVar = "KCP_TEST_CANCEL_AFTER"

EnvVar names the checkpoint after which the run should cancel itself. When unset (the production default) the seam is inert. The value is a checkpoint token — for the FSM-boundary checkpoints, an FSM state name such as "fenced" or "promoted".

View Source
const FailEnvVar = "KCP_TEST_FAIL_AT"

FailEnvVar names the workflow step (an FSM event such as "verify_fence") the failure hook fails. When unset (the production default) the hook is inert.

View Source
const HoldEnvVar = "KCP_TEST_HOLD_AFTER"

HoldEnvVar names the checkpoint (an FSM state name) after which the run holds. When unset (the production default) the hold point is inert.

View Source
const HoldFileEnvVar = "KCP_TEST_HOLD_FILE"

HoldFileEnvVar names the release file the hold waits for. The run creates "<file>.held" on reaching the hold; the test creates "<file>" to release it.

Variables

This section is empty.

Functions

func FailAt

func FailAt(step string) error

FailAt returns an error when FailEnvVar names step, and nil otherwise. The FSMs call it as each step starts; a non-nil error fails the step in place of its action.

func HoldAfter added in v0.11.1

func HoldAfter(ctx context.Context, checkpoint string) error

HoldAfter holds the run at checkpoint when HoldEnvVar names it: it creates "<file>.held", then polls until "<file>" exists (nil) or ctx ends (ctx.Err()). It errors when HoldFileEnvVar is unset or "<file>.held" cannot be created, and is a no-op (nil, no I/O) when HoldEnvVar is unset or names another checkpoint.

func ShouldCancelAfter

func ShouldCancelAfter(checkpoint string) bool

ShouldCancelAfter reports whether the run should cancel itself now that the given checkpoint has been reached. It is true only when EnvVar is set to exactly this checkpoint; unset or any other value is false.

Types

This section is empty.

Jump to

Keyboard shortcuts

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