testcluster

package
v0.13.0 Latest Latest
Warning

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

Go to latest
Published: Oct 11, 2026 License: MIT Imports: 19 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 testcluster builds the cluster the tool tests look at.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Fixture

type Fixture struct {
	C        *grpcproctest.Cluster
	Sup      grpcproc.PID // a supervisor with children "w1" and "w2"
	Stuck    grpcproc.PID // "stuck": busy in a handler, 3 messages waiting
	Talker   grpcproc.PID // "talker": publishes state=ready through WithInspect, holds the global name "room:talker"
	Echo     grpcproc.PID // "echo" on node "b"
	Release  func()       // unblocks "stuck"
	Resolver grpcproc.Resolver
}

Fixture is what Start leaves running on node "a".

func Start

func Start(t *testing.T, more ...string) *Fixture

Start runs nodes a and b (and any others named) with Inspectors that forward to each other, and links a to b. Node a backs off from a peer whose dials fail (Config.DialBackoff), so a test can show it a down link, and says version=1.0 in its metadata. A node named "nonames" has no global names, and one named "unlisted" has names it cannot list. With a node named "quiet", which nothing links to, a's Membership reports every node up, and "ghost", which is not running.

func (*Fixture) Cron added in v0.1.0

func (f *Fixture) Cron(t *testing.T, node, name string) grpcproc.PID

Cron starts a grpcproc/cron process registered as name on node, with jobs that do not come due while a test runs: "yearly", "leap" (February 29) and "paused", disabled.

func (*Fixture) Elect added in v0.1.0

func (f *Fixture) Elect(t *testing.T, cluster string, nodes ...string)

Elect runs a grpcproc/leader election called cluster among nodes, which are its voters, with short timeouts and an idle singleton, and waits until one of them leads.

func (*Fixture) Groups added in v0.13.0

func (f *Fixture) Groups(t *testing.T)

Groups runs the grpcproc/groups scope "default" on nodes a and b, each asking the other and node "c", which runs none, and the scope "rooms" on a alone. The talker is in "chat"; the echo in "chat" and "echo". On a, a process "broken" is labelled as a scope and answers no queries. Groups waits until a's copy has b's members.

func (*Fixture) Leading added in v0.1.0

func (f *Fixture) Leading(t *testing.T, cluster, node string, ok func(string) bool) string

Leading waits until node's elector for cluster names a leader ok accepts, and returns it.

func (*Fixture) Saga added in v0.10.0

func (f *Fixture) Saga(t *testing.T, node, name string) *saga.Engine

Saga runs a grpcproc/saga engine on node, for a saga called name, from a store of its own with three runs no engine works on: 1 waits; 2 is stuck, with two signals it keeps, one of an event the saga does not accept; 3 is done, with data too large to show.

func (*Fixture) SagaHidingData added in v0.10.0

func (f *Fixture) SagaHidingData(t *testing.T, node, name string) *saga.Engine

SagaHidingData is Saga with an engine that shows no run's data.

Jump to

Keyboard shortcuts

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