testing

package
v0.5.1-debug Latest Latest
Warning

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

Go to latest
Published: Apr 9, 2022 License: MIT Imports: 43 Imported by: 0

Documentation

Index

Constants

View Source
const LogConsole = true

Variables

View Source
var DefaultLogLevels = config.LogLevel{}.
	Parse(config.DefaultLogLevels).
	SetModule("test-router", "debug").
	String()
View Source
var FakeBvn = MustParseUrl("acc://bvn0")

Functions

func AcmeLiteAddress

func AcmeLiteAddress(pubKey []byte) *url.URL

AcmeLiteAddress creates an ACME lite address for the given key. FOR TESTING USE ONLY.

func AcmeLiteAddressStdPriv

func AcmeLiteAddressStdPriv(key ed25519.PrivateKey) *url.URL

func AcmeLiteAddressTmPriv

func AcmeLiteAddressTmPriv(key tmcrypto.PrivKey) *url.URL

func AddCredits

func AddCredits(db DB, account *url.URL, credits float64) error

func BuildTestTokenTxGenTx

func BuildTestTokenTxGenTx(sponsor ed25519.PrivateKey, destAddr string, amount uint64) (*protocol.Envelope, error)

func CreateADI

func CreateADI(db DB, key tmed25519.PrivKey, urlStr types.String) error

func CreateAdiWithCredits

func CreateAdiWithCredits(db DB, key tmed25519.PrivKey, urlStr types.String, credits float64) error

func CreateKeyBook

func CreateKeyBook(db DB, urlStr types.String, publicKey ...tmed25519.PubKey) error

func CreateKeyPage

func CreateKeyPage(db DB, bookUrlStr types.String, keys ...tmed25519.PubKey) error

func CreateLiteTokenAccount

func CreateLiteTokenAccount(db DB, key tmed25519.PrivKey, tokens float64) error

func CreateLiteTokenAccountWithCredits

func CreateLiteTokenAccountWithCredits(db DB, key tmed25519.PrivKey, tokens, credits float64) error

func CreateSubADI added in v0.5.1

func CreateSubADI(db DB, originUrlStr types.String, urlStr types.String) error

func CreateTestNet

func CreateTestNet(t *testing.T, numBvns, numValidators, numFollowers int) ([]string, map[string][]*accumulated.Daemon)

func CreateTokenAccount

func CreateTokenAccount(db DB, accUrl, tokenUrl string, tokens float64, lite bool) error

func CreateTokenIssuer

func CreateTokenIssuer(db DB, urlStr, symbol string, precision uint64, supplyLimit *big.Int) error

func DefaultConfig

func DefaultConfig(net config.NetworkType, node config.NodeType, netId string) *config.Config

func GenerateKey

func GenerateKey(seed ...interface{}) ed25519.PrivateKey

func GenerateTmKey added in v0.5.1

func GenerateTmKey(seed ...interface{}) tmed25519.PrivKey

func GetIP

func GetIP() net.IP

func GetIPs

func GetIPs(n int) []net.IP

func MustParseUrl

func MustParseUrl(s string) *url.URL

func RunTestNet

func RunTestNet(t *testing.T, subnets []string, daemons map[string][]*accumulated.Daemon)

func SkipCI

func SkipCI(t testing.TB, reason string)

SkipCI skips a test when running in CI.

func SkipLong

func SkipLong(t testing.TB)

SkipLong skips a long test when running in -short mode.

func SkipPlatform

func SkipPlatform(t testing.TB, goos, reason string)

SkipPlatform skips a test when on a specific GOOS.

func SkipPlatformCI

func SkipPlatformCI(t testing.TB, goos, reason string)

SkipPlatformCI skips a test when running in CI on a specific GOOS.

func UpdateKeyPage added in v0.5.1

func UpdateKeyPage(db DB, account *url.URL, fn func(*protocol.KeyPage)) error

func WriteStates

func WriteStates(db DB, chains ...protocol.Account) error

Types

type DB

type DB = *database.Batch

type FakeTendermint

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

FakeTendermint is a test harness that facilitates testing the ABCI application without creating an actual Tendermint node.

func NewFakeTendermint

func NewFakeTendermint(app <-chan abci.Application, db *database.Database, network *config.Network, pubKey crypto.PubKey, logger log.Logger, nextHeight func() int64, onError func(err error), interval time.Duration, isEvil bool) *FakeTendermint

func (*FakeTendermint) ABCIQuery

func (c *FakeTendermint) ABCIQuery(ctx context.Context, path string, data tmbytes.HexBytes) (*ctypes.ResultABCIQuery, error)

func (*FakeTendermint) ABCIQueryWithOptions

func (c *FakeTendermint) ABCIQueryWithOptions(ctx context.Context, path string, data tmbytes.HexBytes, opts rpc.ABCIQueryOptions) (*ctypes.ResultABCIQuery, error)

func (*FakeTendermint) App

func (c *FakeTendermint) App() abci.Application

func (*FakeTendermint) BroadcastTxAsync

func (c *FakeTendermint) BroadcastTxAsync(ctx context.Context, tx types.Tx) (*ctypes.ResultBroadcastTx, error)

func (*FakeTendermint) BroadcastTxSync

func (c *FakeTendermint) BroadcastTxSync(ctx context.Context, tx types.Tx) (*ctypes.ResultBroadcastTx, error)

func (*FakeTendermint) CheckTx

func (c *FakeTendermint) CheckTx(ctx context.Context, tx types.Tx) (*ctypes.ResultCheckTx, error)

func (*FakeTendermint) Shutdown

func (c *FakeTendermint) Shutdown()

func (*FakeTendermint) SubmitTx

func (c *FakeTendermint) SubmitTx(ctx context.Context, tx types.Tx, check bool) *txStatus

func (*FakeTendermint) Tx

func (c *FakeTendermint) Tx(ctx context.Context, hash []byte, prove bool) (*ctypes.ResultTx, error)

func (*FakeTendermint) Validators added in v0.5.1

func (c *FakeTendermint) Validators() []crypto.PubKey

type NullRouter added in v0.5.1

type NullRouter struct{}

func (NullRouter) Query added in v0.5.1

func (NullRouter) Query(ctx context.Context, subnet string, query []byte, opts client.ABCIQueryOptions) (*core.ResultABCIQuery, error)

func (NullRouter) Route added in v0.5.1

func (NullRouter) Route(...*protocol.Envelope) (string, error)

func (NullRouter) RouteAccount added in v0.5.1

func (NullRouter) RouteAccount(*url.URL) (string, error)

func (NullRouter) Submit added in v0.5.1

func (NullRouter) Submit(ctx context.Context, subnet string, tx []byte, pretend, async bool) (*routing.ResponseSubmit, error)

type TransactionBuilder

type TransactionBuilder struct {
	*protocol.Envelope
	// contains filtered or unexported fields
}

func NewTransaction

func NewTransaction() TransactionBuilder

func (TransactionBuilder) Faucet added in v0.5.1

func (tb TransactionBuilder) Faucet() *protocol.Envelope

func (TransactionBuilder) Initiate added in v0.5.1

func (tb TransactionBuilder) Initiate(typ protocol.SignatureType, privateKey []byte) *protocol.Envelope

func (TransactionBuilder) InitiateSynthetic added in v0.5.1

func (tb TransactionBuilder) InitiateSynthetic(destSubnetUrl *url.URL) TransactionBuilder

func (TransactionBuilder) Sign

func (tb TransactionBuilder) Sign(typ protocol.SignatureType, privateKey []byte) *protocol.Envelope

func (TransactionBuilder) WithBody

func (TransactionBuilder) WithCurrentTimestamp added in v0.5.1

func (tb TransactionBuilder) WithCurrentTimestamp() TransactionBuilder

func (TransactionBuilder) WithHeader

func (TransactionBuilder) WithNonceVar

func (tb TransactionBuilder) WithNonceVar(nonce *uint64) TransactionBuilder

func (TransactionBuilder) WithPrincipal added in v0.5.1

func (tb TransactionBuilder) WithPrincipal(origin *url.URL) TransactionBuilder

func (TransactionBuilder) WithSigner added in v0.5.1

func (tb TransactionBuilder) WithSigner(signer *url.URL, height uint64) TransactionBuilder

func (TransactionBuilder) WithTimestamp added in v0.5.1

func (tb TransactionBuilder) WithTimestamp(nonce uint64) TransactionBuilder

func (TransactionBuilder) WithTxnHash

func (tb TransactionBuilder) WithTxnHash(hash []byte) TransactionBuilder

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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