systest

package
v1.13.0 Latest Latest
Warning

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

Go to latest
Published: Apr 1, 2025 License: MIT Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CheckForChainFork added in v1.13.0

func CheckForChainFork(ctx context.Context, chain system.L2Chain, logger log.Logger) (func() error, error)

CheckForChainFork checks that the L2 chain has not forked now, and returns a function that check again (to be called at the end of the test). An error is returned from this function (and the returned function) if a chain fork has been detected.

func InteropSystemTest

func InteropSystemTest(t BasicT, f InteropSystemTestFunc, validators ...PreconditionValidator)

InteropSystemTest delegates to the default helper

func SystemTest

func SystemTest(t BasicT, f SystemTestFunc, validators ...PreconditionValidator)

SystemTest delegates to the default helper

Types

type BasicT

type BasicT = testingTB

type HeaderProvider added in v1.13.0

type HeaderProvider interface {
	BlockByNumber(ctx context.Context, number *big.Int) (*types.Block, error)
	HeaderByNumber(ctx context.Context, number *big.Int) (*types.Header, error)
	HeaderByHash(ctx context.Context, hash common.Hash) (*types.Header, error)
	Close()
}

type InteropSystemTestFunc

type InteropSystemTestFunc func(t T, sys system.InteropSystem)

type MultiClient added in v1.13.0

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

MultiClient is a simple client that checks hash consistency between underlying clients

func NewMultiClient added in v1.13.0

func NewMultiClient(clients []HeaderProvider) *MultiClient

NewMultiClient creates a new MultiClient with the specified underlying clients

func (*MultiClient) BlockByNumber added in v1.13.0

func (mc *MultiClient) BlockByNumber(ctx context.Context, number *big.Int) (*types.Block, error)

BlockByNumber returns a block from the first client while verifying hash consistency

func (*MultiClient) Close added in v1.13.0

func (mc *MultiClient) Close()

Close closes all underlying client connections

func (*MultiClient) HeaderByNumber added in v1.13.0

func (mc *MultiClient) HeaderByNumber(ctx context.Context, number *big.Int) (*types.Header, error)

HeaderByNumber returns a header from the first client while verifying hash consistency

type PreconditionError

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

PreconditionError represents an error that occurs when a test precondition is not met

func (*PreconditionError) Error

func (e *PreconditionError) Error() string

func (*PreconditionError) Unwrap

func (e *PreconditionError) Unwrap() error

type PreconditionValidator

type PreconditionValidator func(t T, sys system.System) (context.Context, error)

type SystemAcquirer added in v1.11.1

type SystemAcquirer func(t BasicT) (system.System, error)

SystemAcquirer attempts to create a System instance. Returns (nil, nil) to indicate this acquirer should be skipped (e.g., when prerequisites are not met). Any other result indicates this acquirer was selected and its result (success or failure) should be used.

type SystemTestFunc

type SystemTestFunc func(t T, sys system.System)

type T

type T interface {
	Context() context.Context
	WithContext(ctx context.Context) T
	Deadline() (deadline time.Time, ok bool)
	Parallel()
	Run(string, func(t T))
	// contains filtered or unexported methods
}

func NewT

func NewT(t testingTB) T

Jump to

Keyboard shortcuts

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