Documentation ¶
Index ¶
- Variables
- func AuthenticateAllUsers() networktest.Action
- func FetchBalanceAtSnapshot(ctx context.Context, userID int, snapshot string) (*big.Int, error)
- func FetchBigInt(ctx context.Context, key ActionKey) (*big.Int, error)
- func FetchNumberOfTestUsers(ctx context.Context) (int, error)
- func FetchTestUser(ctx context.Context, userNumber int) (*userwallet.UserWallet, error)
- func GenerateUsersRandomisedTransferActionsInParallel(txPerSec int, duration time.Duration) networktest.Action
- func RandomSleepAction(minSleep time.Duration, maxSleep time.Duration) networktest.Action
- func RunOnlyAction(run RunFunc) networktest.Action
- func SetContextValue(key ActionKey, value interface{}) networktest.Action
- func SleepAction(duration time.Duration) networktest.Action
- func SnapshotUserBalances(snapshot string) networktest.Action
- func StartSequencerEnclave() networktest.Action
- func StartSequencerHost() networktest.Action
- func StartValidatorEnclave(validatorIdx int) networktest.Action
- func StartValidatorHost(validatorIdx int) networktest.Action
- func StopSequencerEnclave() networktest.Action
- func StopSequencerHost() networktest.Action
- func StopValidatorEnclave(validatorIdx int) networktest.Action
- func StopValidatorHost(validatorIdx int) networktest.Action
- func VerifyOnlyAction(verify VerifyFunc) networktest.Action
- func VerifyUserBalancesSanity() networktest.Action
- func WaitForSequencerHealthCheck(maxWait time.Duration) networktest.Action
- func WaitForValidatorHealthCheck(validatorIdx int, maxWait time.Duration) networktest.Action
- type ActionKey
- type AllocateFaucetFunds
- type CreateTestUser
- type MultiAction
- func CreateAndFundTestUsers(numUsers int) *MultiAction
- func NamedParallel(name string, actions ...networktest.Action) *MultiAction
- func NamedSeries(name string, actions ...networktest.Action) *MultiAction
- func Parallel(actions ...networktest.Action) *MultiAction
- func Series(actions ...networktest.Action) *MultiAction
- type RunFunc
- type SendNativeFunds
- type VerifyBalanceAfterTest
- type VerifyBalanceDiffAfterTest
- type VerifyFunc
Constants ¶
This section is empty.
Variables ¶
var KeyNumberOfTestUsers = ActionKey("numberOfTestUsers")
KeyNumberOfTestUsers key to an int representing number of test users created/available (useful for test actions that want to run for all users without having to duplicate config)
var (
// SnapAfterAllocation used to record state after initialisation and faucet allocations to test users
SnapAfterAllocation = "after-allocation"
)
standard snapshots to use as reference points across all tests
Functions ¶
func AuthenticateAllUsers ¶
func AuthenticateAllUsers() networktest.Action
func FetchBalanceAtSnapshot ¶
func FetchTestUser ¶
func FetchTestUser(ctx context.Context, userNumber int) (*userwallet.UserWallet, error)
func GenerateUsersRandomisedTransferActionsInParallel ¶
func GenerateUsersRandomisedTransferActionsInParallel(txPerSec int, duration time.Duration) networktest.Action
func RandomSleepAction ¶
func RunOnlyAction ¶ added in v0.11.0
func RunOnlyAction(run RunFunc) networktest.Action
RunOnlyAction allows you to create an action quickly with an in-line function when it doesn't need state or a verify method
func SetContextValue ¶
func SetContextValue(key ActionKey, value interface{}) networktest.Action
SetContextValue is a simple action step that just sets a value on the context
func SleepAction ¶
func SleepAction(duration time.Duration) networktest.Action
func SnapshotUserBalances ¶
func SnapshotUserBalances(snapshot string) networktest.Action
SnapshotUserBalances requests and records the curr users native balances in the context Note: when running this ensure that there are no transactions in flight if that will affect usage of this data
func StartSequencerEnclave ¶ added in v0.14.0
func StartSequencerEnclave() networktest.Action
func StartSequencerHost ¶ added in v0.14.0
func StartSequencerHost() networktest.Action
func StartValidatorEnclave ¶
func StartValidatorEnclave(validatorIdx int) networktest.Action
func StartValidatorHost ¶ added in v0.11.0
func StartValidatorHost(validatorIdx int) networktest.Action
func StopSequencerEnclave ¶ added in v0.14.0
func StopSequencerEnclave() networktest.Action
func StopSequencerHost ¶ added in v0.14.0
func StopSequencerHost() networktest.Action
func StopValidatorEnclave ¶
func StopValidatorEnclave(validatorIdx int) networktest.Action
func StopValidatorHost ¶ added in v0.11.0
func StopValidatorHost(validatorIdx int) networktest.Action
func VerifyOnlyAction ¶
func VerifyOnlyAction(verify VerifyFunc) networktest.Action
VerifyOnlyAction allows you to create a test verification quickly with an in-line function when it doesn't need state or a run method
func VerifyUserBalancesSanity ¶
func VerifyUserBalancesSanity() networktest.Action
VerifyUserBalancesSanity expects a balances SnapAfterAllocation snapshot It sums up the user balances then and now to make sure that the total hasn't increased and that it's decreased but not drastically (gas fees)
func WaitForSequencerHealthCheck ¶ added in v0.14.0
func WaitForSequencerHealthCheck(maxWait time.Duration) networktest.Action
func WaitForValidatorHealthCheck ¶
func WaitForValidatorHealthCheck(validatorIdx int, maxWait time.Duration) networktest.Action
Types ¶
type ActionKey ¶
type ActionKey string
ActionKey is the type for all test data stored in the context. Go documentation recommends using a typed key rather than string to avoid conflicts.
func BalanceSnapshotKey ¶
type AllocateFaucetFunds ¶
type AllocateFaucetFunds struct {
UserID int
}
func (*AllocateFaucetFunds) Run ¶
func (a *AllocateFaucetFunds) Run(ctx context.Context, network networktest.NetworkConnector) (context.Context, error)
func (*AllocateFaucetFunds) String ¶
func (a *AllocateFaucetFunds) String() string
func (*AllocateFaucetFunds) Verify ¶
func (a *AllocateFaucetFunds) Verify(_ context.Context, _ networktest.NetworkConnector) error
type CreateTestUser ¶
type CreateTestUser struct {
UserID int
}
func (*CreateTestUser) Run ¶
func (c *CreateTestUser) Run(ctx context.Context, network networktest.NetworkConnector) (context.Context, error)
func (*CreateTestUser) String ¶
func (c *CreateTestUser) String() string
func (*CreateTestUser) Verify ¶
func (c *CreateTestUser) Verify(_ context.Context, _ networktest.NetworkConnector) error
type MultiAction ¶
type MultiAction struct {
// contains filtered or unexported fields
}
func CreateAndFundTestUsers ¶
func CreateAndFundTestUsers(numUsers int) *MultiAction
func NamedParallel ¶
func NamedParallel(name string, actions ...networktest.Action) *MultiAction
func NamedSeries ¶
func NamedSeries(name string, actions ...networktest.Action) *MultiAction
func Parallel ¶
func Parallel(actions ...networktest.Action) *MultiAction
func Series ¶
func Series(actions ...networktest.Action) *MultiAction
func (*MultiAction) Run ¶
func (m *MultiAction) Run(ctx context.Context, network networktest.NetworkConnector) (context.Context, error)
func (*MultiAction) String ¶
func (m *MultiAction) String() string
func (*MultiAction) Verify ¶
func (m *MultiAction) Verify(ctx context.Context, network networktest.NetworkConnector) error
type RunFunc ¶
type RunFunc func(ctx context.Context, network networktest.NetworkConnector) (context.Context, error)
type SendNativeFunds ¶
type SendNativeFunds struct { FromUser int ToUser int Amount *big.Int GasLimit *big.Int SkipVerify bool // contains filtered or unexported fields }
func (*SendNativeFunds) Run ¶
func (s *SendNativeFunds) Run(ctx context.Context, _ networktest.NetworkConnector) (context.Context, error)
func (*SendNativeFunds) String ¶
func (s *SendNativeFunds) String() string
func (*SendNativeFunds) Verify ¶
func (s *SendNativeFunds) Verify(ctx context.Context, _ networktest.NetworkConnector) error
type VerifyBalanceAfterTest ¶
func (*VerifyBalanceAfterTest) Run ¶
func (c *VerifyBalanceAfterTest) Run(ctx context.Context, _ networktest.NetworkConnector) (context.Context, error)
func (*VerifyBalanceAfterTest) String ¶
func (c *VerifyBalanceAfterTest) String() string
func (*VerifyBalanceAfterTest) Verify ¶
func (c *VerifyBalanceAfterTest) Verify(ctx context.Context, _ networktest.NetworkConnector) error
type VerifyBalanceDiffAfterTest ¶
VerifyBalanceDiffAfterTest compares the post-test user balance with the balance at the given snapshot
This only checks the balance against an upper bound because of unknown gas spend, it expects `currBal < snapshotBal + expectedDiff`
func (*VerifyBalanceDiffAfterTest) Run ¶
func (v *VerifyBalanceDiffAfterTest) Run(ctx context.Context, _ networktest.NetworkConnector) (context.Context, error)
func (*VerifyBalanceDiffAfterTest) Verify ¶
func (v *VerifyBalanceDiffAfterTest) Verify(ctx context.Context, _ networktest.NetworkConnector) error
type VerifyFunc ¶
type VerifyFunc func(ctx context.Context, network networktest.NetworkConnector) error