testutil

package
v0.49.1 Latest Latest
Warning

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

Go to latest
Published: Oct 15, 2025 License: GPL-3.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Nodes added in v0.49.1

func Nodes(n int) []netmap.NodeInfo

Nodes returns n netmap.NodeInfo elements with unique public keys.

Each node has two network addresses with localhost IP. Ports are sequential starting from 10000.

func RandByteSlice

func RandByteSlice[I constraints.Integer](ln I) []byte

RandByteSlice returns randomized byte slice of specified length.

Types

type LogBuffer added in v0.49.1

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

LogBuffer is a memory buffer for zap.Logger entries.

func NewBufferedLogger added in v0.49.1

func NewBufferedLogger(t testing.TB, minLevel zapcore.Level) (*zap.Logger, *LogBuffer)

NewBufferedLogger returns buffered logger for testing.

Entries with severity less than minLevel are never written.

func (*LogBuffer) AssertContains added in v0.49.1

func (x *LogBuffer) AssertContains(e LogEntry)

AssertContains asserts that log contains at least one entry with given message.

func (*LogBuffer) AssertEmpty added in v0.49.1

func (x *LogBuffer) AssertEmpty()

AssertEmpty asserts that log is empty.

func (*LogBuffer) AssertEqual added in v0.49.1

func (x *LogBuffer) AssertEqual(es []LogEntry)

AssertEqual asserts that log consists of given ordered entries.

func (*LogBuffer) AssertSingle added in v0.49.1

func (x *LogBuffer) AssertSingle(e LogEntry)

AssertSingle asserts that log has given entry only.

type LogEntry added in v0.49.1

type LogEntry struct {
	Level   zapcore.Level
	Message string
	// Integer values are represented as [json.Number].
	Fields map[string]any
}

LogEntry represents single zap.Logger entry.

Jump to

Keyboard shortcuts

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