test

package
v0.14.1 Latest Latest
Warning

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

Go to latest
Published: Jun 17, 2018 License: MIT Imports: 11 Imported by: 0

Documentation

Overview

Package test contains helpers for setting up test utilties.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewBenchOutput added in v0.7.2

func NewBenchOutput(
	period time.Duration,
	log log.Modular,
	stats metrics.Type,
) output.Type

NewBenchOutput creates a new BenchOutput output type.

func StartPrintingBenchmarks

func StartPrintingBenchmarks(period time.Duration) chan<- Bench

StartPrintingBenchmarks starts a goroutine that will periodically print any statistics/benchmarks that are accumulated through messages. You must provide the messages via the write channel returned by the function.

Types

type Bench

type Bench struct {
	Latency int    // Time taken (ns) for a message to be received by a consumer
	NBytes  int    // Number of bytes carried in the message
	Index   uint64 // The index carried by a message, can be used to detect loss
}

Bench is a struct carrying message specific benchmarking statistics.

func BenchFromMessage

func BenchFromMessage(msg types.Message) (Bench, error)

BenchFromMessage returns the benchmarking stats from a message received.

type BenchOutput added in v0.7.2

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

BenchOutput is an output type that prints benchmark information to stdout.

func (*BenchOutput) CloseAsync added in v0.7.2

func (o *BenchOutput) CloseAsync()

CloseAsync shuts down the File output and stops processing messages.

func (*BenchOutput) StartReceiving added in v0.7.2

func (o *BenchOutput) StartReceiving(ts <-chan types.Transaction) error

StartReceiving assigns a messages channel for the output to read.

func (*BenchOutput) WaitForClose added in v0.7.2

func (o *BenchOutput) WaitForClose(timeout time.Duration) error

WaitForClose blocks until the File output has closed down.

Jump to

Keyboard shortcuts

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