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
372d13b8
Unverified
Commit
372d13b8
authored
Dec 03, 2023
by
Matthew Slipper
Committed by
GitHub
Dec 03, 2023
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #8410 from ethereum-optimism/feat/e2e-cleanups
op-e2e: Minor cleanups
parents
9216562e
d4ed6b06
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
52 additions
and
1 deletion
+52
-1
io.go
op-e2e/e2eutils/io.go
+47
-0
op_geth.go
op-e2e/op_geth.go
+5
-1
No files found.
op-e2e/e2eutils/io.go
0 → 100644
View file @
372d13b8
package
e2eutils
import
(
"fmt"
"os"
"strings"
"testing"
"unicode"
"unicode/utf8"
"github.com/stretchr/testify/require"
)
func
TempDir
(
t
*
testing
.
T
)
string
{
// Drop unusual characters (such as path separators or
// characters interacting with globs) from the directory name to
// avoid surprising os.MkdirTemp behavior.
// Taken from the t.TempDir() implementation in the standard library.
mapper
:=
func
(
r
rune
)
rune
{
if
r
<
utf8
.
RuneSelf
{
const
allowed
=
"!#$%&()+,-.=@^_{}~ "
if
'0'
<=
r
&&
r
<=
'9'
||
'a'
<=
r
&&
r
<=
'z'
||
'A'
<=
r
&&
r
<=
'Z'
{
return
r
}
if
strings
.
ContainsRune
(
allowed
,
r
)
{
return
r
}
}
else
if
unicode
.
IsLetter
(
r
)
||
unicode
.
IsNumber
(
r
)
{
return
r
}
return
-
1
}
dir
,
err
:=
os
.
MkdirTemp
(
""
,
strings
.
Map
(
mapper
,
fmt
.
Sprintf
(
"op-e2e-%s"
,
t
.
Name
())))
require
.
NoError
(
t
,
err
)
t
.
Cleanup
(
func
()
{
err
:=
os
.
RemoveAll
(
dir
)
if
err
!=
nil
{
t
.
Logf
(
"Error removing temp dir %s: %s"
,
dir
,
err
)
}
})
return
dir
}
op-e2e/op_geth.go
View file @
372d13b8
...
...
@@ -47,6 +47,7 @@ type OpGeth struct {
L1Head
eth
.
BlockInfo
L2Head
*
eth
.
ExecutionPayload
sequenceNum
uint64
lgr
log
.
Logger
}
func
NewOpGeth
(
t
*
testing
.
T
,
ctx
context
.
Context
,
cfg
*
SystemConfig
)
(
*
OpGeth
,
error
)
{
...
...
@@ -117,11 +118,14 @@ func NewOpGeth(t *testing.T, ctx context.Context, cfg *SystemConfig) (*OpGeth, e
L2ChainConfig
:
l2Genesis
.
Config
,
L1Head
:
eth
.
BlockToInfo
(
l1Block
),
L2Head
:
genesisPayload
,
lgr
:
logger
,
},
nil
}
func
(
d
*
OpGeth
)
Close
()
{
_
=
d
.
node
.
Close
()
if
err
:=
d
.
node
.
Close
();
err
!=
nil
{
d
.
lgr
.
Error
(
"error closing node"
,
"err"
,
err
)
}
d
.
l2Engine
.
Close
()
d
.
L2Client
.
Close
()
}
...
...
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