Documentation ¶
Index ¶
- Constants
- func AcquireMultiTestSuitesLock(t *testing.T) (releaser func())
- func NewTestAccount(t *testing.T, nilAblePrivKey *ethsecp256k1.PrivKey) *itutiltypes.TestAccount
- type DatabaseIntegrationTestSuite
- func (suite *DatabaseIntegrationTestSuite) CleanupSuite()
- func (suite *DatabaseIntegrationTestSuite) CountRows(tableName string) int
- func (suite *DatabaseIntegrationTestSuite) CreateTransaction() *sql.Tx
- func (suite *DatabaseIntegrationTestSuite) ReadAccountRecord(chainId, bech32Address string, optionalTx *sql.Tx) itutildbtypes.AccountRecord
- func (suite *DatabaseIntegrationTestSuite) ReadChainInfoRecord(chainId string, optionalTx *sql.Tx) itutildbtypes.ChainInfoRecord
- func (suite *DatabaseIntegrationTestSuite) ReadFailedBlockRecord(chainId string, height int64, optionalTx *sql.Tx) itutildbtypes.FailedBlockRecord
- func (suite *DatabaseIntegrationTestSuite) ReadRecentAccountTransactionRecord(hash string, height int64, chainId string, optionalTx *sql.Tx) itutildbtypes.RecentAccountTransactionRecord
- func (suite *DatabaseIntegrationTestSuite) ReadReducedRefCountRecentAccountTransactionRecord(hash string, height int64, chainId string, optionalTx *sql.Tx) itutildbtypes.ReducedRefCountRecentAccountTransactionRecord
- func (suite *DatabaseIntegrationTestSuite) ReadRefAccountToRecentTxRecord(bech32Address, hash string, height int64, chainId string, optionalTx *sql.Tx) itutildbtypes.RefAccountToRecentTxRecord
- func (suite *DatabaseIntegrationTestSuite) ReadTransactionRecord(hash string, height int64, chainId string, optionalTx *sql.Tx) itutildbtypes.TransactionRecord
- func (suite *DatabaseIntegrationTestSuite) Require() *require.Assertions
- func (suite *DatabaseIntegrationTestSuite) T() *testing.T
- func (suite *DatabaseIntegrationTestSuite) Truncate(tableName string)
- func (suite *DatabaseIntegrationTestSuite) TruncateAll()
Constants ¶
const ( IT_VAL_1_MNEMONIC = "" /* 141-byte string literal not displayed */ IT_VAL_2_MNEMONIC = "" /* 162-byte string literal not displayed */ IT_VAL_3_MNEMONIC = "" /* 148-byte string literal not displayed */ IT_VAL_4_MNEMONIC = "" /* 160-byte string literal not displayed */ IT_VAL_5_MNEMONIC = "" /* 149-byte string literal not displayed */ )
const ( IT_WAL_1_ETH_ADDR = "0x89760f514DCfCCCf1E4c5eDC6Bf6041931c4c183" IT_WAL_1_MNEMONIC = "" /* 147-byte string literal not displayed */ IT_WAL_2_ETH_ADDR = "0x21b661c8A270ed83D2826aD49b1E3B78F515E25C" IT_WAL_2_MNEMONIC = "" /* 151-byte string literal not displayed */ IT_WAL_3_ETH_ADDR = "0x6479D25261A74B1b058778d3F69Ad7cC557341A8" IT_WAL_3_MNEMONIC = "" /* 155-byte string literal not displayed */ IT_WAL_4_ETH_ADDR = "0x141B22B20ead6d6AE93B9DBBeB7b50DC3A645F41" IT_WAL_4_MNEMONIC = "" /* 153-byte string literal not displayed */ IT_WAL_5_ETH_ADDR = "0x3E958191BC1AB01939DAD36e91630Ad111F60f10" IT_WAL_5_MNEMONIC = "" /* 163-byte string literal not displayed */ )
Variables ¶
This section is empty.
Functions ¶
func AcquireMultiTestSuitesLock ¶
AcquireMultiTestSuitesLock prevents multiple test suites from running at the same time. It returns a function that must be called at the end of the test suite to release the lock.
Use case: generally used when multiple test suites are running in parallel and accessing the same resources that couldn't be shared. So we need this test suite lock to prevent multiple test suites from running at the same time.
func NewTestAccount ¶
func NewTestAccount(t *testing.T, nilAblePrivKey *ethsecp256k1.PrivKey) *itutiltypes.TestAccount
NewTestAccount creates a new test account. If the private key is not provided, a new one will be generated.
Types ¶
type DatabaseIntegrationTestSuite ¶
type DatabaseIntegrationTestSuite struct { Database *sql.DB Chains itutiltypes.TestChains ValidatorAccounts itutiltypes.TestAccounts WalletAccounts itutiltypes.TestAccounts // contains filtered or unexported fields }
DatabaseIntegrationTestSuite is a helper for Database integration test.
func NewDatabaseIntegrationTestSuite ¶
func NewDatabaseIntegrationTestSuite( t *testing.T, r *require.Assertions, ) *DatabaseIntegrationTestSuite
NewDatabaseIntegrationTestSuite creates a new database integration test suite with default configuration
func (*DatabaseIntegrationTestSuite) CleanupSuite ¶
func (suite *DatabaseIntegrationTestSuite) CleanupSuite()
CleanupSuite performs some cleaning tasks upon shutting down of test suite.
func (*DatabaseIntegrationTestSuite) CountRows ¶
func (suite *DatabaseIntegrationTestSuite) CountRows(tableName string) int
CountRows returns the number of rows of the given table. Beware of commit state while working with database transaction.
func (*DatabaseIntegrationTestSuite) CreateTransaction ¶
func (suite *DatabaseIntegrationTestSuite) CreateTransaction() *sql.Tx
CreateTransaction begins a new database-level transaction.
func (*DatabaseIntegrationTestSuite) ReadAccountRecord ¶
func (suite *DatabaseIntegrationTestSuite) ReadAccountRecord(chainId, bech32Address string, optionalTx *sql.Tx) itutildbtypes.AccountRecord
ReadAccountRecord reads a specific account record from `account` table in database.
func (*DatabaseIntegrationTestSuite) ReadChainInfoRecord ¶
func (suite *DatabaseIntegrationTestSuite) ReadChainInfoRecord(chainId string, optionalTx *sql.Tx) itutildbtypes.ChainInfoRecord
ReadChainInfoRecord reads a specific chain info record from `chain_info` table in database.
func (*DatabaseIntegrationTestSuite) ReadFailedBlockRecord ¶
func (suite *DatabaseIntegrationTestSuite) ReadFailedBlockRecord(chainId string, height int64, optionalTx *sql.Tx) itutildbtypes.FailedBlockRecord
ReadFailedBlockRecord reads a specific failed block record from `failed_block` table in database.
func (*DatabaseIntegrationTestSuite) ReadRecentAccountTransactionRecord ¶
func (suite *DatabaseIntegrationTestSuite) ReadRecentAccountTransactionRecord(hash string, height int64, chainId string, optionalTx *sql.Tx) itutildbtypes.RecentAccountTransactionRecord
ReadRecentAccountTransactionRecord reads a specific transaction record from `recent_account_transaction` table in database.
func (*DatabaseIntegrationTestSuite) ReadReducedRefCountRecentAccountTransactionRecord ¶
func (suite *DatabaseIntegrationTestSuite) ReadReducedRefCountRecentAccountTransactionRecord(hash string, height int64, chainId string, optionalTx *sql.Tx) itutildbtypes.ReducedRefCountRecentAccountTransactionRecord
ReadReducedRefCountRecentAccountTransactionRecord reads a specific transaction record from `reduced_ref_count_recent_account_transaction` table in database.
func (*DatabaseIntegrationTestSuite) ReadRefAccountToRecentTxRecord ¶
func (suite *DatabaseIntegrationTestSuite) ReadRefAccountToRecentTxRecord(bech32Address, hash string, height int64, chainId string, optionalTx *sql.Tx) itutildbtypes.RefAccountToRecentTxRecord
ReadRefAccountToRecentTxRecord reads a specific ref account to recent tx record from `ref_account_to_recent_tx` table in database.
func (*DatabaseIntegrationTestSuite) ReadTransactionRecord ¶
func (suite *DatabaseIntegrationTestSuite) ReadTransactionRecord(hash string, height int64, chainId string, optionalTx *sql.Tx) itutildbtypes.TransactionRecord
ReadTransactionRecord reads a specific transaction record from `transaction` table in database.
func (*DatabaseIntegrationTestSuite) Require ¶
func (suite *DatabaseIntegrationTestSuite) Require() *require.Assertions
func (*DatabaseIntegrationTestSuite) T ¶
func (suite *DatabaseIntegrationTestSuite) T() *testing.T
func (*DatabaseIntegrationTestSuite) Truncate ¶
func (suite *DatabaseIntegrationTestSuite) Truncate(tableName string)
Truncate does remove all existing records of a given table.
func (*DatabaseIntegrationTestSuite) TruncateAll ¶
func (suite *DatabaseIntegrationTestSuite) TruncateAll()
TruncateAll does remove all existing records of all tables.