migtest

package
v0.14.2-beta.rc3 Latest Latest
Warning

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

Go to latest
Published: Jun 22, 2022 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ApplyMigration

func ApplyMigration(t *testing.T,
	beforeMigration, afterMigration, migrationFunc func(tx kvdb.RwTx) error,
	shouldFail bool)

ApplyMigration is a helper test function that encapsulates the general steps which are needed to properly check the result of applying migration function.

func DumpDB

func DumpDB(tx kvdb.RTx, rootKey []byte) error

DumpDB dumps go code describing the contents of the database to stdout. This function is only intended for use during development.

Example output:

map[string]interface{}{
	hex("1234"): map[string]interface{}{
		"human-readable": hex("102030"),
		hex("1111"): hex("5783492373"),
	},
}

func Hex

func Hex(value string) string

Hex is a test helper function to convert readable hex arrays to raw byte strings.

func MakeDB

func MakeDB() (kvdb.Backend, func(), error)

MakeDB creates a new instance of the ChannelDB for testing purposes. A callback which cleans up the created temporary directories is also returned and intended to be executed after the test completes.

func RestoreDB

func RestoreDB(tx kvdb.RwTx, rootKey []byte, data map[string]interface{}) error

RestoreDB primes the database with the given data set.

func VerifyDB

func VerifyDB(tx kvdb.RTx, rootKey []byte, data map[string]interface{}) error

VerifyDB verifies the database against the given data set.

Types

This section is empty.

Jump to

Keyboard shortcuts

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