testcluster

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Sep 30, 2026 License: MIT Imports: 12 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
	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.

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) 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.

Jump to

Keyboard shortcuts

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