Skip to content

Commit

Permalink
Cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
skosito committed Feb 28, 2024
1 parent fb4b43f commit 6fbfea0
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 34 deletions.
58 changes: 29 additions & 29 deletions e2e/e2etests/e2etests.go
Original file line number Diff line number Diff line change
Expand Up @@ -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),
}
9 changes: 4 additions & 5 deletions e2e/runner/runner.go
Original file line number Diff line number Diff line change
Expand Up @@ -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,
}
}

Expand All @@ -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)
}

Expand Down

0 comments on commit 6fbfea0

Please sign in to comment.