Commit d45a046d authored by Matthew Slipper's avatar Matthew Slipper Committed by GitHub

op-e2e: Add timeouts to sequencer failover tests (#13224)

* op-e2e: Add timeouts to sequencer failover tests

These can sometimes never return, which leads to tests timing out in CI. This PR adds timeouts so we can get feedback faster.

* avoid capturing parent t in subtest
parent d68380f0
...@@ -4,6 +4,7 @@ import ( ...@@ -4,6 +4,7 @@ import (
"context" "context"
"sort" "sort"
"testing" "testing"
"time"
"github.com/ethereum/go-ethereum/common" "github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/rpc" "github.com/ethereum/go-ethereum/rpc"
...@@ -28,7 +29,8 @@ func TestSequencerFailover_SetupCluster(t *testing.T) { ...@@ -28,7 +29,8 @@ func TestSequencerFailover_SetupCluster(t *testing.T) {
// [Category: conductor rpc] // [Category: conductor rpc]
// In this test, we test all rpcs exposed by conductor. // In this test, we test all rpcs exposed by conductor.
func TestSequencerFailover_ConductorRPC(t *testing.T) { func TestSequencerFailover_ConductorRPC(t *testing.T) {
ctx := context.Background() ctx, cancel := context.WithTimeout(context.Background(), 2*time.Minute)
defer cancel()
sys, conductors, cleanup := setupSequencerFailoverTest(t) sys, conductors, cleanup := setupSequencerFailoverTest(t)
defer cleanup() defer cleanup()
...@@ -176,7 +178,8 @@ func TestSequencerFailover_ActiveSequencerDown(t *testing.T) { ...@@ -176,7 +178,8 @@ func TestSequencerFailover_ActiveSequencerDown(t *testing.T) {
sys, conductors, cleanup := setupSequencerFailoverTest(t) sys, conductors, cleanup := setupSequencerFailoverTest(t)
defer cleanup() defer cleanup()
ctx := context.Background() ctx, cancel := context.WithTimeout(context.Background(), 2*time.Minute)
defer cancel()
leaderId, leader := findLeader(t, conductors) leaderId, leader := findLeader(t, conductors)
err := sys.RollupNodes[leaderId].Stop(ctx) // Stop the current leader sequencer err := sys.RollupNodes[leaderId].Stop(ctx) // Stop the current leader sequencer
require.NoError(t, err) require.NoError(t, err)
...@@ -205,7 +208,8 @@ func TestSequencerFailover_DisasterRecovery_OverrideLeader(t *testing.T) { ...@@ -205,7 +208,8 @@ func TestSequencerFailover_DisasterRecovery_OverrideLeader(t *testing.T) {
defer cleanup() defer cleanup()
// randomly stop 2 nodes in the cluster to simulate a disaster. // randomly stop 2 nodes in the cluster to simulate a disaster.
ctx := context.Background() ctx, cancel := context.WithTimeout(context.Background(), 2*time.Minute)
defer cancel()
err := conductors[Sequencer1Name].service.Stop(ctx) err := conductors[Sequencer1Name].service.Stop(ctx)
require.NoError(t, err) require.NoError(t, err)
err = conductors[Sequencer2Name].service.Stop(ctx) err = conductors[Sequencer2Name].service.Stop(ctx)
......
...@@ -57,7 +57,7 @@ func testCustomGasToken(t *testing.T, allocType config.AllocType) { ...@@ -57,7 +57,7 @@ func testCustomGasToken(t *testing.T, allocType config.AllocType) {
uint8(18), uint8(18),
} }
setup := func() gasTokenTestOpts { setup := func(t *testing.T) gasTokenTestOpts {
cfg := e2esys.DefaultSystemConfig(t, e2esys.WithAllocType(allocType)) cfg := e2esys.DefaultSystemConfig(t, e2esys.WithAllocType(allocType))
offset := hexutil.Uint64(0) offset := hexutil.Uint64(0)
cfg.DeployConfig.L2GenesisRegolithTimeOffset = &offset cfg.DeployConfig.L2GenesisRegolithTimeOffset = &offset
...@@ -111,7 +111,7 @@ func testCustomGasToken(t *testing.T, allocType config.AllocType) { ...@@ -111,7 +111,7 @@ func testCustomGasToken(t *testing.T, allocType config.AllocType) {
t.Run("deposit", func(t *testing.T) { t.Run("deposit", func(t *testing.T) {
op_e2e.InitParallel(t) op_e2e.InitParallel(t)
gto := setup() gto := setup(t)
checkDeposit(t, gto, false) checkDeposit(t, gto, false)
setCustomGasToken(t, gto.cfg, gto.sys, gto.weth9Address) setCustomGasToken(t, gto.cfg, gto.sys, gto.weth9Address)
checkDeposit(t, gto, true) checkDeposit(t, gto, true)
...@@ -119,7 +119,7 @@ func testCustomGasToken(t *testing.T, allocType config.AllocType) { ...@@ -119,7 +119,7 @@ func testCustomGasToken(t *testing.T, allocType config.AllocType) {
t.Run("withdrawal", func(t *testing.T) { t.Run("withdrawal", func(t *testing.T) {
op_e2e.InitParallel(t) op_e2e.InitParallel(t)
gto := setup() gto := setup(t)
setCustomGasToken(t, gto.cfg, gto.sys, gto.weth9Address) setCustomGasToken(t, gto.cfg, gto.sys, gto.weth9Address)
checkDeposit(t, gto, true) checkDeposit(t, gto, true)
checkWithdrawal(t, gto) checkWithdrawal(t, gto)
...@@ -127,7 +127,7 @@ func testCustomGasToken(t *testing.T, allocType config.AllocType) { ...@@ -127,7 +127,7 @@ func testCustomGasToken(t *testing.T, allocType config.AllocType) {
t.Run("fee withdrawal", func(t *testing.T) { t.Run("fee withdrawal", func(t *testing.T) {
op_e2e.InitParallel(t) op_e2e.InitParallel(t)
gto := setup() gto := setup(t)
setCustomGasToken(t, gto.cfg, gto.sys, gto.weth9Address) setCustomGasToken(t, gto.cfg, gto.sys, gto.weth9Address)
checkDeposit(t, gto, true) checkDeposit(t, gto, true)
checkFeeWithdrawal(t, gto, true) checkFeeWithdrawal(t, gto, true)
...@@ -135,7 +135,7 @@ func testCustomGasToken(t *testing.T, allocType config.AllocType) { ...@@ -135,7 +135,7 @@ func testCustomGasToken(t *testing.T, allocType config.AllocType) {
t.Run("token name and symbol", func(t *testing.T) { t.Run("token name and symbol", func(t *testing.T) {
op_e2e.InitParallel(t) op_e2e.InitParallel(t)
gto := setup() gto := setup(t)
checkL1TokenNameAndSymbol(t, gto, gto.disabledExpectations) checkL1TokenNameAndSymbol(t, gto, gto.disabledExpectations)
checkL2TokenNameAndSymbol(t, gto, gto.disabledExpectations) checkL2TokenNameAndSymbol(t, gto, gto.disabledExpectations)
checkWETHTokenNameAndSymbol(t, gto, gto.disabledExpectations) checkWETHTokenNameAndSymbol(t, gto, gto.disabledExpectations)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment