diff --git a/e2e/e2etests/e2etests.go b/e2e/e2etests/e2etests.go index 0f92d155b9..e8320d8a72 100644 --- a/e2e/e2etests/e2etests.go +++ b/e2e/e2etests/e2etests.go @@ -43,33 +43,33 @@ const ( // AllE2ETests is an ordered list of all e2e tests var AllE2ETests = []runner.E2ETest{ - runner.NewE2ETest(TestContextUpgradeName, "tests sending ETH on ZEVM and check context data using ContextApp", "", TestContextUpgrade), - runner.NewE2ETest(TestDepositAndCallRefundName, "deposit ZRC20 into ZEVM and call a contract that reverts; should refund", "", TestDepositAndCallRefund), - runner.NewE2ETest(TestMultipleERC20DepositName, "deposit USDT ERC20 into ZEVM in multiple deposits", "", TestMultipleERC20Deposit), - runner.NewE2ETest(TestERC20WithdrawName, "withdraw ERC20 from ZEVM", "", TestERC20Withdraw), - runner.NewE2ETest(TestMultipleWithdrawsName, "withdraw ERC20 from ZEVM in multiple deposits", "", TestMultipleWithdraws), - runner.NewE2ETest(TestZetaWithdrawName, "withdraw ZETA from ZEVM to Ethereum", "", TestZetaWithdraw), - runner.NewE2ETest(TestZetaDepositName, "deposit ZETA from Ethereum to ZEVM", "", TestZetaDeposit), - runner.NewE2ETest(TestZetaWithdrawBTCRevertName, "sending ZETA from ZEVM to Bitcoin with a message that should revert cctxs", "", TestZetaWithdrawBTCRevert), - runner.NewE2ETest(TestMessagePassingName, "goerli->goerli message passing (sending ZETA only)", "", TestMessagePassing), - runner.NewE2ETest(TestZRC20SwapName, "swap ZRC20 USDT for ZRC20 ETH", "", TestZRC20Swap), - runner.NewE2ETest(TestBitcoinWithdrawName, "withdraw BTC from ZEVM", "", TestBitcoinWithdraw), - runner.NewE2ETest(TestCrosschainSwapName, "testing Bitcoin ERC20 cross-chain swap", "", TestCrosschainSwap), - runner.NewE2ETest(TestMessagePassingRevertFailName, "goerli->goerli message passing (revert fail)", "", TestMessagePassingRevertFail), - runner.NewE2ETest(TestMessagePassingRevertSuccessName, "goerli->goerli message passing (revert success)", "", TestMessagePassingRevertSuccess), - runner.NewE2ETest(TestPauseZRC20Name, "pausing ZRC20 on ZetaChain", "", TestPauseZRC20), - runner.NewE2ETest(TestERC20DepositAndCallRefundName, "deposit a non-gas ZRC20 into ZEVM and call a contract that reverts", "", TestERC20DepositAndCallRefund), - runner.NewE2ETest(TestUpdateBytecodeName, "update ZRC20 bytecode swap", "", TestUpdateBytecode), - runner.NewE2ETest(TestEtherDepositAndCallName, "deposit ZRC20 into ZEVM and call a contract", "", TestEtherDepositAndCall), - runner.NewE2ETest(TestDepositEtherLiquidityCapName, "deposit Ethers into ZEVM with a liquidity cap", "", TestDepositEtherLiquidityCap), - runner.NewE2ETest(TestMyTestName, "performing custom test", "", TestMyTest), - runner.NewE2ETest(TestERC20DepositName, "deposit ERC20 into ZEVM", "", TestERC20Deposit), - runner.NewE2ETest(TestEtherDepositName, "deposit Ether into ZEVM", "", TestEtherDeposit), - runner.NewE2ETest(TestEtherWithdrawName, "withdraw Ether from ZEVM", "", TestEtherWithdraw), - runner.NewE2ETest(TestBitcoinDepositName, "deposit Bitcoin into ZEVM", "", TestBitcoinDeposit), - runner.NewE2ETest(TestDonationEtherName, "donate Ether to the TSS", "", TestDonationEther), - runner.NewE2ETest(TestStressEtherWithdrawName, "stress test Ether withdrawal", "", TestStressEtherWithdraw), - runner.NewE2ETest(TestStressBTCWithdrawName, "stress test BTC withdrawal", "", TestStressBTCWithdraw), - runner.NewE2ETest(TestStressEtherDepositName, "stress test Ether deposit", "", TestStressEtherDeposit), - runner.NewE2ETest(TestStressBTCDepositName, "stress test BTC deposit", "", TestStressBTCDeposit), + runner.NewE2ETest(TestContextUpgradeName, "tests sending ETH on ZEVM and check context data using ContextApp", "", nil, TestContextUpgrade), + runner.NewE2ETest(TestDepositAndCallRefundName, "deposit ZRC20 into ZEVM and call a contract that reverts; should refund", "", nil, TestDepositAndCallRefund), + runner.NewE2ETest(TestMultipleERC20DepositName, "deposit USDT ERC20 into ZEVM in multiple deposits", "", nil, TestMultipleERC20Deposit), + runner.NewE2ETest(TestERC20WithdrawName, "withdraw ERC20 from ZEVM", "", nil, TestERC20Withdraw), + runner.NewE2ETest(TestMultipleWithdrawsName, "withdraw ERC20 from ZEVM in multiple deposits", "", nil, TestMultipleWithdraws), + runner.NewE2ETest(TestZetaWithdrawName, "withdraw ZETA from ZEVM to Ethereum", "", nil, TestZetaWithdraw), + runner.NewE2ETest(TestZetaDepositName, "deposit ZETA from Ethereum to ZEVM", "", nil, TestZetaDeposit), + runner.NewE2ETest(TestZetaWithdrawBTCRevertName, "sending ZETA from ZEVM to Bitcoin with a message that should revert cctxs", "", nil, TestZetaWithdrawBTCRevert), + runner.NewE2ETest(TestMessagePassingName, "goerli->goerli message passing (sending ZETA only)", "", nil, TestMessagePassing), + runner.NewE2ETest(TestZRC20SwapName, "swap ZRC20 USDT for ZRC20 ETH", "", nil, TestZRC20Swap), + runner.NewE2ETest(TestBitcoinWithdrawName, "withdraw BTC from ZEVM", "", nil, TestBitcoinWithdraw), + runner.NewE2ETest(TestCrosschainSwapName, "testing Bitcoin ERC20 cross-chain swap", "", nil, TestCrosschainSwap), + runner.NewE2ETest(TestMessagePassingRevertFailName, "goerli->goerli message passing (revert fail)", "", nil, TestMessagePassingRevertFail), + runner.NewE2ETest(TestMessagePassingRevertSuccessName, "goerli->goerli message passing (revert success)", "", nil, TestMessagePassingRevertSuccess), + runner.NewE2ETest(TestPauseZRC20Name, "pausing ZRC20 on ZetaChain", "", nil, TestPauseZRC20), + runner.NewE2ETest(TestERC20DepositAndCallRefundName, "deposit a non-gas ZRC20 into ZEVM and call a contract that reverts", "", nil, TestERC20DepositAndCallRefund), + runner.NewE2ETest(TestUpdateBytecodeName, "update ZRC20 bytecode swap", "", nil, TestUpdateBytecode), + runner.NewE2ETest(TestEtherDepositAndCallName, "deposit ZRC20 into ZEVM and call a contract", "", nil, TestEtherDepositAndCall), + runner.NewE2ETest(TestDepositEtherLiquidityCapName, "deposit Ethers into ZEVM with a liquidity cap", "", nil, TestDepositEtherLiquidityCap), + runner.NewE2ETest(TestMyTestName, "performing custom test", "", nil, TestMyTest), + runner.NewE2ETest(TestERC20DepositName, "deposit ERC20 into ZEVM", "", nil, TestERC20Deposit), + runner.NewE2ETest(TestEtherDepositName, "deposit Ether into ZEVM", "", nil, TestEtherDeposit), + runner.NewE2ETest(TestEtherWithdrawName, "withdraw Ether from ZEVM", "", nil, TestEtherWithdraw), + runner.NewE2ETest(TestBitcoinDepositName, "deposit Bitcoin into ZEVM", "", nil, TestBitcoinDeposit), + runner.NewE2ETest(TestDonationEtherName, "donate Ether to the TSS", "", nil, TestDonationEther), + runner.NewE2ETest(TestStressEtherWithdrawName, "stress test Ether withdrawal", "", nil, TestStressEtherWithdraw), + runner.NewE2ETest(TestStressBTCWithdrawName, "stress test BTC withdrawal", "", nil, TestStressBTCWithdraw), + runner.NewE2ETest(TestStressEtherDepositName, "stress test Ether deposit", "", nil, TestStressEtherDeposit), + runner.NewE2ETest(TestStressBTCDepositName, "stress test BTC deposit", "", nil, TestStressBTCDeposit), } diff --git a/e2e/runner/runner.go b/e2e/runner/runner.go index 32492ef643..f2630f433e 100644 --- a/e2e/runner/runner.go +++ b/e2e/runner/runner.go @@ -166,20 +166,20 @@ type E2ETestFunc func(*E2ERunner, []string) // E2ETest represents a E2E test with a name type E2ETest struct { Name string - Args []string // TODO: should args be here, probably there is a cleaner way + Args []string Description string ArgsDescription string E2ETest E2ETestFunc } // NewE2ETest creates a new instance of E2ETest with specified parameters. -func NewE2ETest(name, description, argsDescription string, e2eTestFunc E2ETestFunc) E2ETest { +func NewE2ETest(name, description, argsDescription string, args []string, e2eTestFunc E2ETestFunc) E2ETest { return E2ETest{ Name: name, Description: description, E2ETest: e2eTestFunc, ArgsDescription: argsDescription, - Args: []string{}, + Args: args, } } @@ -198,14 +198,13 @@ func (runner *E2ERunner) GetE2ETestsToRunByNameAndArgs(e2eTests []E2ETest, e2eTe if !found { return nil, fmt.Errorf("e2e test %s not found", testName) } - // clone the test to modify its Args without affecting the original e2eTestToRun := NewE2ETest( e2eTest.Name, e2eTest.Description, e2eTest.ArgsDescription, + args, e2eTest.E2ETest, ) - e2eTestToRun.Args = args testsToRun = append(testsToRun, e2eTestToRun) }