Documentation ¶
Index ¶
- Variables
- func MultiProtocolTest(t *testing.T, test func(t *testing.T, version protocol.ConsensusVersion), ...)
- func ShutdownSynchronizedTest(t TestingTB)
- type ExpectFixture
- type Fixture
- type GoalFixture
- func (f *GoalFixture) AccountImportRootKey(wallet string, createDefaultUnencrypted bool) (err error)
- func (f *GoalFixture) AccountNew(name string) (address string, err error)
- func (f *GoalFixture) AccountRename(name, newName string) (err error)
- func (f *GoalFixture) CheckAccountListContainsAccount(matcher func([]string) bool) (bool, error)
- func (f *GoalFixture) ClerkSend(from, to string, amount, fee int64, note string) (string, error)
- func (f *GoalFixture) ClerkSendNoteb64(from, to string, amount, fee int64, noteb64 string) (string, error)
- func (f *GoalFixture) NetworkCreate(networkdir, networkName, template, pregendir string) (err error)
- func (f *GoalFixture) NetworkPregen(template, pregendir string) (stdErr string, err error)
- func (f *GoalFixture) NetworkStart(networkdir string) (err error)
- func (f *GoalFixture) NetworkStop(networkdir string) (err error)
- func (f *GoalFixture) NodeStart() error
- func (f *GoalFixture) NodeStop() error
- type KMDFixture
- func (f *KMDFixture) Initialize(t TestingTB)
- func (f *KMDFixture) MakeWalletAndHandleToken() (handleToken string, err error)
- func (f *KMDFixture) Run(m *testing.M) int
- func (f *KMDFixture) RunAndExit(m *testing.M)
- func (f *KMDFixture) Setup(t TestingTB)
- func (f *KMDFixture) SetupWithConfig(t TestingTB, config string)
- func (f *KMDFixture) SetupWithWallet(t TestingTB) (handleToken string)
- func (f *KMDFixture) Shutdown()
- func (f *KMDFixture) ShutdownImpl(preserveData bool)
- func (f *KMDFixture) TestConfig(cfg []byte) error
- type LibGoalFixture
- func (f *LibGoalFixture) ConsensusParams(round uint64) (config.ConsensusParams, error)
- func (f *LibGoalFixture) ConsensusParamsFromVer(cv protocol.ConsensusVersion) config.ConsensusParams
- func (f *LibGoalFixture) CurrentConsensusParams() (consensus config.ConsensusParams, err error)
- func (f *LibGoalFixture) CurrentMinFeeAndBalance() (minFee, minBalance uint64, err error)
- func (f *LibGoalFixture) Genesis() gen.GenesisData
- func (f *LibGoalFixture) GetBinDir() string
- func (f *LibGoalFixture) GetLibGoalClientForNamedNode(nodeName string) libgoal.Client
- func (f *LibGoalFixture) GetLibGoalClientForNamedNodeNoKeys(nodeName string) libgoal.Client
- func (f *LibGoalFixture) GetLibGoalClientFromDataDir(dataDir string) libgoal.Client
- func (f *LibGoalFixture) GetLibGoalClientFromDataDirNoKeys(dataDir string) libgoal.Client
- func (f *LibGoalFixture) GetLibGoalClientFromNodeController(nc nodecontrol.NodeController) libgoal.Client
- func (f *LibGoalFixture) GetLibGoalClientFromNodeControllerNoKeys(nc nodecontrol.NodeController) libgoal.Client
- func (f *LibGoalFixture) GetNodeController(nodeName string) (nodecontrol.NodeController, error)
- func (f *LibGoalFixture) GetNodeControllerForDataDir(nodeDataDir string) nodecontrol.NodeController
- func (f *LibGoalFixture) GetNodeDir(nodeName string) (string, error)
- func (f *LibGoalFixture) GetParticipationOnlyAccounts(lg libgoal.Client) []account.Participation
- func (f *LibGoalFixture) LightBlockHeaderProof(round uint64) (model.LightBlockHeaderProofResponse, merklearray.SingleLeafProof, error)
- func (f *LibGoalFixture) MinFeeAndBalance(round uint64) (minFee, minBalance uint64, err error)
- func (f *LibGoalFixture) NodeDataDirs() []string
- func (f *LibGoalFixture) PrimaryDataDir() string
- func (f *LibGoalFixture) RelayDataDirs() []string
- func (f *LibGoalFixture) Run(m *testing.M) int
- func (f *LibGoalFixture) RunAndExit(m *testing.M)
- func (f *LibGoalFixture) SetTestContext(t TestingTB) func()
- func (f *LibGoalFixture) Setup(t TestingTB, templateFile string, overrides ...netdeploy.TemplateOverride)
- func (f *LibGoalFixture) SetupNoStart(t TestingTB, templateFile string, overrides ...netdeploy.TemplateOverride)
- func (f *LibGoalFixture) SetupShared(testName string, templateFile string, overrides ...netdeploy.TemplateOverride)
- func (f *LibGoalFixture) Shutdown()
- func (f *LibGoalFixture) ShutdownImpl(preserveData bool)
- func (f *LibGoalFixture) Start()
- func (f *LibGoalFixture) StartNode(nodeDir string) (libgoal.Client, error)
- func (f *LibGoalFixture) TransactionProof(txid string, round uint64, hashType crypto.HashType) (model.TransactionProofResponse, merklearray.SingleLeafProof, error)
- type RestClientFixture
- func (f *RestClientFixture) AlterConsensus(ver protocol.ConsensusVersion, ...)
- func (f *RestClientFixture) AssertValidTxid(txid string)
- func (f *RestClientFixture) FasterConsensus(ver protocol.ConsensusVersion, timeout time.Duration, lookback basics.Round)
- func (f *RestClientFixture) GetAlgodClientForController(nc nodecontrol.NodeController) client.RestClient
- func (f *RestClientFixture) GetBalanceAndRound(account string) (balance uint64, round uint64)
- func (f *RestClientFixture) GetBalancesOnSameRound(maxRetries int, accounts ...string) (balances map[string]uint64, allSameRound bool, lastRound uint64)
- func (f *RestClientFixture) GetFirstAccount() (account string, err error)
- func (f *RestClientFixture) GetNodeWalletsSortedByBalance(client libgoal.Client) (accounts []model.Account, err error)
- func (f *RestClientFixture) GetRichestAccount() (richest model.Account, err error)
- func (f *RestClientFixture) GetWalletsSortedByBalance() (accounts []model.Account, err error)
- func (f *RestClientFixture) SendMoneyAndWait(curRound, amountToSend, transactionFee uint64, fromAccount, toAccount string, ...) (txn v2.PreEncodedTxInfo)
- func (f *RestClientFixture) SendMoneyAndWaitFromWallet(walletHandle, walletPassword []byte, ...) (txn v2.PreEncodedTxInfo)
- func (f *RestClientFixture) SetConsensus(consensus config.ConsensusProtocols)
- func (f *RestClientFixture) Setup(t TestingTB, templateFile string, overrides ...netdeploy.TemplateOverride)
- func (f *RestClientFixture) SetupNoStart(t TestingTB, templateFile string, overrides ...netdeploy.TemplateOverride)
- func (f *RestClientFixture) SetupShared(testName string, templateFile string, overrides ...netdeploy.TemplateOverride)
- func (f *RestClientFixture) Start()
- func (f *RestClientFixture) VerifyBlockProposed(account string, searchRange int) (blockWasProposed bool)
- func (f *RestClientFixture) VerifyBlockProposedRange(account string, fromRound, countDownNumRounds int) bool
- func (f *RestClientFixture) WaitForAccountFunded(roundTimeout uint64, accountAddress string) (err error)
- func (f *RestClientFixture) WaitForAllTxnsToConfirm(roundTimeout uint64, txidsAndAddresses map[string]string) bool
- func (f *RestClientFixture) WaitForBlockWithTimeout(roundToWaitFor uint64) (bookkeeping.Block, error)
- func (f *RestClientFixture) WaitForConfirmedTxn(roundTimeout uint64, txid string) (txn v2.PreEncodedTxInfo, err error)
- func (f *RestClientFixture) WaitForRound(round uint64, waitTime time.Duration) error
- func (f *RestClientFixture) WaitForRoundWithTimeout(roundToWaitFor uint64) error
- func (f *RestClientFixture) WaitForTxnConfirmation(roundTimeout uint64, txid string) bool
- func (f *RestClientFixture) WithEveryBlock(first, last uint64, visit func(bookkeeping.Block))
- type TestingTB
- type WebProxy
- type WebProxyInterceptFunc
Constants ¶
This section is empty.
Variables ¶
var ErrAccountAlreadyTaken = fmt.Errorf("account name already taken")
ErrAccountAlreadyTaken indicates account new is called with a duplicate / existing friendly account name
var ErrAccountNewCall = fmt.Errorf("account new failed")
ErrAccountNewCall indicates the account new REST call failed
Functions ¶
func MultiProtocolTest ¶
func MultiProtocolTest(t *testing.T, test func(t *testing.T, version protocol.ConsensusVersion), versions ...protocol.ConsensusVersion)
MultiProtocolTest runs a test for multiple consensus versions. It only runs against the *first* version when doing Short tests.
func ShutdownSynchronizedTest ¶
func ShutdownSynchronizedTest(t TestingTB)
ShutdownSynchronizedTest should be called within each test using synchTest. It ensures the base test will no longer get t.finished modified and cause a data race. It should be called in the form of "defer fixtures.ShutdownSynchronizedTest(t)"
Types ¶
type ExpectFixture ¶
type ExpectFixture struct {
// contains filtered or unexported fields
}
ExpectFixture is a wrapper for running expect tests
func MakeExpectTest ¶
func MakeExpectTest(t *testing.T) *ExpectFixture
MakeExpectTest creates an expect test fixture for the current directory
func (*ExpectFixture) Run ¶
func (ef *ExpectFixture) Run()
Run Process all expect script files with suffix Test.exp within the current directory
type Fixture ¶
type Fixture interface { // Run executes the tests after the fixture initializes // and returns the exit code from testing Run(m *testing.M) int // Run executes the tests after the fixture initializes, and either // returns the exit code from testing, or calls os.Exit(ret) directly RunAndExit(m *testing.M) // Shutdown should be called for a single-use fixture shutdown / cleanup // It requires a valid t.Testing to be assigned. Shutdown() // ShutdownImpl should not generally be called except for implementations // where there is no single t.Testing associated with the fixture // (e.g. shared across all tests in a package) ShutdownImpl(preserveData bool) }
Fixture provides the base interface for all E2E test fixtures so we can work with them abstractly if needed
type GoalFixture ¶
type GoalFixture struct {
RestClientFixture
}
GoalFixture is a fixture for tests against the goal CLI
func (*GoalFixture) AccountImportRootKey ¶
func (f *GoalFixture) AccountImportRootKey(wallet string, createDefaultUnencrypted bool) (err error)
AccountImportRootKey exposes the `goal account importrootkey` command
func (*GoalFixture) AccountNew ¶
func (f *GoalFixture) AccountNew(name string) (address string, err error)
AccountNew exposes the `goal account new` command
func (*GoalFixture) AccountRename ¶
func (f *GoalFixture) AccountRename(name, newName string) (err error)
AccountRename exposes the `goal account rename` command
func (*GoalFixture) CheckAccountListContainsAccount ¶
func (f *GoalFixture) CheckAccountListContainsAccount(matcher func([]string) bool) (bool, error)
CheckAccountListContainsAccount processes the `goal account list` results and returns true if the provided matcher matches one of the results
func (*GoalFixture) ClerkSend ¶
ClerkSend exposes the `goal clerk send` command with a plaintext note
func (*GoalFixture) ClerkSendNoteb64 ¶
func (f *GoalFixture) ClerkSendNoteb64(from, to string, amount, fee int64, noteb64 string) (string, error)
ClerkSendNoteb64 exposes the `goal clerk send` command but passes the note as base64
func (*GoalFixture) NetworkCreate ¶
func (f *GoalFixture) NetworkCreate(networkdir, networkName, template, pregendir string) (err error)
NetworkCreate exposes the `goal network create` command
func (*GoalFixture) NetworkPregen ¶
func (f *GoalFixture) NetworkPregen(template, pregendir string) (stdErr string, err error)
NetworkPregen exposes the `goal network pregen` command
func (*GoalFixture) NetworkStart ¶
func (f *GoalFixture) NetworkStart(networkdir string) (err error)
NetworkStart exposes the `goal network start` command
func (*GoalFixture) NetworkStop ¶
func (f *GoalFixture) NetworkStop(networkdir string) (err error)
NetworkStop exposes the `goal network stop` command
func (*GoalFixture) NodeStart ¶
func (f *GoalFixture) NodeStart() error
NodeStart exposes the `goal node start` command
func (*GoalFixture) NodeStop ¶
func (f *GoalFixture) NodeStop() error
NodeStop exposes the `goal node stop` command
type KMDFixture ¶
type KMDFixture struct { Sock string APIToken []byte WalletName string WalletPassword string Client *client.KMDClient // contains filtered or unexported fields }
KMDFixture is a test fixture for tests requiring interactions with kmd
func (*KMDFixture) Initialize ¶
func (f *KMDFixture) Initialize(t TestingTB)
Initialize initializes the dataDir and TestingT for this test but doesn't start kmd
func (*KMDFixture) MakeWalletAndHandleToken ¶
func (f *KMDFixture) MakeWalletAndHandleToken() (handleToken string, err error)
MakeWalletAndHandleToken creates a wallet and returns a wallet handle to it
func (*KMDFixture) Run ¶
func (f *KMDFixture) Run(m *testing.M) int
Run runs all of the tests for this fixture
func (*KMDFixture) RunAndExit ¶
func (f *KMDFixture) RunAndExit(m *testing.M)
RunAndExit is like Run, but then calls ShutdownImpl
func (*KMDFixture) Setup ¶
func (f *KMDFixture) Setup(t TestingTB)
Setup starts kmd with the default config
func (*KMDFixture) SetupWithConfig ¶
func (f *KMDFixture) SetupWithConfig(t TestingTB, config string)
SetupWithConfig starts a kmd node with the passed config or default test config, if the passed config is blank. Though internally an error might occur during setup, we never return one, because we'll still fail the test for any errors here, and it keeps the test code much cleaner
func (*KMDFixture) SetupWithWallet ¶
func (f *KMDFixture) SetupWithWallet(t TestingTB) (handleToken string)
SetupWithWallet starts kmd and creates a wallet, returning a wallet handle
func (*KMDFixture) Shutdown ¶
func (f *KMDFixture) Shutdown()
Shutdown stops the kmd instance if it's running and cleans up the dataDir if there was no test failure
func (*KMDFixture) ShutdownImpl ¶
func (f *KMDFixture) ShutdownImpl(preserveData bool)
ShutdownImpl is not relevant for kmd so just panics
func (*KMDFixture) TestConfig ¶
func (f *KMDFixture) TestConfig(cfg []byte) error
TestConfig checks whether or not the passed config would be considered valid
type LibGoalFixture ¶
type LibGoalFixture struct { LibGoalClient libgoal.Client NC nodecontrol.NodeController Name string // contains filtered or unexported fields }
LibGoalFixture is a test fixture for tests requiring a running node with a algod and kmd clients
func (*LibGoalFixture) ConsensusParams ¶
func (f *LibGoalFixture) ConsensusParams(round uint64) (config.ConsensusParams, error)
ConsensusParams returns the consensus parameters for the protocol from the specified round
func (*LibGoalFixture) ConsensusParamsFromVer ¶
func (f *LibGoalFixture) ConsensusParamsFromVer(cv protocol.ConsensusVersion) config.ConsensusParams
ConsensusParamsFromVer looks up a consensus version, allowing for override
func (*LibGoalFixture) CurrentConsensusParams ¶
func (f *LibGoalFixture) CurrentConsensusParams() (consensus config.ConsensusParams, err error)
CurrentConsensusParams returns the consensus parameters for the currently active protocol
func (*LibGoalFixture) CurrentMinFeeAndBalance ¶
func (f *LibGoalFixture) CurrentMinFeeAndBalance() (minFee, minBalance uint64, err error)
CurrentMinFeeAndBalance returns the MinTxnFee and MinBalance for the currently active protocol If MinBalance is 0, we provide a reasonable default of the current consensus version's minBalance, to ensure accounts have funds when MinBalance is used to fund new accounts
func (*LibGoalFixture) Genesis ¶
func (f *LibGoalFixture) Genesis() gen.GenesisData
Genesis returns the genesis data for this fixture
func (*LibGoalFixture) GetBinDir ¶
func (f *LibGoalFixture) GetBinDir() string
GetBinDir retrives the bin directory
func (*LibGoalFixture) GetLibGoalClientForNamedNode ¶
func (f *LibGoalFixture) GetLibGoalClientForNamedNode(nodeName string) libgoal.Client
GetLibGoalClientForNamedNode returns the LibGoal Client for a given named node
func (*LibGoalFixture) GetLibGoalClientForNamedNodeNoKeys ¶
func (f *LibGoalFixture) GetLibGoalClientForNamedNodeNoKeys(nodeName string) libgoal.Client
GetLibGoalClientForNamedNodeNoKeys returns the LibGoal Client for a given named node
func (*LibGoalFixture) GetLibGoalClientFromDataDir ¶
func (f *LibGoalFixture) GetLibGoalClientFromDataDir(dataDir string) libgoal.Client
GetLibGoalClientFromDataDir returns the LibGoal Client for a given data directory
func (*LibGoalFixture) GetLibGoalClientFromDataDirNoKeys ¶
func (f *LibGoalFixture) GetLibGoalClientFromDataDirNoKeys(dataDir string) libgoal.Client
GetLibGoalClientFromDataDirNoKeys returns the LibGoal Client for a given data directory
func (*LibGoalFixture) GetLibGoalClientFromNodeController ¶
func (f *LibGoalFixture) GetLibGoalClientFromNodeController(nc nodecontrol.NodeController) libgoal.Client
GetLibGoalClientFromNodeController returns the LibGoal Client for a given node controller
func (*LibGoalFixture) GetLibGoalClientFromNodeControllerNoKeys ¶
func (f *LibGoalFixture) GetLibGoalClientFromNodeControllerNoKeys(nc nodecontrol.NodeController) libgoal.Client
GetLibGoalClientFromNodeControllerNoKeys returns the LibGoal Client for a given node controller
func (*LibGoalFixture) GetNodeController ¶
func (f *LibGoalFixture) GetNodeController(nodeName string) (nodecontrol.NodeController, error)
GetNodeController returns the node controller that is associated with the given node name.
func (*LibGoalFixture) GetNodeControllerForDataDir ¶
func (f *LibGoalFixture) GetNodeControllerForDataDir(nodeDataDir string) nodecontrol.NodeController
GetNodeControllerForDataDir returns a NodeController for the specified nodeDataDir
func (*LibGoalFixture) GetNodeDir ¶
func (f *LibGoalFixture) GetNodeDir(nodeName string) (string, error)
GetNodeDir returns the node directory that is associated with the given node name.
func (*LibGoalFixture) GetParticipationOnlyAccounts ¶
func (f *LibGoalFixture) GetParticipationOnlyAccounts(lg libgoal.Client) []account.Participation
GetParticipationOnlyAccounts returns accounts that only have participation keys
func (*LibGoalFixture) LightBlockHeaderProof ¶
func (f *LibGoalFixture) LightBlockHeaderProof(round uint64) (model.LightBlockHeaderProofResponse, merklearray.SingleLeafProof, error)
LightBlockHeaderProof returns a proof for usage in merkle array verification for the provided block's light block header.
func (*LibGoalFixture) MinFeeAndBalance ¶
func (f *LibGoalFixture) MinFeeAndBalance(round uint64) (minFee, minBalance uint64, err error)
MinFeeAndBalance returns the MinTxnFee and MinBalance for the protocol from the specified round If MinBalance is 0, we provide a resonable default of 1000 to ensure accounts have funds when MinBalance is used to fund new accounts
func (*LibGoalFixture) NodeDataDirs ¶
func (f *LibGoalFixture) NodeDataDirs() []string
NodeDataDirs returns the (non-Primary) data directories for the network
func (*LibGoalFixture) PrimaryDataDir ¶
func (f *LibGoalFixture) PrimaryDataDir() string
PrimaryDataDir returns the data directory for the PrimaryNode for the network
func (*LibGoalFixture) RelayDataDirs ¶
func (f *LibGoalFixture) RelayDataDirs() []string
RelayDataDirs returns the relays data directories for the network (including the primary relay)
func (*LibGoalFixture) Run ¶
func (f *LibGoalFixture) Run(m *testing.M) int
Run implements the Fixture.Run method
func (*LibGoalFixture) RunAndExit ¶
func (f *LibGoalFixture) RunAndExit(m *testing.M)
RunAndExit implements the Fixture.RunAndExit method
func (*LibGoalFixture) SetTestContext ¶
func (f *LibGoalFixture) SetTestContext(t TestingTB) func()
SetTestContext should be called within each test using a shared fixture. It ensures the current test context is set and then reset after the test ends It should be called in the form of "defer fixture.SetTestContext(t)()"
func (*LibGoalFixture) Setup ¶
func (f *LibGoalFixture) Setup(t TestingTB, templateFile string, overrides ...netdeploy.TemplateOverride)
Setup is called to initialize the test fixture for the test(s)
func (*LibGoalFixture) SetupNoStart ¶
func (f *LibGoalFixture) SetupNoStart(t TestingTB, templateFile string, overrides ...netdeploy.TemplateOverride)
SetupNoStart is called to initialize the test fixture for the test(s) but does not start the network before returning. Call NC.Start() to start later.
func (*LibGoalFixture) SetupShared ¶
func (f *LibGoalFixture) SetupShared(testName string, templateFile string, overrides ...netdeploy.TemplateOverride)
SetupShared is called to initialize the test fixture that will be used for multiple tests
func (*LibGoalFixture) Shutdown ¶
func (f *LibGoalFixture) Shutdown()
Shutdown implements the Fixture.Shutdown method
func (*LibGoalFixture) ShutdownImpl ¶
func (f *LibGoalFixture) ShutdownImpl(preserveData bool)
ShutdownImpl implements the Fixture.ShutdownImpl method
func (*LibGoalFixture) Start ¶
func (f *LibGoalFixture) Start()
Start can be called to start the fixture's network if SetupNoStart() was used.
func (*LibGoalFixture) StartNode ¶
func (f *LibGoalFixture) StartNode(nodeDir string) (libgoal.Client, error)
StartNode can be called to start a node after the network has been started (with the correct PeerAddresses for configured relays)
func (*LibGoalFixture) TransactionProof ¶
func (f *LibGoalFixture) TransactionProof(txid string, round uint64, hashType crypto.HashType) (model.TransactionProofResponse, merklearray.SingleLeafProof, error)
TransactionProof returns a proof for usage in merkle array verification for the provided transaction.
type RestClientFixture ¶
type RestClientFixture struct { LibGoalFixture AlgodClient client.RestClient }
RestClientFixture is a test fixture for tests requiring a running node with a REST client
func (*RestClientFixture) AlterConsensus ¶
func (f *RestClientFixture) AlterConsensus(ver protocol.ConsensusVersion, alter func(config.ConsensusParams) config.ConsensusParams)
AlterConsensus allows the caller to modify the consensus settings for a given version.
func (*RestClientFixture) AssertValidTxid ¶
func (f *RestClientFixture) AssertValidTxid(txid string)
AssertValidTxid takes a string txid and checks whether it is well-formed and valid
func (*RestClientFixture) FasterConsensus ¶
func (f *RestClientFixture) FasterConsensus(ver protocol.ConsensusVersion, timeout time.Duration, lookback basics.Round)
FasterConsensus speeds up the given consensus version in two ways. The seed refresh lookback is set to 8 (instead of 80), so the 320 round balance lookback becomes 32. And, if the architecture implies it can be handled, round times are shortened by lowering vote timeouts.
func (*RestClientFixture) GetAlgodClientForController ¶
func (f *RestClientFixture) GetAlgodClientForController(nc nodecontrol.NodeController) client.RestClient
GetAlgodClientForController returns a RestClient for the specified NodeController
func (*RestClientFixture) GetBalanceAndRound ¶
func (f *RestClientFixture) GetBalanceAndRound(account string) (balance uint64, round uint64)
GetBalanceAndRound returns the current balance of an account and the current round for that balance
func (*RestClientFixture) GetBalancesOnSameRound ¶
func (f *RestClientFixture) GetBalancesOnSameRound(maxRetries int, accounts ...string) (balances map[string]uint64, allSameRound bool, lastRound uint64)
GetBalancesOnSameRound gets the balances for the passed addresses, and keeps trying until the balances are all the same round if it can't get the balances for the same round within maxRetries retries, it will return the last balance seen for each acct it also returns whether it got balances all for the same round, and what the last queried round was
func (*RestClientFixture) GetFirstAccount ¶
func (f *RestClientFixture) GetFirstAccount() (account string, err error)
GetFirstAccount returns the first account from listing local accounts
func (*RestClientFixture) GetNodeWalletsSortedByBalance ¶
func (f *RestClientFixture) GetNodeWalletsSortedByBalance(client libgoal.Client) (accounts []model.Account, err error)
GetNodeWalletsSortedByBalance returns the specified node's accounts sorted DESC by balance the richest account will be at accounts[0]
func (*RestClientFixture) GetRichestAccount ¶
func (f *RestClientFixture) GetRichestAccount() (richest model.Account, err error)
GetRichestAccount returns the first account when calling GetWalletsSortedByBalance, which should be the richest account
func (*RestClientFixture) GetWalletsSortedByBalance ¶
func (f *RestClientFixture) GetWalletsSortedByBalance() (accounts []model.Account, err error)
GetWalletsSortedByBalance returns the Primary node's accounts sorted DESC by balance the richest account will be at accounts[0]
func (*RestClientFixture) SendMoneyAndWait ¶
func (f *RestClientFixture) SendMoneyAndWait(curRound, amountToSend, transactionFee uint64, fromAccount, toAccount string, closeToAccount string) (txn v2.PreEncodedTxInfo)
SendMoneyAndWait uses the rest client to send money and WaitForTxnConfirmation to wait for the send to confirm it adds some extra error checking as well
func (*RestClientFixture) SendMoneyAndWaitFromWallet ¶
func (f *RestClientFixture) SendMoneyAndWaitFromWallet(walletHandle, walletPassword []byte, curRound, amountToSend, transactionFee uint64, fromAccount, toAccount string, closeToAccount string) (txn v2.PreEncodedTxInfo)
SendMoneyAndWaitFromWallet is as above, but for a specific wallet
func (*RestClientFixture) SetConsensus ¶
func (f *RestClientFixture) SetConsensus(consensus config.ConsensusProtocols)
SetConsensus applies a new consensus settings which would get deployed before any of the nodes starts
func (*RestClientFixture) Setup ¶
func (f *RestClientFixture) Setup(t TestingTB, templateFile string, overrides ...netdeploy.TemplateOverride)
Setup is called to initialize the test fixture for the test(s)
func (*RestClientFixture) SetupNoStart ¶
func (f *RestClientFixture) SetupNoStart(t TestingTB, templateFile string, overrides ...netdeploy.TemplateOverride)
SetupNoStart is called to initialize the test fixture for the test(s) but does not start the network before returning. Call NC.Start() to start later.
func (*RestClientFixture) SetupShared ¶
func (f *RestClientFixture) SetupShared(testName string, templateFile string, overrides ...netdeploy.TemplateOverride)
SetupShared is called to initialize the test fixture that will be used for multiple tests
func (*RestClientFixture) Start ¶
func (f *RestClientFixture) Start()
Start can be called to start the fixture's network if SetupNoStart() was used.
func (*RestClientFixture) VerifyBlockProposed ¶
func (f *RestClientFixture) VerifyBlockProposed(account string, searchRange int) (blockWasProposed bool)
VerifyBlockProposed checks the last searchRange blocks to see if any blocks were proposed by address
func (*RestClientFixture) VerifyBlockProposedRange ¶
func (f *RestClientFixture) VerifyBlockProposedRange(account string, fromRound, countDownNumRounds int) bool
VerifyBlockProposedRange checks the rounds starting at fromRounds and moving backwards checking countDownNumRounds rounds if any blocks were proposed by address
func (*RestClientFixture) WaitForAccountFunded ¶
func (f *RestClientFixture) WaitForAccountFunded(roundTimeout uint64, accountAddress string) (err error)
WaitForAccountFunded waits until either the passed account gets non-empty balance or until the passed roundTimeout passes or until waiting for a round to pass times out
func (*RestClientFixture) WaitForAllTxnsToConfirm ¶
func (f *RestClientFixture) WaitForAllTxnsToConfirm(roundTimeout uint64, txidsAndAddresses map[string]string) bool
WaitForAllTxnsToConfirm is as WaitForTxnConfirmation, but accepting a whole map of txids to their issuing address
func (*RestClientFixture) WaitForBlockWithTimeout ¶
func (f *RestClientFixture) WaitForBlockWithTimeout(roundToWaitFor uint64) (bookkeeping.Block, error)
WaitForBlockWithTimeout waits for a given round and returns its block.
func (*RestClientFixture) WaitForConfirmedTxn ¶
func (f *RestClientFixture) WaitForConfirmedTxn(roundTimeout uint64, txid string) (txn v2.PreEncodedTxInfo, err error)
WaitForConfirmedTxn waits until either the passed txid is confirmed or until the passed roundTimeout passes or until waiting for a round to pass times out
func (*RestClientFixture) WaitForRound ¶
func (f *RestClientFixture) WaitForRound(round uint64, waitTime time.Duration) error
WaitForRound waits up to the specified amount of time for the network to reach or pass the specified round
func (*RestClientFixture) WaitForRoundWithTimeout ¶
func (f *RestClientFixture) WaitForRoundWithTimeout(roundToWaitFor uint64) error
WaitForRoundWithTimeout waits for a given round to reach. The implementation also ensures to limit the wait time for each round to the globals.MaxTimePerRound so we can alert when we're getting "hung" before waiting for all the expected rounds to reach.
func (*RestClientFixture) WaitForTxnConfirmation ¶
func (f *RestClientFixture) WaitForTxnConfirmation(roundTimeout uint64, txid string) bool
WaitForTxnConfirmation waits until either the passed txid is confirmed or until the passed roundTimeout passes or until waiting for a round to pass times out
func (*RestClientFixture) WithEveryBlock ¶
func (f *RestClientFixture) WithEveryBlock(first, last uint64, visit func(bookkeeping.Block))
WithEveryBlock calls the provided function for every block from first to last.
type TestingTB ¶
type TestingTB interface { Cleanup(func()) Error(args ...interface{}) Errorf(format string, args ...interface{}) Fail() FailNow() Failed() bool Fatal(args ...interface{}) Fatalf(format string, args ...interface{}) Helper() Log(args ...interface{}) Logf(format string, args ...interface{}) Name() string Skip(args ...interface{}) SkipNow() Skipf(format string, args ...interface{}) Skipped() bool }
TestingTB is identical to testing.TB, beside the private method.
func SynchronizedTest ¶
SynchronizedTest generates a testing.TB compatible test for a given testing.TB interface. calling SynchronizedTest with the same tb would return the exact same instance of synchTest
type WebProxy ¶
type WebProxy struct {
// contains filtered or unexported fields
}
WebProxy is the web proxy instance
func MakeWebProxy ¶
func MakeWebProxy(destination string, log logging.Logger, intercept WebProxyInterceptFunc) (wp *WebProxy, err error)
MakeWebProxy creates an instance of the web proxy
func (*WebProxy) GetListenAddress ¶
GetListenAddress retrieves the listening address of the web proxy
func (*WebProxy) Passthrough ¶
func (wp *WebProxy) Passthrough(response http.ResponseWriter, request *http.Request)
Passthrough is the default web proxy implemented function for passing a requests through without modifying it.
type WebProxyInterceptFunc ¶
type WebProxyInterceptFunc func(http.ResponseWriter, *http.Request, http.HandlerFunc)
WebProxyInterceptFunc expose the web proxy intercept function