common

package
v0.0.0-...-dbb920a Latest Latest
Warning

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

Go to latest
Published: Dec 11, 2023 License: ISC Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DefaultAppDir = util.AppDir("stability-tests", false)

DefaultAppDir is the default app directory to be used by all tests

Functions

func DisableLog

func DisableLog()

DisableLog disables all library log output. Logging output is disabled by default until UseLogger is called.

func InitBackend

func InitBackend(backendLog *logger.Backend, logFile, errLogFile string)

InitBackend initializes the test log backend

func NetworkCliArgumentFromNetParams

func NetworkCliArgumentFromNetParams(params *dagconfig.Params) string

NetworkCliArgumentFromNetParams returns the kaspad command line argument that starts the given network.

func RunKaspadForTesting

func RunKaspadForTesting(t *testing.T, testName string, rpcAddress string) func()

RunKaspadForTesting runs kaspad for testing purposes

func ScanFile

func ScanFile(filePath string) <-chan []byte

ScanFile opens the file in the specified path, and returns a channel that sends the contents of the file line-by-line, ignoring lines beggining with //

func ScanHexFile

func ScanHexFile(filePath string) <-chan []byte

ScanHexFile opens the file in the specified path, and returns a channel that sends the contents of the file line-by-line, ignoring lines beggining with //, parsing the hex data in all other lines

func StartCmd

func StartCmd(name string, args ...string) (*exec.Cmd, error)

StartCmd runs a command as a separate process. The `name` parameter is used for logs. The command executable should be in args[0]

func TempDir

func TempDir(pattern string) (string, error)

TempDir returns a temporary directory with the given pattern, prefixed with STABILITY_TEMP_DIR_

func UseLogger

func UseLogger(backend *logger.Backend, level logger.Level)

UseLogger uses a specified Logger to output package logging info.

Types

type LogWriter

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

LogWriter writes to the given log with the given log level and prefix

func NewLogWriter

func NewLogWriter(log *logger.Logger, level logger.Level, prefix string) LogWriter

NewLogWriter returns a new LogWriter that forwards to `log` all data written to it using at `level` level

func (LogWriter) Write

func (clw LogWriter) Write(p []byte) (n int, err error)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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