itest

package
v2.0.0-rc8 Latest Latest
Warning

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

Go to latest
Published: May 16, 2024 License: Apache-2.0, MIT Imports: 36 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func LoadUnixFSFile

func LoadUnixFSFile(ctx context.Context, t *testing.T, dagService ipldformat.DAGService, fileName string) (ipld.Link, []byte)

LoadUnixFSFile loads a fixtures file into the given DAG Service, returning an ipld.Link for the file and the original file bytes

func VerifyHasFile

func VerifyHasFile(ctx context.Context, t *testing.T, dagService ipldformat.DAGService, link ipld.Link, fileBytes []byte)

VerifyHasFile verifies the presence of the given file with the given ipld.Link and file contents (fileBytes) exists in the given blockstore identified by dagService

Types

type GraphsyncTestingData

type GraphsyncTestingData struct {
	Ctx         context.Context
	Mn          mocknet.Mocknet
	DtDs1       datastore.Batching
	DtDs2       datastore.Batching
	Bs1         bstore.Blockstore
	Bs2         bstore.Blockstore
	DagService1 ipldformat.DAGService
	DagService2 ipldformat.DAGService
	LinkSystem1 ipld.LinkSystem
	LinkSystem2 ipld.LinkSystem
	Host1       host.Host
	Host2       host.Host
	GsNet1      gsnet.GraphSyncNetwork
	GsNet2      gsnet.GraphSyncNetwork
	DtNet1      network.DataTransferNetwork
	DtNet2      network.DataTransferNetwork
	Gs1         graphsync.GraphExchange
	Gs2         graphsync.GraphExchange
	OrigBytes   []byte
	TempDir1    string
	TempDir2    string
	// contains filtered or unexported fields
}

GraphsyncTestingData is a test harness for testing data transfer on top of graphsync

func NewGraphsyncTestingData

func NewGraphsyncTestingData(ctx context.Context, t *testing.T, host1Protocols []protocol.ID, host2Protocols []protocol.ID) *GraphsyncTestingData

NewGraphsyncTestingData returns a new GraphsyncTestingData instance

func (*GraphsyncTestingData) LoadUnixFSFile

func (gsData *GraphsyncTestingData) LoadUnixFSFile(t *testing.T, useSecondNode bool) ipld.Link

LoadUnixFSFile loads a fixtures file we can test dag transfer with

func (*GraphsyncTestingData) SetupGSTransportHost1

func (gsData *GraphsyncTestingData) SetupGSTransportHost1(opts ...gstransport.Option) datatransfer.Transport

SetupGSTransportHost1 sets up a new grapshync transport over real graphsync on the first host

func (*GraphsyncTestingData) SetupGSTransportHost2

func (gsData *GraphsyncTestingData) SetupGSTransportHost2(opts ...gstransport.Option) datatransfer.Transport

SetupGSTransportHost2 sets up a new grapshync transport over real graphsync on the second host

func (*GraphsyncTestingData) SetupGraphsyncHost1

func (gsData *GraphsyncTestingData) SetupGraphsyncHost1() graphsync.GraphExchange

SetupGraphsyncHost1 sets up a new, real graphsync instance on top of the first host

func (*GraphsyncTestingData) SetupGraphsyncHost2

func (gsData *GraphsyncTestingData) SetupGraphsyncHost2() graphsync.GraphExchange

SetupGraphsyncHost2 sets up a new, real graphsync instance on top of the second host

func (*GraphsyncTestingData) VerifyFileTransferred

func (gsData *GraphsyncTestingData) VerifyFileTransferred(t *testing.T, link ipld.Link, useSecondNode bool)

VerifyFileTransferred verifies all of the file was transfer to the given node

Jump to

Keyboard shortcuts

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