tests

package
v1.0.3 Latest Latest
Warning

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

Go to latest
Published: Mar 6, 2024 License: Apache-2.0 Imports: 49 Imported by: 0

README

Cluster Tests

To run cluster tests, ensure you have installed the necessary dependencies in INX.

Privtangle is used to build the L1 network for running the cluster tests. For more information about privtangle, please check privtangle.go.

After executing the cluster tool, the cluster tool will start wasp nodes for running the tests. The number of wasp nodes have been started depends on each tests. See Troubleshooting for the information of checking test logs.

INX

INX dependencies are necessary to run cluster tests. This includes

  • hornet (v2.0.0-rc.4) Use scripts under scripts folder to install.
  • inx-indexer (v1.0.0-rc.3)
  • inx-coordinator (v1.0.0-rc.3)
  • inx-faucet (v1.0.0-rc.1) Require git submodule update --init --recursive before building.

See privtangle.go you can get more information.

Troubleshooting

Sometimes hornet, wasp or inx may not be successfully terminated in the last run. Therefore the ports are still occupied. In this situation, timeout panic may happen (if you set the -timeout when executing go test), when privtangle is still waiting hornet's response of healthy. The message could be privtangle.go:527: HORNET Cluster: Waiting for all HORNET nodes to become healthy....

To solve the problem, simply using pkill to kill the previous instances.

pkill -9 "hornet|wasp|inx"

The logs of privtangle are stored in the temporary folder created by os.TempDir() which $TMPDIR in UNIX system. Go to $TMPDIR/privtangle, you can see the logs for different nodes. The exact location will be printed in log message if a privtangle is enabled.

An example print out is

wasp/tools/cluster/tests/privtangle.go:527: HORNET Cluster: Starting in baseDir=/var/folders/fj/99whzry17dxfk7hyv99md3740000gn/T/privtangle with basePort=16500, nodeCount=2 ...

Here baseDir is the location of logs.

So we can see the log files would be in the following file structure.

$TMPDIR
├── privtangle
│   └── ... (logs)
├── wasp-cluster
│   └── ... (logs)
└── ... (other folders for test logs)

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func EVMSigner added in v1.0.3

func EVMSigner() types.Signer

func NewEVMJSONRPClient added in v1.0.3

func NewEVMJSONRPClient(t *testing.T, chainID string, clu *cluster.Cluster, nodeIndex int) *ethclient.Client

Types

type ChainEnv added in v0.3.0

type ChainEnv struct {
	Clu   *cluster.Cluster
	Chain *cluster.Chain
	// contains filtered or unexported fields
}

func SetupWithChain added in v0.3.0

func SetupWithChain(t *testing.T, opt ...waspClusterOpts) *ChainEnv

func (*ChainEnv) DeploySolidityContract added in v1.0.3

func (e *ChainEnv) DeploySolidityContract(creator *ecdsa.PrivateKey, abiJSON string, bytecode []byte, args ...interface{}) (common.Address, abi.ABI)

DeploySolidityContract deploys a given solidity contract with a given private key, returns the create contract address it will send the EVM request to node #0, using the default EVM chainID, that can be changed if needed

func (*ChainEnv) DepositFunds added in v0.3.0

func (e *ChainEnv) DepositFunds(amount uint64, keyPair *cryptolib.KeyPair)

func (*ChainEnv) EVMJSONRPClient added in v1.0.3

func (e *ChainEnv) EVMJSONRPClient(nodeIndex int) *ethclient.Client

func (*ChainEnv) GetGasPriceEVM added in v1.0.3

func (e *ChainEnv) GetGasPriceEVM() *big.Int

func (*ChainEnv) GetNonceEVM added in v1.0.3

func (e *ChainEnv) GetNonceEVM(addr common.Address) uint64

func (*ChainEnv) NewChainClient added in v0.3.0

func (e *ChainEnv) NewChainClient() *chainclient.Client

func (*ChainEnv) TransferFundsTo added in v1.0.3

func (e *ChainEnv) TransferFundsTo(assets *isc.Assets, nft *isc.NFT, keyPair *cryptolib.KeyPair, targetAccount isc.AgentID)

type WaspCLITest

type WaspCLITest struct {
	T       *testing.T
	Cluster *cluster.Cluster

	WaspCliAddress iotago.Address
	// contains filtered or unexported fields
}

func (*WaspCLITest) ActivateChainOnAllNodes added in v1.0.3

func (w *WaspCLITest) ActivateChainOnAllNodes(chainName string, skipOnNodes ...int)

TODO there is a small issue if we try to activate the chain twice (deploy command also activates the chain) if this happens, the node will return an error on `getChainInfo` because there is no state yet. as a temporary fix, we add `skipOnNodes`, so to not run the activate command on that node

func (*WaspCLITest) Address

func (w *WaspCLITest) Address() iotago.Address

func (*WaspCLITest) ArgAllNodesExcept added in v1.0.3

func (w *WaspCLITest) ArgAllNodesExcept(idx int) string

func (*WaspCLITest) ArgCommitteeConfig added in v1.0.3

func (w *WaspCLITest) ArgCommitteeConfig(initiatorIndex int) (string, string)

func (*WaspCLITest) ChainID added in v1.0.3

func (w *WaspCLITest) ChainID(idx int) string

func (*WaspCLITest) CopyFile

func (w *WaspCLITest) CopyFile(srcFile string)

CopyFile copies the given file into the temp directory

func (*WaspCLITest) CreateL2Foundry added in v1.0.3

func (w *WaspCLITest) CreateL2Foundry(tokenScheme iotago.TokenScheme)

func (*WaspCLITest) GetReceiptFromRunPostRequestOutput added in v0.3.0

func (w *WaspCLITest) GetReceiptFromRunPostRequestOutput(out []string) []string

func (*WaspCLITest) MustPipe added in v1.0.3

func (w *WaspCLITest) MustPipe(in []string, args ...string) []string

func (*WaspCLITest) MustRun added in v1.0.3

func (w *WaspCLITest) MustRun(args ...string) []string

func (*WaspCLITest) Pipe

func (w *WaspCLITest) Pipe(in []string, args ...string) ([]string, error)

func (*WaspCLITest) PostRequestGetReceipt added in v0.3.0

func (w *WaspCLITest) PostRequestGetReceipt(args ...string) []string

func (*WaspCLITest) Run

func (w *WaspCLITest) Run(args ...string) ([]string, error)

Jump to

Keyboard shortcuts

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