Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
N
nebula
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
exchain
nebula
Commits
656a4bd0
Unverified
Commit
656a4bd0
authored
Jun 05, 2024
by
Brian Bland
Committed by
GitHub
Jun 06, 2024
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
op-e2e: Improve timeout behavior for sequencer failover tests (#10737)
parent
f26859bc
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
15 additions
and
13 deletions
+15
-13
sequencer_failover_setup.go
op-e2e/sequencer_failover_setup.go
+15
-13
No files found.
op-e2e/sequencer_failover_setup.go
View file @
656a4bd0
...
@@ -356,30 +356,32 @@ func sequencerCfg(rpcPort int) *rollupNode.Config {
...
@@ -356,30 +356,32 @@ func sequencerCfg(rpcPort int) *rollupNode.Config {
}
}
func
waitForLeadership
(
t
*
testing
.
T
,
c
*
conductor
)
error
{
func
waitForLeadership
(
t
*
testing
.
T
,
c
*
conductor
)
error
{
ctx
,
cancel
:=
context
.
WithTimeout
(
context
.
Background
(),
30
*
time
.
Second
)
defer
cancel
()
condition
:=
func
()
(
bool
,
error
)
{
condition
:=
func
()
(
bool
,
error
)
{
isLeader
,
err
:=
c
.
client
.
Leader
(
c
ontext
.
Background
()
)
isLeader
,
err
:=
c
.
client
.
Leader
(
c
tx
)
if
err
!=
nil
{
if
err
!=
nil
{
return
false
,
err
return
false
,
err
}
}
return
isLeader
,
nil
return
isLeader
,
nil
}
}
ctx
,
cancel
:=
context
.
WithTimeout
(
context
.
Background
(),
30
*
time
.
Second
)
defer
cancel
()
return
wait
.
For
(
ctx
,
1
*
time
.
Second
,
condition
)
return
wait
.
For
(
ctx
,
1
*
time
.
Second
,
condition
)
}
}
func
waitForLeadershipChange
(
t
*
testing
.
T
,
prev
*
conductor
,
prevID
string
,
conductors
map
[
string
]
*
conductor
,
sys
*
System
)
string
{
func
waitForLeadershipChange
(
t
*
testing
.
T
,
prev
*
conductor
,
prevID
string
,
conductors
map
[
string
]
*
conductor
,
sys
*
System
)
string
{
ctx
,
cancel
:=
context
.
WithTimeout
(
context
.
Background
(),
30
*
time
.
Second
)
defer
cancel
()
condition
:=
func
()
(
bool
,
error
)
{
condition
:=
func
()
(
bool
,
error
)
{
isLeader
,
err
:=
prev
.
client
.
Leader
(
c
ontext
.
Background
()
)
isLeader
,
err
:=
prev
.
client
.
Leader
(
c
tx
)
if
err
!=
nil
{
if
err
!=
nil
{
return
false
,
err
return
false
,
err
}
}
return
!
isLeader
,
nil
return
!
isLeader
,
nil
}
}
ctx
,
cancel
:=
context
.
WithTimeout
(
context
.
Background
(),
30
*
time
.
Second
)
defer
cancel
()
err
:=
wait
.
For
(
ctx
,
1
*
time
.
Second
,
condition
)
err
:=
wait
.
For
(
ctx
,
1
*
time
.
Second
,
condition
)
require
.
NoError
(
t
,
err
)
require
.
NoError
(
t
,
err
)
...
@@ -394,16 +396,17 @@ func waitForLeadershipChange(t *testing.T, prev *conductor, prevID string, condu
...
@@ -394,16 +396,17 @@ func waitForLeadershipChange(t *testing.T, prev *conductor, prevID string, condu
}
}
func
waitForSequencerStatusChange
(
t
*
testing
.
T
,
rollupClient
*
sources
.
RollupClient
,
active
bool
)
error
{
func
waitForSequencerStatusChange
(
t
*
testing
.
T
,
rollupClient
*
sources
.
RollupClient
,
active
bool
)
error
{
ctx
,
cancel
:=
context
.
WithTimeout
(
context
.
Background
(),
30
*
time
.
Second
)
defer
cancel
()
condition
:=
func
()
(
bool
,
error
)
{
condition
:=
func
()
(
bool
,
error
)
{
isActive
,
err
:=
rollupClient
.
SequencerActive
(
c
ontext
.
Background
()
)
isActive
,
err
:=
rollupClient
.
SequencerActive
(
c
tx
)
if
err
!=
nil
{
if
err
!=
nil
{
return
false
,
err
return
false
,
err
}
}
return
isActive
==
active
,
nil
return
isActive
==
active
,
nil
}
}
ctx
,
cancel
:=
context
.
WithTimeout
(
context
.
Background
(),
30
*
time
.
Second
)
defer
cancel
()
return
wait
.
For
(
ctx
,
1
*
time
.
Second
,
condition
)
return
wait
.
For
(
ctx
,
1
*
time
.
Second
,
condition
)
}
}
...
@@ -482,9 +485,11 @@ func findFollower(t *testing.T, conductors map[string]*conductor) (string, *cond
...
@@ -482,9 +485,11 @@ func findFollower(t *testing.T, conductors map[string]*conductor) (string, *cond
}
}
func
ensureOnlyOneLeader
(
t
*
testing
.
T
,
sys
*
System
,
conductors
map
[
string
]
*
conductor
)
{
func
ensureOnlyOneLeader
(
t
*
testing
.
T
,
sys
*
System
,
conductors
map
[
string
]
*
conductor
)
{
ctx
,
cancel
:=
context
.
WithTimeout
(
context
.
Background
(),
30
*
time
.
Second
)
defer
cancel
()
condition
:=
func
()
(
bool
,
error
)
{
condition
:=
func
()
(
bool
,
error
)
{
leaders
:=
0
leaders
:=
0
ctx
:=
context
.
Background
()
for
name
,
con
:=
range
conductors
{
for
name
,
con
:=
range
conductors
{
leader
,
err
:=
con
.
client
.
Leader
(
ctx
)
leader
,
err
:=
con
.
client
.
Leader
(
ctx
)
if
err
!=
nil
{
if
err
!=
nil
{
...
@@ -501,8 +506,5 @@ func ensureOnlyOneLeader(t *testing.T, sys *System, conductors map[string]*condu
...
@@ -501,8 +506,5 @@ func ensureOnlyOneLeader(t *testing.T, sys *System, conductors map[string]*condu
}
}
return
leaders
==
1
,
nil
return
leaders
==
1
,
nil
}
}
ctx
,
cancel
:=
context
.
WithTimeout
(
context
.
Background
(),
30
*
time
.
Second
)
defer
cancel
()
require
.
NoError
(
t
,
wait
.
For
(
ctx
,
1
*
time
.
Second
,
condition
))
require
.
NoError
(
t
,
wait
.
For
(
ctx
,
1
*
time
.
Second
,
condition
))
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment