hooktest

package
v1.4.2 Latest Latest
Warning

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

Go to latest
Published: Oct 15, 2026 License: MIT Imports: 8 Imported by: 0

Documentation

Overview

Package hooktest is the test rig of the hook record: a hook.Store over a miniredis reached through net.Pipe, so no TCP connection is made (the cleanup fails a test whose fake took one), on a clock that moves only when a test moves it. Every tool that gates on the hook tests its gate on it.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Rig

type Rig struct {
	MR     *miniredis.Miniredis
	Client *redis.Client // the one client, for a tool that opens the bus store itself
	Store  hook.Store
	// contains filtered or unexported fields
}

Rig is one fake store and the hook.Store over it.

func New

func New(t testing.TB) *Rig

New is a rig whose clock reads start, closed at the test's end.

func (*Rig) Evidence

func (r *Rig) Evidence(t testing.TB, name string)

Evidence is what a heartbeat gives a name now: a server row (written only where none is), and the name's answer to its challenge, so the gate's evidence rule (hook.Served.Down) holds for a test that is not about the heartbeat.

func (*Rig) Hook

func (r *Rig) Hook(t testing.TB, name string, role hook.Role)

Hook hooks name in as role, as nova-hook hook does (the identity's word: after an unhook, or over another role), with every push of the role live and proven, as its holders would after their first beat.

func (*Rig) Pass

func (r *Rig) Pass(d time.Duration)

Pass moves the fake's clock by d: the TTLs and TIME together.

func (*Rig) State

func (r *Rig) State(t testing.TB, name string) hook.Status

State is name's status now.

func (*Rig) Unhook

func (r *Rig) Unhook(t testing.TB, name string)

Unhook unhooks name.

Jump to

Keyboard shortcuts

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