Documentation
¶
Overview ¶
Package testcluster builds the cluster the tool tests look at.
Index ¶
- type Fixture
- func (f *Fixture) Cron(t *testing.T, node, name string) grpcproc.PID
- func (f *Fixture) Elect(t *testing.T, cluster string, nodes ...string)
- func (f *Fixture) Groups(t *testing.T)
- func (f *Fixture) Leading(t *testing.T, cluster, node string, ok func(string) bool) string
- func (f *Fixture) Saga(t *testing.T, node, name string) *saga.Engine
- func (f *Fixture) SagaHidingData(t *testing.T, node, name string) *saga.Engine
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 ¶
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. A node named "uninspected" serves no Inspector.
func (*Fixture) Cron ¶ added in v0.1.0
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
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
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
Leading waits until node's elector for cluster names a leader ok accepts, and returns it.