testutils

package
v1.0.0-rc1 Latest Latest
Warning

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

Go to latest
Published: Nov 29, 2024 License: Apache-2.0 Imports: 22 Imported by: 0

Documentation

Index

Constants

View Source
const (
	WalletBaseDir  = "wallet"
	TestMnemonic   = "dinosaur simple verify deliver bless ridge monkey design venue six problem lucky"
	TestPubKey0Hex = "03c30573dc0c7fd43fcb801289a6a96cb78c27f4ba398b89da91ece23e9a99aca3"
	TestPubKey1Hex = "02d36c574db299904b285aaeb57eb7b1fa145c43af90bec3c635c4174c224587b6"
	WaitDuration   = 4 * time.Second
	WaitTick       = 100 * time.Millisecond
)

Variables

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

Functions

func CreateNewTestWallet

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

func CreateNewWallet

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

func SetupNetworkWithWallets

func SetupNetworkWithWallets(t *testing.T, opts ...AlphabillNetworkOption) ([]*Wallet, *AlphabillNetwork)

SetupNetworkWithWallets sets up the Alphabill network and creates two wallets with two keys in both of them. Starts money partition, and with given options, tokens, evm and/or orchestration partitions, with rpc servers up and running. The owner of the initial bill is set to the first key of the first wallet. Returns the created wallets and a reference to the Alphabill network.

func SetupTestHomeDir

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

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 AlphabillNetwork

type AlphabillNetwork struct {
	MoneyRpcUrl            string
	TokensRpcUrl           string
	EvmRpcUrl              string
	OrchestrationRpcUrl    string
	EnterpriseTokensRpcUrl string
	// contains filtered or unexported fields
}

type AlphabillNetworkOption

type AlphabillNetworkOption func(*AlphabillNetwork)

func WithEnterpriseTokensNode

func WithEnterpriseTokensNode(t *testing.T) AlphabillNetworkOption

func WithEvmNode

func WithEvmNode(t *testing.T) AlphabillNetworkOption

func WithOrchestrationNode

func WithOrchestrationNode(t *testing.T) AlphabillNetworkOption

func WithTokensNode

func WithTokensNode(t *testing.T) AlphabillNetworkOption

type CmdConstructor

type CmdConstructor func(*types.BaseConfiguration) *cobra.Command

type CmdExecutor

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

func NewCmdExecutor

func NewCmdExecutor(cmdConstructor CmdConstructor, prefixArgs ...string) *CmdExecutor

func NewSubCmdExecutor

func NewSubCmdExecutor(cmdConstructor SubCmdConstructor, prefixArgs ...string) *CmdExecutor

func (*CmdExecutor) Exec

func (c *CmdExecutor) Exec(t *testing.T, args ...string) *TestConsoleWriter

func (*CmdExecutor) ExecFunc

func (c *CmdExecutor) ExecFunc(t *testing.T, args ...string) func() *TestConsoleWriter

func (*CmdExecutor) ExecWithError

func (c *CmdExecutor) ExecWithError(t *testing.T, expectedError string, args ...string)

func (CmdExecutor) WithHome

func (c CmdExecutor) WithHome(home string) *CmdExecutor

func (CmdExecutor) WithPrefixArgs

func (c CmdExecutor) WithPrefixArgs(prefixArgs ...string) *CmdExecutor

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 StdoutLogConsumer

type StdoutLogConsumer struct{}

func (*StdoutLogConsumer) Accept

func (lc *StdoutLogConsumer) Accept(l tc.Log)

type SubCmdConstructor

type SubCmdConstructor func(*types.WalletConfig) *cobra.Command

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

type Wallet

type Wallet struct {
	Homedir string
	PubKeys [][]byte
}

func SetupWallets

func SetupWallets(t *testing.T, walletCount, keyCount int) []*Wallet

Jump to

Keyboard shortcuts

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