tests

package
v0.6.0-rc2 Latest Latest
Warning

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

Go to latest
Published: Sep 15, 2020 License: MIT Imports: 20 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ClientConfigMA

func ClientConfigMA(t *testing.T) (ma.Multiaddr, string)

ClientConfigMA returns the prepared multiaddress and Lotus token, to connect to a Lotus node.

func CreateLocalDevnet

func CreateLocalDevnet(t TestingTWithCleanup, numMiners int) (lotus.ClientBuilder, address.Address, []address.Address)

CreateLocalDevnet returns an API client that targets a local devnet with numMiners number of miners. Refer to http://github.com/textileio/local-devnet for more information.

func CreateLocalDevnetWithIPFS

func CreateLocalDevnetWithIPFS(t TestingTWithCleanup, numMiners int, ipfsMaddr string, mountVolumes bool) (lotus.ClientBuilder, address.Address, []address.Address)

CreateLocalDevnetWithIPFS creates a local devnet connected to an IPFS node.

func GetLotusToken

func GetLotusToken(lotusFolderPath string) (string, error)

GetLotusToken returns the lotus token from a Lotus repo path.

func LaunchDevnetDocker

func LaunchDevnetDocker(t TestingTWithCleanup, numMiners int, ipfsMaddr string, mountVolumes bool) *dockertest.Resource

LaunchDevnetDocker launches the devnet docker image.

func LaunchIPFSDocker

func LaunchIPFSDocker(t require.TestingT) (*dockertest.Resource, func())

LaunchIPFSDocker runs a fresh go-ipfs docker image and returns the resource for container metadata.

func NewSimpleTx

func NewSimpleTx(ds datastore.Datastore) datastore.Txn

NewSimpleTx creates a transaction.

func RunFlaky added in v0.4.0

func RunFlaky(t *testing.T, f func(ft *FlakyT))

RunFlaky runs a flaky test with retries.

Types

type FlakyT added in v0.4.0

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

FlakyT provides retry mechanisms to test.

func NewFlakyT added in v0.4.0

func NewFlakyT(t *testing.T) *FlakyT

NewFlakyT creates a new FlakyT.

func (*FlakyT) Cleanup added in v0.4.0

func (ft *FlakyT) Cleanup(cls func())

Cleanup registers a cleanup function.

func (*FlakyT) Errorf added in v0.4.0

func (ft *FlakyT) Errorf(format string, args ...interface{})

Errorf registers an error message.

func (*FlakyT) FailNow added in v0.4.0

func (ft *FlakyT) FailNow()

FailNow indicates to fail the test.

type SimpleTx

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

SimpleTx implements the transaction interface for datastores who do not have any sort of underlying transactional support.

func (*SimpleTx) Commit

func (bt *SimpleTx) Commit() error

Commit confirms changes done in the transaction.

func (*SimpleTx) Delete

func (bt *SimpleTx) Delete(key datastore.Key) error

Delete deletes a key.

func (*SimpleTx) Discard

func (bt *SimpleTx) Discard()

Discard cancels the changes done in the transaction.

func (*SimpleTx) Get

func (bt *SimpleTx) Get(k datastore.Key) ([]byte, error)

Get returns a key value within the transaction.

func (*SimpleTx) GetSize

func (bt *SimpleTx) GetSize(k datastore.Key) (int, error)

GetSize returns the size of the key value.

func (*SimpleTx) Has

func (bt *SimpleTx) Has(k datastore.Key) (bool, error)

Has returns true if the key exist, false otherwise.

func (*SimpleTx) Put

func (bt *SimpleTx) Put(key datastore.Key, val []byte) error

Put sets the value for a key.

func (*SimpleTx) Query

func (bt *SimpleTx) Query(q query.Query) (query.Results, error)

Query executes a query within the transaction scope.

type TestingTWithCleanup added in v0.4.0

type TestingTWithCleanup interface {
	require.TestingT
	Cleanup(func())
}

TestingTWithCleanup is an augmented require.TestingT with a Cleanup function.

type TxMapDatastore

type TxMapDatastore struct {
	*datastore.MapDatastore
	// contains filtered or unexported fields
}

TxMapDatastore is a in-memory datastore that satisfies TxnDatastore.

func NewTxMapDatastore

func NewTxMapDatastore() *TxMapDatastore

NewTxMapDatastore returns a new TxMapDatastore.

func (*TxMapDatastore) Clone

func (d *TxMapDatastore) Clone() (*TxMapDatastore, error)

Clone returns a cloned datastore.

func (*TxMapDatastore) Delete

func (d *TxMapDatastore) Delete(key datastore.Key) error

Delete deletes a key.

func (*TxMapDatastore) Get

func (d *TxMapDatastore) Get(key datastore.Key) ([]byte, error)

Get returns the value for a key.

func (*TxMapDatastore) NewTransaction

func (d *TxMapDatastore) NewTransaction(readOnly bool) (datastore.Txn, error)

NewTransaction creates a transaction A read-only transaction should be indicated with readOnly equal true.

func (*TxMapDatastore) Put

func (d *TxMapDatastore) Put(key datastore.Key, data []byte) error

Put sets the value of a key.

func (*TxMapDatastore) Query

func (d *TxMapDatastore) Query(q query.Query) (query.Results, error)

Query executes a query in the datastore.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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