testutil

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Feb 3, 2023 License: Apache-2.0, MIT Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func VerifyCollectedEvent

func VerifyCollectedEvent(t *testing.T, actual types.RetrievalEvent, expected types.RetrievalEvent)

func VerifyCollectedEventTimings

func VerifyCollectedEventTimings(t *testing.T, events []types.RetrievalEvent)

func VerifyContainsCollectedEvent

func VerifyContainsCollectedEvent(t *testing.T, actualList []types.RetrievalEvent, expected types.RetrievalEvent)

Types

type CollectingEventsListener

type CollectingEventsListener struct {
	CollectedEvents []types.RetrievalEvent
	// contains filtered or unexported fields
}

func NewCollectingEventsListener

func NewCollectingEventsListener() *CollectingEventsListener

func (*CollectingEventsListener) Collect

func (el *CollectingEventsListener) Collect(event types.RetrievalEvent)

type DelayedQueryReturn

type DelayedQueryReturn struct {
	QueryResponse *retrievalmarket.QueryResponse
	Err           error
	Delay         time.Duration
}

type DelayedRetrievalReturn

type DelayedRetrievalReturn struct {
	ResultStats *types.RetrievalStats
	ResultErr   error
	Delay       time.Duration
}

type MockCandidateFinder

type MockCandidateFinder struct {
	Error      error
	Candidates map[cid.Cid][]types.RetrievalCandidate
}

func (*MockCandidateFinder) FindCandidates

func (me *MockCandidateFinder) FindCandidates(ctx context.Context, cid cid.Cid) ([]types.RetrievalCandidate, error)

type MockClient

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

func NewMockClient

func NewMockClient(queryReturns map[string]DelayedQueryReturn, retrievalReturns map[string]DelayedRetrievalReturn) *MockClient

func (*MockClient) GetQueryReturns

func (mc *MockClient) GetQueryReturns() map[string]DelayedQueryReturn

func (*MockClient) GetReceivedLinkSystems

func (mc *MockClient) GetReceivedLinkSystems() []ipld.LinkSystem

func (*MockClient) GetReceivedQueries

func (mc *MockClient) GetReceivedQueries() []peer.ID

func (*MockClient) GetReceivedRetrievals

func (mc *MockClient) GetReceivedRetrievals() []peer.ID

func (*MockClient) GetRetrievalReturns

func (mc *MockClient) GetRetrievalReturns() map[string]DelayedRetrievalReturn

func (*MockClient) RetrievalQueryToPeer

func (mc *MockClient) RetrievalQueryToPeer(
	ctx context.Context,
	minerPeer peer.AddrInfo,
	pcid cid.Cid,
	onConnected func(),
) (*retrievalmarket.QueryResponse, error)

func (*MockClient) RetrieveFromPeer

func (mc *MockClient) RetrieveFromPeer(
	ctx context.Context,
	linkSystem ipld.LinkSystem,
	peerID peer.ID,
	minerWallet address.Address,
	proposal *retrievalmarket.DealProposal,
	eventsCallback datatransfer.Subscriber,
	gracefulShutdownRequested <-chan struct{},
) (*types.RetrievalStats, error)

func (*MockClient) SetQueryReturns

func (mc *MockClient) SetQueryReturns(queryReturns map[string]DelayedQueryReturn)

func (*MockClient) SetRetrievalReturns

func (mc *MockClient) SetRetrievalReturns(retrievalReturns map[string]DelayedRetrievalReturn)

Jump to

Keyboard shortcuts

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