brokertest

package
v2.0.201+incompatible Latest Latest
Warning

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

Go to latest
Published: Feb 13, 2019 License: MIT Imports: 10 Imported by: 0

Documentation

Overview

Package brokertest provides utilities for testing components requiring a live Gazette broker.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CreateJournals

func CreateJournals(c *gc.C, bk *Broker, specs ...*pb.JournalSpec)

CreateJournals using the Broker Apply API, and wait for them to be allocated.

func Journal

func Journal(spec pb.JournalSpec) *pb.JournalSpec

Journal returns |spec| after applying reasonable test defaults for fields which are not already set.

Types

type Broker

type Broker struct {
	// contains filtered or unexported fields
}

Broker is a lightweight, embedded Gazette broker suitable for testing client functionality which depends on the availability of the Gazette service.

func NewBroker

func NewBroker(c *gc.C, etcd *clientv3.Client, zone, suffix string) *Broker

NewBroker builds and returns an in-process Broker identified by |zone| and |suffix|.

func (*Broker) AllocateIdleCh

func (b *Broker) AllocateIdleCh() <-chan struct{}

AllocateIdleCh signals when the Broker's Allocate loop took an action, such as updating a journal assignment, and has since become idle. Tests must explicitly receive (and confirm as intended) signals sent on Allocator actions, or Broker will panic.

func (*Broker) Client

func (b *Broker) Client() pb.JournalClient

Client of the test Broker.

func (*Broker) Endpoint

func (b *Broker) Endpoint() pb.Endpoint

Endpoint of the test Broker.

func (*Broker) RevokeLease

func (b *Broker) RevokeLease(c *gc.C)

RevokeLease of the Broker, allowing its Allocate loop to immediately exit.

func (*Broker) WaitForExit

func (b *Broker) WaitForExit()

WaitForExit of the test Broker Allocate loop, and complete its teardown. WaitForExit will block indefinitely if the Broker's Journal limit is not also zeroed (and another Broker takes over), or its lease revoked.

func (*Broker) ZeroJournalLimit

func (b *Broker) ZeroJournalLimit(c *gc.C)

ZeroJournalLimit of the Broker. The test Broker will eventually exit, assuming other Broker(s) are available to take over the assignments.

Jump to

Keyboard shortcuts

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