testutil

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Jan 11, 2022 License: BSD-3-Clause Imports: 52 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Connect

func Connect(tn1, tn2 *TestNode) error

func CreateRandomBlock

func CreateRandomBlock(t testing.TB, bs blockstore.Blockstore) *blocks.BasicBlock

func FormatMsgLookup

func FormatMsgLookup(t *testing.T, chAddr address.Address) *filecoin.MsgLookup

func ThisDir

func ThisDir(t testing.TB) string

Types

type BytesGetter

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

func (*BytesGetter) Bytes

func (bg *BytesGetter) Bytes() []byte

func (*BytesGetter) UnmarshalCBOR

func (bg *BytesGetter) UnmarshalCBOR(r io.Reader) error

type FakeDTType

type FakeDTType struct {
	Data string
}

FakeDTType simple fake type for using with registries

func (*FakeDTType) MarshalCBOR

func (t *FakeDTType) MarshalCBOR(w io.Writer) error

func (FakeDTType) Type

Type satisfies registry.Entry

func (*FakeDTType) UnmarshalCBOR

func (t *FakeDTType) UnmarshalCBOR(r io.Reader) error

type FakeDTValidator

type FakeDTValidator struct{}

func (*FakeDTValidator) ValidatePull

func (v *FakeDTValidator) ValidatePull(isRestart bool, chid datatransfer.ChannelID, receiver peer.ID, voucher datatransfer.Voucher, baseCid cid.Cid, selector ipld.Node) (datatransfer.VoucherResult, error)

func (*FakeDTValidator) ValidatePush

func (v *FakeDTValidator) ValidatePush(isRestart bool, chid datatransfer.ChannelID, sender peer.ID, voucher datatransfer.Voucher, baseCid cid.Cid, selector ipld.Node) (datatransfer.VoucherResult, error)

type TestNode

type TestNode struct {
	Ds        datastore.Batching
	Bs        blockstore.Blockstore
	DAG       ipldformat.DAGService
	Host      host.Host
	LinkSys   ipld.LinkSystem
	Gs        graphsync.GraphExchange
	DTNet     dtnet.DataTransferNetwork
	DTStore   datastore.Batching
	DTTmpDir  string
	Dt        datatransfer.Manager
	Ms        *multistore.MultiStore
	OrigBytes []byte
}

func NewTestNode

func NewTestNode(mn mocknet.Mocknet, t testing.TB, opts ...func(tn *TestNode)) *TestNode

func (*TestNode) CreateRandomFile

func (tn *TestNode) CreateRandomFile(t testing.TB, size int) string

func (*TestNode) LoadFileToNewStore

func (tn *TestNode) LoadFileToNewStore(ctx context.Context, t testing.TB, dirPath string) (ipld.Link, multistore.StoreID, []byte)

func (*TestNode) LoadFileToStore

func (tn *TestNode) LoadFileToStore(ctx context.Context, t testing.TB, store *multistore.Store, path string) (ipld.Link, []byte)

func (*TestNode) NukeBlockstore

func (tn *TestNode) NukeBlockstore(ctx context.Context, t testing.TB)

func (*TestNode) SetupDataTransfer

func (tn *TestNode) SetupDataTransfer(ctx context.Context, t testing.TB)

func (*TestNode) SetupGraphSync

func (tn *TestNode) SetupGraphSync(ctx context.Context)

func (*TestNode) ThisDir

func (tn *TestNode) ThisDir(t testing.TB, p string) string

func (*TestNode) VerifyFileTransferred

func (tn *TestNode) VerifyFileTransferred(ctx context.Context, t testing.TB, dag ipldformat.DAGService, link cid.Cid, origBytes []byte)

Jump to

Keyboard shortcuts

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