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
9d6a8ccb
Unverified
Commit
9d6a8ccb
authored
Aug 24, 2023
by
Adrian Sutton
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
op-e2e: Wait for game data to be deleted
Fixes a race condition which could cause flaky e2e tests.
parent
589b00ab
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
26 additions
and
6 deletions
+26
-6
helper.go
op-e2e/e2eutils/challenger/helper.go
+25
-5
faultproof_test.go
op-e2e/faultproof_test.go
+1
-1
No files found.
op-e2e/e2eutils/challenger/helper.go
View file @
9d6a8ccb
...
...
@@ -5,6 +5,7 @@ import (
"crypto/ecdsa"
"encoding/json"
"errors"
"fmt"
"os"
"path/filepath"
"testing"
...
...
@@ -13,6 +14,7 @@ import (
op_challenger
"github.com/ethereum-optimism/optimism/op-challenger"
"github.com/ethereum-optimism/optimism/op-challenger/config"
"github.com/ethereum-optimism/optimism/op-e2e/e2eutils"
"github.com/ethereum-optimism/optimism/op-e2e/e2eutils/wait"
"github.com/ethereum-optimism/optimism/op-node/rollup"
"github.com/ethereum-optimism/optimism/op-node/testlog"
"github.com/ethereum-optimism/optimism/op-service/txmgr"
...
...
@@ -24,6 +26,7 @@ import (
type
Helper
struct
{
log
log
.
Logger
t
*
testing
.
T
require
*
require
.
Assertions
dir
string
cancel
func
()
...
...
@@ -108,6 +111,7 @@ func NewChallenger(t *testing.T, ctx context.Context, l1Endpoint string, name st
}()
return
&
Helper
{
log
:
log
,
t
:
t
,
require
:
require
.
New
(
t
),
dir
:
cfg
.
Datadir
,
cancel
:
cancel
,
...
...
@@ -171,11 +175,27 @@ func (h *Helper) VerifyGameDataExists(games ...GameAddr) {
}
}
func
(
h
*
Helper
)
VerifyNoGameDataExists
(
games
...
GameAddr
)
{
for
_
,
game
:=
range
games
{
addr
:=
game
.
Addr
()
h
.
require
.
NoDirExistsf
(
h
.
gameDataDir
(
addr
),
"should have data for game %v"
,
addr
)
}
func
(
h
*
Helper
)
WaitForGameDataDeletion
(
ctx
context
.
Context
,
games
...
GameAddr
)
{
ctx
,
cancel
:=
context
.
WithTimeout
(
ctx
,
30
*
time
.
Second
)
defer
cancel
()
err
:=
wait
.
For
(
ctx
,
time
.
Second
,
func
()
(
bool
,
error
)
{
for
_
,
game
:=
range
games
{
addr
:=
game
.
Addr
()
dir
:=
h
.
gameDataDir
(
addr
)
_
,
err
:=
os
.
Stat
(
dir
)
if
errors
.
Is
(
err
,
os
.
ErrNotExist
)
{
// This game has been successfully deleted
continue
}
if
err
!=
nil
{
return
false
,
fmt
.
Errorf
(
"failed to check dir %v is deleted: %w"
,
dir
,
err
)
}
h
.
t
.
Errorf
(
"Game data directory %v not yet deleted"
,
dir
)
return
false
,
nil
}
return
true
,
nil
})
h
.
require
.
NoErrorf
(
err
,
"should have deleted game data directories"
)
}
func
(
h
*
Helper
)
gameDataDir
(
addr
common
.
Address
)
string
{
...
...
op-e2e/faultproof_test.go
View file @
9d6a8ccb
...
...
@@ -102,7 +102,7 @@ func TestMultipleCannonGames(t *testing.T) {
game2
.
WaitForGameStatus
(
ctx
,
disputegame
.
StatusChallengerWins
)
// Check that the game directories are removed
challenger
.
VerifyNoGameDataExists
(
game1
,
game2
)
challenger
.
WaitForGameDataDeletion
(
ctx
,
game1
,
game2
)
}
func
TestResolveDisputeGame
(
t
*
testing
.
T
)
{
...
...
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