testutil

package
v0.0.0-...-f76b1da Latest Latest
Warning

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

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

Documentation

Overview

Package testutil includes convenience functions and types to help with testing

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GzipIt

func GzipIt(input []byte) ([]byte, error)

GzipIt compresses the input ([]byte)

func ModifyTomlConfigFile

func ModifyTomlConfigFile(
	ctx context.Context,
	logger *zap.Logger,
	dockerClient *client.Client,
	testName string,
	volumeName string,
	filePath string,
	modifications Toml,
) error

ModifyTomlConfigFile reads, modifies, then overwrites a toml config file, useful for config.toml, app.toml, etc.

func WaitForBlocks

func WaitForBlocks(ctx context.Context, delta int, chains ...ChainHeighter) error

WaitForBlocks blocks until all chains reach a block height delta equal to or greater than the delta argument. If a ChainHeighter does not monotonically increase the height, this function may block program execution indefinitely.

func WaitForCondition

func WaitForCondition(timeoutAfter, pollingInterval time.Duration, fn func() (bool, error)) error

WaitForCondition periodically executes the given function fn based on the provided pollingInterval. The function fn should return true of the desired condition is met. If the function never returns true within the timeoutAfter period, or fn returns an error, the condition will not have been met.

func WaitForInSync

func WaitForInSync(ctx context.Context, chain ChainHeighter, nodes ...ChainHeighter) error

WaitForInSync blocks until all nodes have heights greater than or equal to the chain height.

Types

type ChainHeighter

type ChainHeighter interface {
	Height(ctx context.Context) (uint64, error)
}

ChainHeighter fetches the current chain block height.

type Toml

type Toml map[string]any

Toml is used for holding the decoded state of a toml config file.

Jump to

Keyboard shortcuts

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