testutil

package
v0.9.2 Latest Latest
Warning

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

Go to latest
Published: Nov 21, 2022 License: Apache-2.0, MIT Imports: 28 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ContextWithTimeout added in v0.9.1

func ContextWithTimeout(t *testing.T) context.Context

func CopyDir added in v0.9.0

func CopyDir(t *testing.T, src string, dst string)

CopyDir copies a whole directory recursively

func CopyFile added in v0.9.0

func CopyFile(t *testing.T, src, dst string)

CopyFile copies a single file from src to dst

func GenerateKeysAndIdentity added in v0.9.1

func GenerateKeysAndIdentity(t *testing.T) (crypto.PrivKey, crypto.PubKey, peer.ID)

func GetBstoreLen

func GetBstoreLen(ctx context.Context, t *testing.T, bs RoBlockstore) int

GetBstoreLen gets the total CID cound in a blockstore

func MultiAddsToString added in v0.9.1

func MultiAddsToString(addrs []multiaddr.Multiaddr) []string

func NewID added in v0.9.0

func NewID(t *testing.T) peer.ID

func OpenSampleCar

func OpenSampleCar(t *testing.T, carFileName string) *blockstore.ReadOnly

OpenSampleCar opens a car file in the testdata directory to a blockstore

func RandomCids added in v0.2.0

func RandomCids(t testing.TB, rng *rand.Rand, n int) []cid.Cid

func RandomMultihashes added in v0.2.0

func RandomMultihashes(t testing.TB, rng *rand.Rand, n int) []multihash.Multihash

func SetupDataTransferOnHost

func SetupDataTransferOnHost(t *testing.T, h host.Host, store datastore.Batching, lsys ipld.LinkSystem) datatransfer.Manager

SetupDataTransferOnHost generates a data transfer instance for the given libp2p host

func ThisDir

func ThisDir(t *testing.T) string

ThisDir gets the current directory of the source file its called in

func WaitForAddrs added in v0.9.1

func WaitForAddrs(h host.Host) peer.AddrInfo

Sometimes the peerstore is not populated immediately. This is resolved by a delay and retry.

Types

type RoBlockstore

type RoBlockstore interface {
	AllKeysChan(ctx context.Context) (<-chan cid.Cid, error)
}

RoBlockstore is just the needed interface for GetBstoreLen

Jump to

Keyboard shortcuts

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