test

package
v0.5.33 Latest Latest
Warning

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

Go to latest
Published: Sep 11, 2024 License: Apache-2.0 Imports: 25 Imported by: 0

Documentation

Overview

Package test implements universal helpers for unit and integration tests

Index

Constants

View Source
const IsRace = false

Variables

This section is empty.

Functions

func BackendTest

func BackendTest(u *url.URL, n int)

TestBackend creates n peers with separate connections to the signaling backend u and exchanges a test message between each pair of backends

func BeRandom

func BeRandom() types.GomegaMatcher

func Entropy

func Entropy(data []byte) float64

func GenerateKeyPairs

func GenerateKeyPairs() (*crypto.KeyPair, *crypto.KeyPair, error)

func GenerateSignalingMessage

func GenerateSignalingMessage() *signaling.Message

func HaveEntropy

func HaveEntropy(minEntropy float64) types.GomegaMatcher

func IsCI

func IsCI() bool

func ParallelNew

func ParallelNew[T any](cnt int, ctor func(i int) (T, error)) ([]T, error)

func ReceiveEvent

func ReceiveEvent[E any](e *E) types.GomegaMatcher

func SetupLogging

func SetupLogging() *log.Logger

func SetupLoggingWithFile

func SetupLoggingWithFile(fn string, truncate bool) (*log.Logger, error)

func WithProgress

func WithProgress(ctx context.Context, run func(started, completed chan string) error, handler ProgressHandler) error

Types

type DefaultProgressHandler

type DefaultProgressHandler struct {
	Logger *log.Logger
}

func (*DefaultProgressHandler) OnEnd

func (ph *DefaultProgressHandler) OnEnd(cntCompleted, cntFailed uint, durElapsed time.Duration)

func (*DefaultProgressHandler) OnError

func (ph *DefaultProgressHandler) OnError(err error)

func (*DefaultProgressHandler) OnProgress

func (ph *DefaultProgressHandler) OnProgress(cntStarted, cntCompleted, cntFailed uint, durElapsed, durRemaining time.Duration, idsMissing []string)

func (*DefaultProgressHandler) OnStart

func (ph *DefaultProgressHandler) OnStart()

type ProgressHandler

type ProgressHandler interface {
	OnStart()
	OnEnd(cntCompleted, cntFailed uint, durElapsed time.Duration)
	OnProgress(cntStarted, cntCompleted, cntFailed uint, durElapsed, durRemaining time.Duration, idsMissing []string)
	OnError(err error)
}

Directories

Path Synopsis
e2e

Jump to

Keyboard shortcuts

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