Documentation ¶
Index ¶
- Variables
- type AuctionBankKey
- type AuctionFixture
- func (f *AuctionFixture) AuctionBankRestClient(restURL *url.URL) auctionClient.BankRestClient
- func (f *AuctionFixture) AuctionConsoleRestClient(restURL *url.URL) auctionClient.ConsoleRestClient
- func (f *AuctionFixture) CancelAuction() (stdout string, errorOutput string, err error)
- func (f *AuctionFixture) CompareAlgoAndBankAccounts(userName string) (err error)
- func (f *AuctionFixture) ComputeCurrentPrice(curRound, initialRound, numChunks, priceChunkRounds, lastPrice, ... uint64) (price uint64, err error)
- func (f *AuctionFixture) CrossVerifyEndOfAuction(params auction.Params, outcome auction.BidOutcomes, cancelled bool) (passed bool)
- func (f *AuctionFixture) EndAuction() (stdout string, errorOutput string, err error)
- func (f *AuctionFixture) GetActualAuctionParams() (aip InitParams, err error)
- func (f *AuctionFixture) GetAlgodRestClient() client.RestClient
- func (f *AuctionFixture) GetAuctionBankKey() (abk string, err error)
- func (f *AuctionFixture) GetAuctionBankPid() (pid string, err error)
- func (f *AuctionFixture) GetAuctionBankPort() (port string, err error)
- func (f *AuctionFixture) GetAuctionBankRestClient() auctionClient.BankRestClient
- func (f *AuctionFixture) GetAuctionConsolePid() (pid string, err error)
- func (f *AuctionFixture) GetAuctionConsolePort() (port string, err error)
- func (f *AuctionFixture) GetAuctionConsoleRestClient() auctionClient.ConsoleRestClient
- func (f *AuctionFixture) GetAuctionMasterPrivateKey() (auctionMasterPrivateKey string, err error)
- func (f *AuctionFixture) GetAuctionMasterPublicKey() (auctionKey string, err error)
- func (f *AuctionFixture) GetAuctionMinionInitialState() (ams AuctionMinionState, err error)
- func (f *AuctionFixture) GetAuctionStartBroadcastMessage() (abs string, err error)
- func (f *AuctionFixture) GetAuctionTracker() (auctionTracker *auction.Tracker, err error)
- func (f *AuctionFixture) GetCurrentPriceFromConsole(auction1 auction.RunningAuction) (price uint64, err error)
- func (f *AuctionFixture) GetDefaultWalletAndPassword() (walletHandel []byte, password string, err error)
- func (f *AuctionFixture) GetLastSettledID() (lastSettledID string, err error)
- func (f *AuctionFixture) GetLibGoalClient() libgoal.Client
- func (f *AuctionFixture) GetPID(pidFile string) (pid uint64, err error)
- func (f *AuctionFixture) GetPaymentTransactionBytesFromFile(auctionID uint64) (paymentTransactionsBytes []byte, err error)
- func (f *AuctionFixture) GetPaymentTransactionStructureFromFile(auctionID string) (paymentTransactions []transactions.SignedTxn, err error)
- func (f *AuctionFixture) GetRunningAuction() (runningAuction *auction.RunningAuction, err error)
- func (f *AuctionFixture) GetSettlementTransactionBytesFromFile(trxID uint64) (settleTxnBytes []byte, err error)
- func (f *AuctionFixture) GetSettlementTransactionStructureFromFile(trxID string) (st transactions.SignedTxn, err error)
- func (f *AuctionFixture) GetStartTransactionFile(auctionID string) (startTransaction string, err error)
- func (f *AuctionFixture) MakeAndPostBidAndDeposit(bidID, auctionID uint64, auctionKey, biddingAccount string, ...) (txid string, transactionID string, err error)
- func (f *AuctionFixture) MakeAndPostBidAndDepositWithWallet(walletHandle []byte, password string, bidID, auctionID uint64, ...) (txid string, transactionID string, err error)
- func (f *AuctionFixture) MakeBankAccountIfNoneExists(username string) (err error)
- func (f *AuctionFixture) MakeSignedBid(bidID uint64, auctionKey string, auctionID uint64, account string, ...) (signedBidNote []byte, err error)
- func (f *AuctionFixture) MakeSignedBidWithWallet(walletHandle []byte, password string, bidID uint64, auctionKey string, ...) (signedBidNote []byte, err error)
- func (f *AuctionFixture) MakeSignedDeposit(usernameWithBank, auctionKey, bidderKey string, ...) (signedDepositNote client.BytesBase64, err error)
- func (f *AuctionFixture) SettleAuctionBank(auctionKey string, auctionID uint64) (err error)
- func (f *AuctionFixture) Setup(t TestingTB, templateFile string) (err error)
- func (f *AuctionFixture) ShowGenesisFile() (err error)
- func (f *AuctionFixture) Shutdown() (err error)
- func (f *AuctionFixture) StartAuction(auctionParamFile string) (inputParams InitParams, consoleViewParams auction.Params, stdout string, ...)
- func (f *AuctionFixture) StartAuctionWithAuctionMasterBalance(auctionParamFile string, auctionMasterStartBalance uint64) (inputParams InitParams, consoleViewParams auction.Params, stdout string, ...)
- func (f *AuctionFixture) Stop(pidFile string) error
- func (f *AuctionFixture) WaitForNextRound() (newAlgodStatus generatedV2.NodeStatusResponse, err error)
- func (f *AuctionFixture) WaitForNonZeroAuctionID() (lastAuctionID auctionClient.LastAuctionIDResponse, err error)
- type AuctionMinionState
- 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) NodeStart() error
- func (f *GoalFixture) NodeStop() error
- type InitParams
- 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) ClientWaitForRound(client libgoal.Client, round uint64, waitTime time.Duration) error
- func (f *LibGoalFixture) ClientWaitForRoundWithTimeout(client libgoal.Client, roundToWaitFor uint64) error
- func (f *LibGoalFixture) ConsensusParams(round uint64) (consensus config.ConsensusParams, err error)
- 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) MinFeeAndBalance(round uint64) (minFee, minBalance uint64, err error)
- func (f *LibGoalFixture) NodeDataDirs() []string
- func (f *LibGoalFixture) PrimaryDataDir() 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)
- func (f *LibGoalFixture) SetupNoStart(t TestingTB, templateFile string)
- func (f *LibGoalFixture) SetupShared(testName string, templateFile string)
- 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) WaitForRoundWithTimeout(roundToWaitFor uint64) error
- type PaymentTransactionArray
- type RestClientFixture
- func (f *RestClientFixture) AccountListContainsAddress(searchList []v1.Account, address string) bool
- func (f *RestClientFixture) AssertValidTxid(txid string)
- func (f *RestClientFixture) ClientWaitForRound(client client.RestClient, round uint64, waitTime time.Duration) error
- func (f *RestClientFixture) ClientWaitForRoundWithTimeout(client client.RestClient, roundToWaitFor uint64) error
- 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(nodeDataDir string) (accounts []v1.Account, err error)
- func (f *RestClientFixture) GetRichestAccount() (richest v1.Account, err error)
- func (f *RestClientFixture) GetWalletsSortedByBalance() (accounts []v1.Account, err error)
- func (f *RestClientFixture) SendMoneyAndWait(curRound, amountToSend, transactionFee uint64, fromAccount, toAccount string) (fundingTxid string)
- func (f *RestClientFixture) SendMoneyAndWaitFromWallet(walletHandle, walletPassword []byte, ...) (fundingTxid string)
- func (f *RestClientFixture) SetConsensus(consensus config.ConsensusProtocols)
- func (f *RestClientFixture) Setup(t TestingTB, templateFile string)
- func (f *RestClientFixture) SetupNoStart(t TestingTB, templateFile string)
- func (f *RestClientFixture) SetupShared(testName string, templateFile string)
- func (f *RestClientFixture) VerifyBlockProposed(account string, searchRange int) (blockWasProposed bool)
- func (f *RestClientFixture) WaitForAllTxnsToConfirm(roundTimeout uint64, txidsAndAddresses map[string]string) bool
- func (f *RestClientFixture) WaitForConfirmedTxn(roundTimeout uint64, accountAddress, txid string) (txn v1.Transaction, 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, accountAddress, txid string) bool
- 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 ¶
This section is empty.
Types ¶
type AuctionBankKey ¶
type AuctionBankKey struct {
BankKey string
}
AuctionBankKey holds the auction bank's string key
type AuctionFixture ¶
type AuctionFixture struct { LibGoalFixture LibGoalFixture RestClientFixture // contains filtered or unexported fields }
AuctionFixture is a test fixture for testing Auctions
func (*AuctionFixture) AuctionBankRestClient ¶
func (f *AuctionFixture) AuctionBankRestClient(restURL *url.URL) auctionClient.BankRestClient
AuctionBankRestClient returns a Auction Bank Rest Client
func (*AuctionFixture) AuctionConsoleRestClient ¶
func (f *AuctionFixture) AuctionConsoleRestClient(restURL *url.URL) auctionClient.ConsoleRestClient
AuctionConsoleRestClient returns a Auction Console Rest Client
func (*AuctionFixture) CancelAuction ¶
func (f *AuctionFixture) CancelAuction() (stdout string, errorOutput string, err error)
CancelAuction cancels the current auction by invoking the auctionCancel script
func (*AuctionFixture) CompareAlgoAndBankAccounts ¶
func (f *AuctionFixture) CompareAlgoAndBankAccounts(userName string) (err error)
CompareAlgoAndBankAccounts logs some comparative information about a passed username
func (*AuctionFixture) ComputeCurrentPrice ¶
func (f *AuctionFixture) ComputeCurrentPrice(curRound, initialRound, numChunks, priceChunkRounds, lastPrice, maxPriceMultiple uint64) (price uint64, err error)
ComputeCurrentPrice is a utility function that mimic's the auction console's price calculation
func (*AuctionFixture) CrossVerifyEndOfAuction ¶
func (f *AuctionFixture) CrossVerifyEndOfAuction(params auction.Params, outcome auction.BidOutcomes, cancelled bool) (passed bool)
CrossVerifyEndOfAuction runs some comparisons on a given params and the assumed next params of the auction, as well as the auction's outcomes it returns true if all assertions pass
func (*AuctionFixture) EndAuction ¶
func (f *AuctionFixture) EndAuction() (stdout string, errorOutput string, err error)
EndAuction ends the current auction by invoking the auctionEnd script
func (*AuctionFixture) GetActualAuctionParams ¶
func (f *AuctionFixture) GetActualAuctionParams() (aip InitParams, err error)
GetActualAuctionParams reads in the actual auction params ${AUCTIONMASTERTESTDIR}/initparams.json
func (*AuctionFixture) GetAlgodRestClient ¶
func (f *AuctionFixture) GetAlgodRestClient() client.RestClient
GetAlgodRestClient gets a rest client pointing at the primary node
func (*AuctionFixture) GetAuctionBankKey ¶
func (f *AuctionFixture) GetAuctionBankKey() (abk string, err error)
GetAuctionBankKey reads the bank keyfile
func (*AuctionFixture) GetAuctionBankPid ¶
func (f *AuctionFixture) GetAuctionBankPid() (pid string, err error)
GetAuctionBankPid reads in the auction bank PID
func (*AuctionFixture) GetAuctionBankPort ¶
func (f *AuctionFixture) GetAuctionBankPort() (port string, err error)
GetAuctionBankPort reads in the auction bank port
func (*AuctionFixture) GetAuctionBankRestClient ¶
func (f *AuctionFixture) GetAuctionBankRestClient() auctionClient.BankRestClient
GetAuctionBankRestClient gets the auction bank rest client
func (*AuctionFixture) GetAuctionConsolePid ¶
func (f *AuctionFixture) GetAuctionConsolePid() (pid string, err error)
GetAuctionConsolePid reads in the auction console PID
func (*AuctionFixture) GetAuctionConsolePort ¶
func (f *AuctionFixture) GetAuctionConsolePort() (port string, err error)
GetAuctionConsolePort reads in the auction console port
func (*AuctionFixture) GetAuctionConsoleRestClient ¶
func (f *AuctionFixture) GetAuctionConsoleRestClient() auctionClient.ConsoleRestClient
GetAuctionConsoleRestClient returns the auction console rest client
func (*AuctionFixture) GetAuctionMasterPrivateKey ¶
func (f *AuctionFixture) GetAuctionMasterPrivateKey() (auctionMasterPrivateKey string, err error)
GetAuctionMasterPrivateKey reads in the master key file
func (*AuctionFixture) GetAuctionMasterPublicKey ¶
func (f *AuctionFixture) GetAuctionMasterPublicKey() (auctionKey string, err error)
GetAuctionMasterPublicKey returns the auction master public key from the file auctionMaster/master.pub
func (*AuctionFixture) GetAuctionMinionInitialState ¶
func (f *AuctionFixture) GetAuctionMinionInitialState() (ams AuctionMinionState, err error)
GetAuctionMinionInitialState reads in the auction minion state from the auction minion state file
func (*AuctionFixture) GetAuctionStartBroadcastMessage ¶
func (f *AuctionFixture) GetAuctionStartBroadcastMessage() (abs string, err error)
GetAuctionStartBroadcastMessage will read in the auction master start transaction
func (*AuctionFixture) GetAuctionTracker ¶
func (f *AuctionFixture) GetAuctionTracker() (auctionTracker *auction.Tracker, err error)
GetAuctionTracker creates and returns a singleton auction tracker instance for access to the auction status and runningAuction object
func (*AuctionFixture) GetCurrentPriceFromConsole ¶
func (f *AuctionFixture) GetCurrentPriceFromConsole(auction1 auction.RunningAuction) (price uint64, err error)
GetCurrentPriceFromConsole queries the auctionconsole current price
func (*AuctionFixture) GetDefaultWalletAndPassword ¶
func (f *AuctionFixture) GetDefaultWalletAndPassword() (walletHandel []byte, password string, err error)
GetDefaultWalletAndPassword is a convenience function to return the default wallet and password
func (*AuctionFixture) GetLastSettledID ¶
func (f *AuctionFixture) GetLastSettledID() (lastSettledID string, err error)
GetLastSettledID will get the last settled id
func (*AuctionFixture) GetLibGoalClient ¶
func (f *AuctionFixture) GetLibGoalClient() libgoal.Client
GetLibGoalClient gets a libgoal client pointing at the primary node
func (*AuctionFixture) GetPID ¶
func (f *AuctionFixture) GetPID(pidFile string) (pid uint64, err error)
GetPID returns the PID from the algod.pid file in the node's data directory, or an error
func (*AuctionFixture) GetPaymentTransactionBytesFromFile ¶
func (f *AuctionFixture) GetPaymentTransactionBytesFromFile(auctionID uint64) (paymentTransactionsBytes []byte, err error)
GetPaymentTransactionBytesFromFile will return the payment transaction blob for the given auction id
func (*AuctionFixture) GetPaymentTransactionStructureFromFile ¶
func (f *AuctionFixture) GetPaymentTransactionStructureFromFile(auctionID string) (paymentTransactions []transactions.SignedTxn, err error)
GetPaymentTransactionStructureFromFile will return the payment transaction blob for the given auction id
func (*AuctionFixture) GetRunningAuction ¶
func (f *AuctionFixture) GetRunningAuction() (runningAuction *auction.RunningAuction, err error)
GetRunningAuction returns the running auction object, delegates to auction tracker
func (*AuctionFixture) GetSettlementTransactionBytesFromFile ¶
func (f *AuctionFixture) GetSettlementTransactionBytesFromFile(trxID uint64) (settleTxnBytes []byte, err error)
GetSettlementTransactionBytesFromFile will retrieve the Settlement Transaction from the auction#.settletx file for the given auction id
func (*AuctionFixture) GetSettlementTransactionStructureFromFile ¶
func (f *AuctionFixture) GetSettlementTransactionStructureFromFile(trxID string) (st transactions.SignedTxn, err error)
GetSettlementTransactionStructureFromFile will retrieve the Settlement Transaction from the auction#.settletx file for the given auction id
func (*AuctionFixture) GetStartTransactionFile ¶
func (f *AuctionFixture) GetStartTransactionFile(auctionID string) (startTransaction string, err error)
GetStartTransactionFile gets the start transaction file for given auction id
func (*AuctionFixture) MakeAndPostBidAndDeposit ¶
func (f *AuctionFixture) MakeAndPostBidAndDeposit(bidID, auctionID uint64, auctionKey, biddingAccount string, maxPricePerAlgo, currencySpentOnBid uint64) (txid string, transactionID string, err error)
MakeAndPostBidAndDeposit uses the default wallet to MakeAndPostBidAndDepositWithWallet
func (*AuctionFixture) MakeAndPostBidAndDepositWithWallet ¶
func (f *AuctionFixture) MakeAndPostBidAndDepositWithWallet(walletHandle []byte, password string, bidID, auctionID uint64, auctionKey, biddingAccount string, maxPricePerAlgo, currencySpentOnBid uint64) (txid string, transactionID string, err error)
MakeAndPostBidAndDepositWithWallet does everything from the "create a bank account if necessary" step to the "post the bid and deposit to blockchain" step
func (*AuctionFixture) MakeBankAccountIfNoneExists ¶
func (f *AuctionFixture) MakeBankAccountIfNoneExists(username string) (err error)
MakeBankAccountIfNoneExists checks if a given username is registered with the auctionbank, and makes the account if not registered
func (*AuctionFixture) MakeSignedBid ¶
func (f *AuctionFixture) MakeSignedBid(bidID uint64, auctionKey string, auctionID uint64, account string, maxPrice uint64, bidCurrency uint64) (signedBidNote []byte, err error)
MakeSignedBid calls MakeSignedBidWithWallet against the default wallet
func (*AuctionFixture) MakeSignedBidWithWallet ¶
func (f *AuctionFixture) MakeSignedBidWithWallet(walletHandle []byte, password string, bidID uint64, auctionKey string, auctionID uint64, account string, maxPrice uint64, bidCurrency uint64) (signedBidNote []byte, err error)
MakeSignedBidWithWallet constructs a bid and signs it
func (*AuctionFixture) MakeSignedDeposit ¶
func (f *AuctionFixture) MakeSignedDeposit(usernameWithBank, auctionKey, bidderKey string, auctionID, amountDeposited uint64) (signedDepositNote client.BytesBase64, err error)
MakeSignedDeposit constructs a signed deposit using the auction bank
func (*AuctionFixture) SettleAuctionBank ¶
func (f *AuctionFixture) SettleAuctionBank(auctionKey string, auctionID uint64) (err error)
SettleAuctionBank is a utility function to invoke SettleAuction on AuctionBank to finalize the processing of auctions
func (*AuctionFixture) Setup ¶
func (f *AuctionFixture) Setup(t TestingTB, templateFile string) (err error)
Setup is called to initialize the test fixture for the test(s), uses default ports for auction bank and console
func (*AuctionFixture) ShowGenesisFile ¶
func (f *AuctionFixture) ShowGenesisFile() (err error)
ShowGenesisFile logs the genesis file contents
func (*AuctionFixture) Shutdown ¶
func (f *AuctionFixture) Shutdown() (err error)
Shutdown implements the Fixture.Shutdown method
func (*AuctionFixture) StartAuction ¶
func (f *AuctionFixture) StartAuction(auctionParamFile string) (inputParams InitParams, consoleViewParams auction.Params, stdout string, errorOutput string, err error)
StartAuction starts auction with default auction master balance
func (*AuctionFixture) StartAuctionWithAuctionMasterBalance ¶
func (f *AuctionFixture) StartAuctionWithAuctionMasterBalance(auctionParamFile string, auctionMasterStartBalance uint64) (inputParams InitParams, consoleViewParams auction.Params, stdout string, errorOutput string, err error)
StartAuctionWithAuctionMasterBalance starts the auction with a given master balance
func (*AuctionFixture) Stop ¶
func (f *AuctionFixture) Stop(pidFile string) error
Stop determines the node's PID from its PID file and uses that to kill it.
func (*AuctionFixture) WaitForNextRound ¶
func (f *AuctionFixture) WaitForNextRound() (newAlgodStatus generatedV2.NodeStatusResponse, err error)
WaitForNextRound is a utility function to wait for next round
func (*AuctionFixture) WaitForNonZeroAuctionID ¶
func (f *AuctionFixture) WaitForNonZeroAuctionID() (lastAuctionID auctionClient.LastAuctionIDResponse, err error)
WaitForNonZeroAuctionID busy-waits for a non-zero auction ID to be seen by the auction console
type AuctionMinionState ¶
type AuctionMinionState struct { AuctionKey string AuctionID uint64 StartRound uint64 AlgodURL string AlgodToken string }
AuctionMinionState is the structure of the data stored in the auctionminion.state file
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 directroy
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) 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 InitParams ¶
InitParams is a reduced version of what appears in auctionmaster's initparams.json
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) ClientWaitForRound ¶
func (f *LibGoalFixture) ClientWaitForRound(client libgoal.Client, round uint64, waitTime time.Duration) error
ClientWaitForRound waits up to the specified amount of time for the network to reach or pass the specified round, on the specific client/node
func (*LibGoalFixture) ClientWaitForRoundWithTimeout ¶
func (f *LibGoalFixture) ClientWaitForRoundWithTimeout(client libgoal.Client, roundToWaitFor uint64) error
ClientWaitForRoundWithTimeout waits for a given round to be reached by the specific client/node. 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 (*LibGoalFixture) ConsensusParams ¶
func (f *LibGoalFixture) ConsensusParams(round uint64) (consensus config.ConsensusParams, err error)
ConsensusParams returns the consensus parameters for the protocol from the specified round
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) 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) 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)
Setup is called to initialize the test fixture for the test(s)
func (*LibGoalFixture) SetupNoStart ¶
func (f *LibGoalFixture) SetupNoStart(t TestingTB, templateFile string)
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)
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) WaitForRoundWithTimeout ¶
func (f *LibGoalFixture) 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.
type PaymentTransactionArray ¶
type PaymentTransactionArray struct {
// contains filtered or unexported fields
}
PaymentTransactionArray holds an array of signed txns
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) AccountListContainsAddress ¶
func (f *RestClientFixture) AccountListContainsAddress(searchList []v1.Account, address string) bool
AccountListContainsAddress searches the passed account list for the passed account address
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) ClientWaitForRound ¶
func (f *RestClientFixture) ClientWaitForRound(client client.RestClient, round uint64, waitTime time.Duration) error
ClientWaitForRound waits up to the specified amount of time for the network to reach or pass the specified round, on the specific client/node
func (*RestClientFixture) ClientWaitForRoundWithTimeout ¶
func (f *RestClientFixture) ClientWaitForRoundWithTimeout(client client.RestClient, roundToWaitFor uint64) error
ClientWaitForRoundWithTimeout waits for a given round to be reached by the specific client/node. 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) 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(nodeDataDir string) (accounts []v1.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 v1.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 []v1.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) (fundingTxid string)
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) (fundingTxid string)
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)
Setup is called to initialize the test fixture for the test(s)
func (*RestClientFixture) SetupNoStart ¶
func (f *RestClientFixture) SetupNoStart(t TestingTB, templateFile string)
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)
SetupShared is called to initialize the test fixture that will be used for multiple tests
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) 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) WaitForConfirmedTxn ¶
func (f *RestClientFixture) WaitForConfirmedTxn(roundTimeout uint64, accountAddress, txid string) (txn v1.Transaction, 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, accountAddress, 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
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, 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