testutil

package
v0.34.0-crescendo-prev... Latest Latest
Warning

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

Go to latest
Published: Apr 25, 2024 License: AGPL-3.0 Imports: 102 Imported by: 3

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CollectionNode

func CollectionNode(t *testing.T, hub *stub.Hub, identity bootstrap.NodeInfo, rootSnapshot protocol.Snapshot) testmock.CollectionNode

CollectionNode returns a mock collection node.

func CompleteStateFixture added in v0.14.0

func CompleteStateFixture(
	t testing.TB,
	log zerolog.Logger,
	metric *metrics.NoopCollector,
	tracer module.Tracer,
	rootSnapshot protocol.Snapshot,
) *testmock.StateFixture

CompleteStateFixture is a test helper that creates, bootstraps, and returns a StateFixture for sake of unit testing.

func ConsensusNode

func ConsensusNode(t *testing.T, hub *stub.Hub, identity bootstrap.NodeInfo, identities []*flow.Identity, chainID flow.ChainID) testmock.ConsensusNode

func ExecutionNode

func ExecutionNode(t *testing.T, hub *stub.Hub, identity bootstrap.NodeInfo, identities []*flow.Identity, syncThreshold int, chainID flow.ChainID) testmock.ExecutionNode

func GenericNode

func GenericNode(
	t testing.TB,
	hub *stub.Hub,
	identity bootstrap.NodeInfo,
	root protocol.Snapshot,
) testmock.GenericNode

GenericNode returns a generic test node, containing components shared across all node roles. The generic node is used as the core data structure to create other types of flow nodes.

func GenericNodeFromParticipants added in v0.20.0

func GenericNodeFromParticipants(t testing.TB, hub *stub.Hub, identity bootstrap.NodeInfo, participants []*flow.Identity, chainID flow.ChainID,
	options ...func(protocol.State)) testmock.GenericNode

GenericNodeFromParticipants is a test helper that creates and returns a generic node. The generic node's state is generated from the given participants, resulting in a root state snapshot.

CAUTION: Please use GenericNode instead for most use-cases so that multiple nodes may share the same root state snapshot.

func GenericNodeWithStateFixture added in v0.14.0

func GenericNodeWithStateFixture(t testing.TB,
	stateFixture *testmock.StateFixture,
	hub *stub.Hub,
	bootstrapInfo bootstrap.NodeInfo,
	log zerolog.Logger,
	metrics *metrics.NoopCollector,
	tracer module.Tracer,
	chainID flow.ChainID) testmock.GenericNode

GenericNodeWithStateFixture is a test helper that creates a generic node with specified state fixture.

func VerificationNode

func VerificationNode(t testing.TB,
	hub *stub.Hub,
	verIdentity bootstrap.NodeInfo,
	participants flow.IdentityList,
	assigner module.ChunkAssigner,
	chunksLimit uint,
	chainID flow.ChainID,
	collector module.VerificationMetrics,
	mempoolCollector module.MempoolMetrics,
	opts ...VerificationOpt) testmock.VerificationNode

VerificationNode creates a verification node with all functional engines and actual modules for purpose of (integration) testing.

Types

type CheckerMock added in v0.14.4

type CheckerMock struct {
	notifications.NoopConsumer // satisfy the FinalizationConsumer interface
}

type RoundRobinLeaderSelection added in v0.10.0

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

func (*RoundRobinLeaderSelection) DKG added in v0.10.0

func (*RoundRobinLeaderSelection) IdentitiesByBlock added in v0.29.0

func (s *RoundRobinLeaderSelection) IdentitiesByBlock(_ flow.Identifier) (flow.IdentityList, error)

func (*RoundRobinLeaderSelection) IdentitiesByEpoch added in v0.29.0

func (s *RoundRobinLeaderSelection) IdentitiesByEpoch(view uint64) (flow.IdentitySkeletonList, error)

func (*RoundRobinLeaderSelection) IdentityByBlock added in v0.29.0

func (s *RoundRobinLeaderSelection) IdentityByBlock(_ flow.Identifier, participantID flow.Identifier) (*flow.Identity, error)

func (*RoundRobinLeaderSelection) IdentityByEpoch added in v0.29.0

func (s *RoundRobinLeaderSelection) IdentityByEpoch(view uint64, participantID flow.Identifier) (*flow.IdentitySkeleton, error)

func (*RoundRobinLeaderSelection) LeaderForView added in v0.10.0

func (s *RoundRobinLeaderSelection) LeaderForView(view uint64) (flow.Identifier, error)

func (*RoundRobinLeaderSelection) QuorumThresholdForView added in v0.29.0

func (s *RoundRobinLeaderSelection) QuorumThresholdForView(_ uint64) (uint64, error)

func (*RoundRobinLeaderSelection) Self added in v0.10.0

func (*RoundRobinLeaderSelection) TimeoutThresholdForView added in v0.29.0

func (s *RoundRobinLeaderSelection) TimeoutThresholdForView(_ uint64) (uint64, error)

type VerificationOpt

type VerificationOpt func(*testmock.VerificationNode)

func WithChunkConsumer added in v0.17.0

func WithChunkConsumer(chunkConsumer *chunkconsumer.ChunkConsumer) VerificationOpt

func WithGenericNode added in v0.14.0

func WithGenericNode(genericNode *testmock.GenericNode) VerificationOpt

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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