utils

package
v0.9.0 Latest Latest
Warning

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

Go to latest
Published: Mar 1, 2024 License: LGPL-3.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// MODE is the value for the environnent variable MODE.
	MODE = os.Getenv("MODE")

	// PORT is the value for the environnent variable PORT.
	PORT = os.Getenv("PORT")

	// LOGLEVEL is the value for the environnent variable LOGLEVEL.
	LOGLEVEL = os.Getenv("LOG")
)
View Source
var Logger = log.NewFromGlobal(log.AddContext("pkg", "test/utils"))

Logger is the utils package local logger.

Functions

func BuildGossamer added in v0.7.0

func BuildGossamer() (err error)

BuildGossamer finds the project root path and builds the Gossamer binary to ./bin/gossamer at the project root path.

func GenerateGenesisAuths added in v0.7.0

func GenerateGenesisAuths(t *testing.T, numAuths int) (genesisPath string)

GenerateGenesisAuths generates a genesis file with numAuths authorities and returns the file path to the genesis file. The genesis file is automatically removed when the test ends.

func NewTestWriter added in v0.7.0

func NewTestWriter(t *testing.T) (writer io.Writer)

NewTestWriter creates a new writer which uses the Go test logger to write out.

Types

type Framework added in v0.2.0

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

Framework struct to hold references to framework data

func InitFramework added in v0.2.0

func InitFramework(ctx context.Context, t *testing.T, qtyNodes int,
	tomlConfig cfg.Config) (*Framework, error)

InitFramework creates given quantity of nodes

func NewFramework added in v0.7.0

func NewFramework() (framework *Framework)

NewFramework creates a new framework.

func (*Framework) CallRPC added in v0.2.0

func (fw *Framework) CallRPC(ctx context.Context, idx int, method, params string) (
	respJSON interface{}, err error)

CallRPC call RPC method with given params for node at idx

func (*Framework) CheckEqual added in v0.2.0

func (fw *Framework) CheckEqual(c1, c2 int, field string) bool

CheckEqual returns true if the field values are equal

func (*Framework) GetRecord added in v0.2.0

func (fw *Framework) GetRecord(callIdx int) interface{}

GetRecord return value of record for node and call index

func (*Framework) PrintDB added in v0.2.0

func (fw *Framework) PrintDB()

PrintDB prints all records for given node

func (*Framework) StartNodes added in v0.2.0

func (fw *Framework) StartNodes(ctx context.Context, t *testing.T) (
	runtimeErrors []<-chan error, startErr error)

StartNodes calls RestartGossamer for all nodes

type TestWriter added in v0.7.0

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

TestWriter is a writer implementing `io.Writer` using the Go test logger `t.Log()`.

func (*TestWriter) Write added in v0.7.0

func (tw *TestWriter) 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