enginetest

package
v1.14.2 Latest Latest
Warning

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

Go to latest
Published: Aug 2, 2025 License: BSD-3-Clause Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AppError

type AppError struct {
	Code    int32
	Message string
}

AppError represents an application error

type Sender

type Sender struct {
	T *testing.T

	CantSendGetStateSummaryFrontier, CantSendStateSummaryFrontier,
	CantSendGetAcceptedStateSummary, CantSendAcceptedStateSummary,
	CantSendGetAcceptedFrontier, CantSendAcceptedFrontier,
	CantSendGetAccepted, CantSendAccepted,
	CantSendGet, CantSendGetAncestors, CantSendPut, CantSendAncestors,
	CantSendPullQuery, CantSendPushQuery, CantSendChits,
	CantSendAppRequest, CantSendAppResponse, CantSendAppError,
	CantSendAppGossip bool

	SendGetStateSummaryFrontierF func(context.Context, set.Set[ids.NodeID], uint32)
	SendStateSummaryFrontierF    func(context.Context, ids.NodeID, uint32, []byte)
	SendGetAcceptedStateSummaryF func(context.Context, set.Set[ids.NodeID], uint32, []uint64)
	SendAcceptedStateSummaryF    func(context.Context, ids.NodeID, uint32, []ids.ID)
	SendGetAcceptedFrontierF     func(context.Context, set.Set[ids.NodeID], uint32)
	SendAcceptedFrontierF        func(context.Context, ids.NodeID, uint32, ids.ID)
	SendGetAcceptedF             func(context.Context, set.Set[ids.NodeID], uint32, []ids.ID)
	SendAcceptedF                func(context.Context, ids.NodeID, uint32, []ids.ID)
	SendGetF                     func(context.Context, ids.NodeID, uint32, ids.ID)
	SendGetAncestorsF            func(context.Context, ids.NodeID, uint32, ids.ID)
	SendPutF                     func(context.Context, ids.NodeID, uint32, []byte)
	SendAncestorsF               func(context.Context, ids.NodeID, uint32, [][]byte)
	SendPushQueryF               func(context.Context, set.Set[ids.NodeID], uint32, []byte, uint64)
	SendPullQueryF               func(context.Context, set.Set[ids.NodeID], uint32, ids.ID, uint64)
	SendChitsF                   func(context.Context, ids.NodeID, uint32, ids.ID, ids.ID, ids.ID, uint64)
	SendAppRequestF              func(context.Context, set.Set[ids.NodeID], uint32, []byte) error
	SendAppResponseF             func(context.Context, ids.NodeID, uint32, []byte) error
	SendAppErrorF                func(context.Context, ids.NodeID, uint32, int32, string) error
	SendAppGossipF               func(context.Context, core.SendConfig, []byte) error
}

Sender is a test sender

func (*Sender) Default

func (s *Sender) Default(cant bool)

Default set the default callable value to [cant]

func (*Sender) SendAccepted

func (s *Sender) SendAccepted(ctx context.Context, validatorID ids.NodeID, requestID uint32, containerIDs []ids.ID)

SendAccepted calls SendAcceptedF if it was initialized. If it wasn't initialized and this function shouldn't be called and testing was initialized, then testing will fail.

func (*Sender) SendAcceptedFrontier

func (s *Sender) SendAcceptedFrontier(ctx context.Context, validatorID ids.NodeID, requestID uint32, containerID ids.ID)

SendAcceptedFrontier calls SendAcceptedFrontierF if it was initialized. If it wasn't initialized and this function shouldn't be called and testing was initialized, then testing will fail.

func (*Sender) SendAcceptedStateSummary

func (s *Sender) SendAcceptedStateSummary(ctx context.Context, validatorID ids.NodeID, requestID uint32, summaryIDs []ids.ID)

SendAcceptedStateSummary calls SendAcceptedStateSummaryF if it was initialized. If it wasn't initialized and this function shouldn't be called and testing was initialized, then testing will fail.

func (*Sender) SendAncestors

func (s *Sender) SendAncestors(ctx context.Context, validatorID ids.NodeID, requestID uint32, containers [][]byte)

SendAncestors calls SendAncestorsF if it was initialized. If it wasn't initialized and this function shouldn't be called and testing was initialized, then testing will fail.

func (*Sender) SendAppError

func (s *Sender) SendAppError(ctx context.Context, nodeID ids.NodeID, requestID uint32, code int32, message string) error

SendAppError calls SendAppErrorF if it was initialized. If it wasn't initialized and this function shouldn't be called and testing was initialized, then testing will fail.

func (*Sender) SendAppGossip

func (s *Sender) SendAppGossip(ctx context.Context, config core.SendConfig, appGossipBytes []byte) error

SendAppGossip calls SendAppGossipF if it was initialized. If it wasn't initialized and this function shouldn't be called and testing was initialized, then testing will fail.

func (*Sender) SendAppRequest

func (s *Sender) SendAppRequest(ctx context.Context, validatorIDs set.Set[ids.NodeID], requestID uint32, appRequestBytes []byte) error

SendAppRequest calls SendAppRequestF if it was initialized. If it wasn't initialized and this function shouldn't be called and testing was initialized, then testing will fail.

func (*Sender) SendAppResponse

func (s *Sender) SendAppResponse(ctx context.Context, nodeID ids.NodeID, requestID uint32, appResponseBytes []byte) error

SendAppResponse calls SendAppResponseF if it was initialized. If it wasn't initialized and this function shouldn't be called and testing was initialized, then testing will fail.

func (*Sender) SendChits

func (s *Sender) SendChits(ctx context.Context, validatorID ids.NodeID, requestID uint32, preferredID ids.ID, preferredIDAtHeight ids.ID, acceptedID ids.ID, acceptedHeight uint64)

SendChits calls SendChitsF if it was initialized. If it wasn't initialized and this function shouldn't be called and testing was initialized, then testing will fail.

func (*Sender) SendGet

func (s *Sender) SendGet(ctx context.Context, validatorID ids.NodeID, requestID uint32, containerID ids.ID)

SendGet calls SendGetF if it was initialized. If it wasn't initialized and this function shouldn't be called and testing was initialized, then testing will fail.

func (*Sender) SendGetAccepted

func (s *Sender) SendGetAccepted(ctx context.Context, validatorIDs set.Set[ids.NodeID], requestID uint32, containerIDs []ids.ID)

SendGetAccepted calls SendGetAcceptedF if it was initialized. If it wasn't initialized and this function shouldn't be called and testing was initialized, then testing will fail.

func (*Sender) SendGetAcceptedFrontier

func (s *Sender) SendGetAcceptedFrontier(ctx context.Context, validatorIDs set.Set[ids.NodeID], requestID uint32)

SendGetAcceptedFrontier calls SendGetAcceptedFrontierF if it was initialized. If it wasn't initialized and this function shouldn't be called and testing was initialized, then testing will fail.

func (*Sender) SendGetAcceptedStateSummary

func (s *Sender) SendGetAcceptedStateSummary(ctx context.Context, validatorIDs set.Set[ids.NodeID], requestID uint32, heights []uint64)

SendGetAcceptedStateSummary calls SendGetAcceptedStateSummaryF if it was initialized. If it wasn't initialized and this function shouldn't be called and testing was initialized, then testing will fail.

func (*Sender) SendGetAncestors

func (s *Sender) SendGetAncestors(ctx context.Context, validatorID ids.NodeID, requestID uint32, containerID ids.ID)

SendGetAncestors calls SendGetAncestorsF if it was initialized. If it wasn't initialized and this function shouldn't be called and testing was initialized, then testing will fail.

func (*Sender) SendGetStateSummaryFrontier

func (s *Sender) SendGetStateSummaryFrontier(ctx context.Context, validatorIDs set.Set[ids.NodeID], requestID uint32)

SendGetStateSummaryFrontier calls SendGetStateSummaryFrontierF if it was initialized. If it wasn't initialized and this function shouldn't be called and testing was initialized, then testing will fail.

func (*Sender) SendPullQuery

func (s *Sender) SendPullQuery(ctx context.Context, validatorIDs set.Set[ids.NodeID], requestID uint32, containerID ids.ID, requestedHeight uint64)

SendPullQuery calls SendPullQueryF if it was initialized. If it wasn't initialized and this function shouldn't be called and testing was initialized, then testing will fail.

func (*Sender) SendPushQuery

func (s *Sender) SendPushQuery(ctx context.Context, validatorIDs set.Set[ids.NodeID], requestID uint32, container []byte, requestedHeight uint64)

SendPushQuery calls SendPushQueryF if it was initialized. If it wasn't initialized and this function shouldn't be called and testing was initialized, then testing will fail.

func (*Sender) SendPut

func (s *Sender) SendPut(ctx context.Context, validatorID ids.NodeID, requestID uint32, container []byte)

SendPut calls SendPutF if it was initialized. If it wasn't initialized and this function shouldn't be called and testing was initialized, then testing will fail.

func (*Sender) SendStateSummaryFrontier

func (s *Sender) SendStateSummaryFrontier(ctx context.Context, validatorID ids.NodeID, requestID uint32, summary []byte)

SendStateSummaryFrontier calls SendStateSummaryFrontierF if it was initialized. If it wasn't initialized and this function shouldn't be called and testing was initialized, then testing will fail.

type SenderStub

type SenderStub struct {
	SentAppRequest  chan []byte
	SentAppResponse chan []byte
	SentAppGossip   chan []byte
	SentAppError    chan *AppError
}

SenderStub is a stub implementation of the core.AppSender interface for testing

func NewSenderStub

func NewSenderStub() *SenderStub

NewSenderStub creates a new SenderStub

func (*SenderStub) SendAppError

func (s *SenderStub) SendAppError(ctx context.Context, nodeID ids.NodeID, requestID uint32, code int32, message string) error

func (*SenderStub) SendAppGossip

func (s *SenderStub) SendAppGossip(ctx context.Context, appGossipBytes []byte) error

func (*SenderStub) SendAppRequest

func (s *SenderStub) SendAppRequest(ctx context.Context, nodeIDs []ids.NodeID, requestID uint32, appRequestBytes []byte) error

func (*SenderStub) SendAppResponse

func (s *SenderStub) SendAppResponse(ctx context.Context, nodeID ids.NodeID, requestID uint32, appResponseBytes []byte) error

func (*SenderStub) SendCrossChainAppRequest

func (s *SenderStub) SendCrossChainAppRequest(ctx context.Context, chainID ids.ID, requestID uint32, msg []byte) error

func (*SenderStub) SendCrossChainAppResponse

func (s *SenderStub) SendCrossChainAppResponse(ctx context.Context, chainID ids.ID, requestID uint32, msg []byte) error

Jump to

Keyboard shortcuts

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