testutils

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Apr 4, 2024 License: Apache-2.0 Imports: 44 Imported by: 0

Documentation

Index

Constants

View Source
const (
	TestMnemonic   = "dinosaur simple verify deliver bless ridge monkey design venue six problem lucky"
	TestPubKey0Hex = "03c30573dc0c7fd43fcb801289a6a96cb78c27f4ba398b89da91ece23e9a99aca3"
	TestPubKey1Hex = "02d36c574db299904b285aaeb57eb7b1fa145c43af90bec3c635c4174c224587b6"
)
View Source
const DefaultT2Timeout = uint32(2500)

Variables

View Source
var (
	DefaultInitialBillID = money.NewBillID(nil, []byte{1})
	FCRID                = money.NewFeeCreditRecordID(nil, []byte{1})
)

Functions

func AddFeeCredit

func AddFeeCredit(t *testing.T, amount uint64, systemID types.SystemID, accountKey *account.AccountKey, unitID, unitBacklink []byte, fcrID, fcrBacklink []byte, node *testpartition.NodePartition)

func CreateMoneyPartition

func CreateMoneyPartition(t *testing.T, genesisConfig *testutil.MoneyGenesisConfig, nodeCount uint8) *testpartition.NodePartition

func CreateNewTestWallet

func CreateNewTestWallet(t *testing.T, opts ...Option) string

func CreateNewTokenWallet

func CreateNewTokenWallet(t *testing.T, addr string) (*tokenswallet.Wallet, string)

func CreateNewWallet

func CreateNewWallet(t *testing.T) (account.Manager, string)

func CreateTokensPartition

func CreateTokensPartition(t *testing.T) *testpartition.NodePartition

func InitRpcServer added in v0.4.0

func InitRpcServer(node *partition.Node, nodeName string, cfg *abrpc.ServerConfiguration, ownerIndexer partition.IndexReader, obs partition.Observability) (*http.Server, error)

func SetupNetwork added in v0.4.0

func SetupNetwork(t *testing.T, genesisConfig *testutil.MoneyGenesisConfig, otherPartitions []*testpartition.NodePartition) (string, *testpartition.AlphabillNetwork)

SetupNetwork starts alphabill network. Starts money partition, and optionally any other partitions, with rpc servers up and running. Returns money node url and reference to the network object.

func SetupTestHomeDir

func SetupTestHomeDir(t *testing.T, dir string) string

func SpendInitialBillWithFeeCredits

func SpendInitialBillWithFeeCredits(t *testing.T, abNet *testpartition.AlphabillNetwork, initialBillValue uint64, pk []byte) uint64

func StartAlphabill

func StartAlphabill(t *testing.T, partitions []*testpartition.NodePartition) *testpartition.AlphabillNetwork

func StartPartitionGRPCServers added in v0.4.0

func StartPartitionGRPCServers(t *testing.T, partition *testpartition.NodePartition)

func StartRpcServer added in v0.4.0

func StartRpcServer(t *testing.T, node *partition.Node, nodeName string, ownerIndexer partition.IndexReader) string

func StartRpcServers added in v0.4.0

func StartRpcServers(t *testing.T, partition *testpartition.NodePartition)

func TestPubKey0Hash added in v0.4.0

func TestPubKey0Hash(t *testing.T) []byte

func TestPubKey1Hash added in v0.4.0

func TestPubKey1Hash(t *testing.T) []byte

func VerifyStdout

func VerifyStdout(t *testing.T, consoleWriter *TestConsoleWriter, expectedLines ...string)

func VerifyStdoutEventually

func VerifyStdoutEventually(t *testing.T, exec func() *TestConsoleWriter, expectedLines ...string)

func VerifyStdoutEventuallyWithTimeout

func VerifyStdoutEventuallyWithTimeout(t *testing.T, exec func() *TestConsoleWriter, waitFor time.Duration, tick time.Duration, expectedLines ...string)

func VerifyStdoutNotExists

func VerifyStdoutNotExists(t *testing.T, consoleWriter *TestConsoleWriter, expectedLines ...string)

Types

type Option added in v0.4.0

type Option func(*Options)

func WithDefaultMnemonic added in v0.4.0

func WithDefaultMnemonic() Option

func WithNumberOfAccounts added in v0.4.0

func WithNumberOfAccounts(numberOfAccounts int) Option

type Options added in v0.4.0

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

type TestConsoleWriter

type TestConsoleWriter struct {
	Lines []string
}

func (*TestConsoleWriter) Print

func (w *TestConsoleWriter) Print(a ...any)

func (*TestConsoleWriter) Println

func (w *TestConsoleWriter) Println(a ...any)

func (*TestConsoleWriter) String

func (w *TestConsoleWriter) String() string

Jump to

Keyboard shortcuts

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