tmintegration

package
v0.0.0-...-506a26f Latest Latest
Warning

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

Go to latest
Published: Nov 2, 2024 License: Apache-2.0 Imports: 29 Imported by: 0

Documentation

Overview

Package tmintegration defines integration tests around consensus engines, using user-specified network and store definitions.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func RunIntegrationTest

func RunIntegrationTest(t *testing.T, nf NewFactoryFunc)

Types

type Env

type Env struct {
	// The RootLogger can be reference when the Factory
	// needs a logger in a created value.
	RootLogger *slog.Logger
	// contains filtered or unexported fields
}

Env contains some of the primitives of the current test environment, to inform the creation of a Factory.

func (*Env) Cleanup

func (e *Env) Cleanup(fn func())

Cleanup calls fn when the test is complete, regardless of whether the test passed or failed.

func (*Env) TempDir

func (e *Env) TempDir() string

TempDir returns the path to a new temporary directory, in case the factory needs a place to write data to disk.

type Factory

type Factory interface {
	// NewNetwork will be called only once per test.
	// The implementer may assume that the context will be canceled
	// at or before the test's completion.
	NewNetwork(context.Context, *slog.Logger) (tmp2ptest.Network, error)

	NewActionStore(context.Context, int) (tmstore.ActionStore, error)
	NewCommittedHeaderStore(context.Context, int) (tmstore.CommittedHeaderStore, error)
	NewFinalizationStore(context.Context, int) (tmstore.FinalizationStore, error)
	NewMirrorStore(context.Context, int) (tmstore.MirrorStore, error)
	NewRoundStore(context.Context, int) (tmstore.RoundStore, error)
	NewStateMachineStore(context.Context, int) (tmstore.StateMachineStore, error)
	NewValidatorStore(context.Context, int, tmconsensus.HashScheme) (tmstore.ValidatorStore, error)

	HashScheme(context.Context, int) (tmconsensus.HashScheme, error)
	SignatureScheme(context.Context, int) (tmconsensus.SignatureScheme, error)
	CommonMessageSignatureProofScheme(context.Context, int) (gcrypto.CommonMessageSignatureProofScheme, error)

	NewGossipStrategy(context.Context, int, tmp2p.Connection) (tmgossip.Strategy, error)
}

type InmemSchemeFactory

type InmemSchemeFactory struct{}

func (InmemSchemeFactory) CommonMessageSignatureProofScheme

func (f InmemSchemeFactory) CommonMessageSignatureProofScheme(ctx context.Context, idx int) (gcrypto.CommonMessageSignatureProofScheme, error)

func (InmemSchemeFactory) HashScheme

func (f InmemSchemeFactory) HashScheme(ctx context.Context, idx int) (tmconsensus.HashScheme, error)

func (InmemSchemeFactory) SignatureScheme

func (f InmemSchemeFactory) SignatureScheme(ctx context.Context, idx int) (tmconsensus.SignatureScheme, error)

type InmemStoreFactory

type InmemStoreFactory struct{}

InmemStoreFactory is meant to be embedded in another tmintegration.Factory to provide in-memory implementations of stores.

func (InmemStoreFactory) NewActionStore

func (f InmemStoreFactory) NewActionStore(ctx context.Context, idx int) (tmstore.ActionStore, error)

func (InmemStoreFactory) NewCommittedHeaderStore

func (f InmemStoreFactory) NewCommittedHeaderStore(ctx context.Context, idx int) (tmstore.CommittedHeaderStore, error)

func (InmemStoreFactory) NewFinalizationStore

func (f InmemStoreFactory) NewFinalizationStore(ctx context.Context, idx int) (tmstore.FinalizationStore, error)

func (InmemStoreFactory) NewMirrorStore

func (f InmemStoreFactory) NewMirrorStore(ctx context.Context, idx int) (tmstore.MirrorStore, error)

func (InmemStoreFactory) NewRoundStore

func (f InmemStoreFactory) NewRoundStore(ctx context.Context, idx int) (tmstore.RoundStore, error)

func (InmemStoreFactory) NewStateMachineStore

func (f InmemStoreFactory) NewStateMachineStore(ctx context.Context, idx int) (tmstore.StateMachineStore, error)

func (InmemStoreFactory) NewValidatorStore

func (f InmemStoreFactory) NewValidatorStore(ctx context.Context, idx int, hs tmconsensus.HashScheme) (tmstore.ValidatorStore, error)

type NewFactoryFunc

type NewFactoryFunc func(e *Env) Factory

Jump to

Keyboard shortcuts

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