mock

package
v0.6.1 Latest Latest
Warning

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

Go to latest
Published: Jun 16, 2020 License: Apache-2.0, MIT Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CheckActorExports

func CheckActorExports(t *testing.T, act interface{ Exports() []interface{} })

Types

type ReturnWrapper

type ReturnWrapper struct {
	V runtime.CBORMarshaler
}

func (ReturnWrapper) Into

type Runtime

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

A mock runtime for unit testing of actors in isolation. The mock allows direct specification of the runtime context as observable by an actor, supports the storage interface, and mocks out side-effect-inducing calls.

func (*Runtime) AbortStateMsg

func (rt *Runtime) AbortStateMsg(msg string)

func (*Runtime) Abortf

func (rt *Runtime) Abortf(errExitCode exitcode.ExitCode, msg string, args ...interface{})

func (*Runtime) AddIDAddress

func (rt *Runtime) AddIDAddress(src addr.Address, target addr.Address)

func (*Runtime) AdtStore added in v0.5.1

func (rt *Runtime) AdtStore() adt.Store

func (*Runtime) Balance

func (rt *Runtime) Balance() abi.TokenAmount

func (*Runtime) BatchVerifySeals added in v0.5.4

func (rt *Runtime) BatchVerifySeals(vis map[address.Address][]abi.SealVerifyInfo) (map[address.Address][]bool, error)

func (*Runtime) BlockMiner

func (rt *Runtime) BlockMiner() addr.Address

func (*Runtime) Call

func (rt *Runtime) Call(method interface{}, params interface{}) interface{}

func (*Runtime) Caller

func (rt *Runtime) Caller() addr.Address

func (*Runtime) ComputeUnsealedSectorCID

func (rt *Runtime) ComputeUnsealedSectorCID(reg abi.RegisteredSealProof, pieces []abi.PieceInfo) (cid.Cid, error)

func (*Runtime) Context

func (rt *Runtime) Context() context.Context

func (*Runtime) Create

func (rt *Runtime) Create(obj runtime.CBORMarshaler)

func (*Runtime) CreateActor

func (rt *Runtime) CreateActor(codeId cid.Cid, address addr.Address)

func (*Runtime) CurrEpoch

func (rt *Runtime) CurrEpoch() abi.ChainEpoch

func (*Runtime) CurrentBalance

func (rt *Runtime) CurrentBalance() abi.TokenAmount

func (*Runtime) DeleteActor

func (rt *Runtime) DeleteActor(_ addr.Address)

func (*Runtime) Epoch

func (rt *Runtime) Epoch() abi.ChainEpoch

func (*Runtime) ExpectAbort

func (rt *Runtime) ExpectAbort(expected exitcode.ExitCode, f func())

Calls f() expecting it to invoke Runtime.Abortf() with a specified exit code.

func (*Runtime) ExpectAssertionFailure

func (rt *Runtime) ExpectAssertionFailure(expected string, f func())

func (*Runtime) ExpectCreateActor

func (rt *Runtime) ExpectCreateActor(codeId cid.Cid, address addr.Address)

func (*Runtime) ExpectGetRandomness

func (rt *Runtime) ExpectGetRandomness(tag crypto.DomainSeparationTag, epoch abi.ChainEpoch, entropy []byte, out abi.Randomness)

func (*Runtime) ExpectSend

func (rt *Runtime) ExpectSend(toAddr addr.Address, methodNum abi.MethodNum, params runtime.CBORMarshaler, value abi.TokenAmount, ret runtime.CBORMarshaler, exitCode exitcode.ExitCode)

func (*Runtime) ExpectValidateCallerAddr

func (rt *Runtime) ExpectValidateCallerAddr(addrs ...addr.Address)

func (*Runtime) ExpectValidateCallerAny

func (rt *Runtime) ExpectValidateCallerAny()

func (*Runtime) ExpectValidateCallerType

func (rt *Runtime) ExpectValidateCallerType(types ...cid.Cid)

func (*Runtime) ExpectVerifyPoSt added in v0.5.1

func (rt *Runtime) ExpectVerifyPoSt(post abi.WindowPoStVerifyInfo, result error)

func (*Runtime) ExpectVerifySeal added in v0.5.1

func (rt *Runtime) ExpectVerifySeal(seal abi.SealVerifyInfo, result error)

func (*Runtime) ExpectVerifySignature

func (rt *Runtime) ExpectVerifySignature(sig crypto.Signature, signer addr.Address, plaintext []byte, result error)

func (*Runtime) Get

func (rt *Runtime) Get(c cid.Cid, o runtime.CBORUnmarshaler) bool

func (*Runtime) GetActorCodeCID

func (rt *Runtime) GetActorCodeCID(addr addr.Address) (ret cid.Cid, ok bool)

func (*Runtime) GetRandomness

func (rt *Runtime) GetRandomness(tag crypto.DomainSeparationTag, epoch abi.ChainEpoch, entropy []byte) abi.Randomness

func (*Runtime) GetState

func (rt *Runtime) GetState(o runtime.CBORUnmarshaler)

func (*Runtime) HashBlake2b

func (rt *Runtime) HashBlake2b(data []byte) [32]byte

func (*Runtime) Message

func (rt *Runtime) Message() runtime.Message

func (*Runtime) NewActorAddress

func (rt *Runtime) NewActorAddress() addr.Address

func (*Runtime) Put

func (rt *Runtime) Put(o runtime.CBORMarshaler) cid.Cid

func (*Runtime) Readonly

func (rt *Runtime) Readonly(st runtime.CBORUnmarshaler)

func (*Runtime) Receiver

func (rt *Runtime) Receiver() addr.Address

func (*Runtime) Reset

func (rt *Runtime) Reset()

Resets expectations

func (*Runtime) ResolveAddress

func (rt *Runtime) ResolveAddress(address addr.Address) (ret addr.Address, ok bool)

func (*Runtime) Send

func (rt *Runtime) Send(toAddr addr.Address, methodNum abi.MethodNum, params runtime.CBORMarshaler, value abi.TokenAmount) (runtime.SendReturn, exitcode.ExitCode)

func (*Runtime) SetBalance

func (rt *Runtime) SetBalance(amt abi.TokenAmount)

func (*Runtime) SetCaller

func (rt *Runtime) SetCaller(address addr.Address, actorType cid.Cid)

func (*Runtime) SetEpoch

func (rt *Runtime) SetEpoch(epoch abi.ChainEpoch)

func (*Runtime) SetHasher

func (rt *Runtime) SetHasher(f func(data []byte) [32]byte)

func (*Runtime) SetNewActorAddress

func (rt *Runtime) SetNewActorAddress(actAddr addr.Address)

func (*Runtime) SetReceived

func (rt *Runtime) SetReceived(amt abi.TokenAmount)

func (*Runtime) StartSpan

func (rt *Runtime) StartSpan(_ string) runtime.TraceSpan

func (*Runtime) State

func (rt *Runtime) State() runtime.StateHandle

func (*Runtime) StateRoot

func (rt *Runtime) StateRoot() cid.Cid

func (*Runtime) Store

func (rt *Runtime) Store() runtime.Store

func (*Runtime) Syscalls

func (rt *Runtime) Syscalls() runtime.Syscalls

func (*Runtime) TotalFilCircSupply

func (rt *Runtime) TotalFilCircSupply() abi.TokenAmount

func (*Runtime) Transaction

func (rt *Runtime) Transaction(st runtime.CBORer, f func() interface{}) interface{}

func (*Runtime) ValidateImmediateCallerAcceptAny

func (rt *Runtime) ValidateImmediateCallerAcceptAny()

func (*Runtime) ValidateImmediateCallerIs

func (rt *Runtime) ValidateImmediateCallerIs(addrs ...addr.Address)

func (*Runtime) ValidateImmediateCallerType

func (rt *Runtime) ValidateImmediateCallerType(types ...cid.Cid)

func (*Runtime) ValueReceived

func (rt *Runtime) ValueReceived() abi.TokenAmount

func (*Runtime) Verify

func (rt *Runtime) Verify()

Verifies that expected calls were received, and resets all expectations.

func (*Runtime) VerifyConsensusFault

func (rt *Runtime) VerifyConsensusFault(h1, h2, extra []byte) (*runtime.ConsensusFault, error)

func (*Runtime) VerifyPoSt

func (rt *Runtime) VerifyPoSt(vi abi.WindowPoStVerifyInfo) error

func (*Runtime) VerifySeal

func (rt *Runtime) VerifySeal(seal abi.SealVerifyInfo) error

func (*Runtime) VerifySignature

func (rt *Runtime) VerifySignature(sig crypto.Signature, signer addr.Address, plaintext []byte) error

type RuntimeBuilder

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

Build for fluent initialization of a mock runtime.

func NewBuilder

func NewBuilder(ctx context.Context, receiver addr.Address) *RuntimeBuilder

Initializes a new builder with a receiving actor address.

func (*RuntimeBuilder) Build

func (b *RuntimeBuilder) Build(t testing.TB) *Runtime

Builds a new runtime object with the configured values.

func (*RuntimeBuilder) WithActorType

func (b *RuntimeBuilder) WithActorType(addr addr.Address, code cid.Cid) *RuntimeBuilder

func (*RuntimeBuilder) WithBalance

func (b *RuntimeBuilder) WithBalance(balance, received abi.TokenAmount) *RuntimeBuilder

func (*RuntimeBuilder) WithCaller

func (b *RuntimeBuilder) WithCaller(address addr.Address, code cid.Cid) *RuntimeBuilder

func (*RuntimeBuilder) WithEpoch

func (b *RuntimeBuilder) WithEpoch(epoch abi.ChainEpoch) *RuntimeBuilder

func (*RuntimeBuilder) WithHasher

func (b *RuntimeBuilder) WithHasher(f func(data []byte) [32]byte) *RuntimeBuilder

func (*RuntimeBuilder) WithMiner

func (b *RuntimeBuilder) WithMiner(miner addr.Address) *RuntimeBuilder

type TraceSpan

type TraceSpan struct {
}

func (TraceSpan) End

func (t TraceSpan) End()

Jump to

Keyboard shortcuts

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