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
e57ad63a
Unverified
Commit
e57ad63a
authored
Dec 20, 2023
by
Hamdi Allam
Committed by
GitHub
Dec 20, 2023
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
parallel tests (#8695)
parent
b9d7c68f
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
19 additions
and
30 deletions
+19
-30
setup.go
indexer/e2e_tests/setup.go
+19
-30
No files found.
indexer/e2e_tests/setup.go
View file @
e57ad63a
...
@@ -57,6 +57,12 @@ func createE2ETestSuite(t *testing.T) E2ETestSuite {
...
@@ -57,6 +57,12 @@ func createE2ETestSuite(t *testing.T) E2ETestSuite {
dbUser
:=
os
.
Getenv
(
"DB_USER"
)
dbUser
:=
os
.
Getenv
(
"DB_USER"
)
dbName
:=
setupTestDatabase
(
t
)
dbName
:=
setupTestDatabase
(
t
)
// E2E tests can run on the order of magnitude of minutes. Once
// the system is running, mark this test for Parallel execution.
// We mark the test as parallel before starting the devnet to
// reduce that number of idle routines when paused.
t
.
Parallel
()
// Rollup System Configuration. Unless specified,
// Rollup System Configuration. Unless specified,
// omit logs emitted by the various components. Maybe
// omit logs emitted by the various components. Maybe
// we can eventually dump these logs to a temp file
// we can eventually dump these logs to a temp file
...
@@ -64,9 +70,11 @@ func createE2ETestSuite(t *testing.T) E2ETestSuite {
...
@@ -64,9 +70,11 @@ func createE2ETestSuite(t *testing.T) E2ETestSuite {
opCfg
:=
op_e2e
.
DefaultSystemConfig
(
t
)
opCfg
:=
op_e2e
.
DefaultSystemConfig
(
t
)
if
len
(
os
.
Getenv
(
"ENABLE_ROLLUP_LOGS"
))
==
0
{
if
len
(
os
.
Getenv
(
"ENABLE_ROLLUP_LOGS"
))
==
0
{
t
.
Log
(
"set env 'ENABLE_ROLLUP_LOGS' to show rollup logs"
)
t
.
Log
(
"set env 'ENABLE_ROLLUP_LOGS' to show rollup logs"
)
for
name
,
logger
:=
range
opCfg
.
Loggers
{
for
name
:=
range
opCfg
.
Loggers
{
t
.
Logf
(
"discarding logs for %s"
,
name
)
t
.
Logf
(
"discarding logs for %s"
,
name
)
logger
.
SetHandler
(
log
.
DiscardHandler
())
noopLog
:=
log
.
New
()
noopLog
.
SetHandler
(
log
.
DiscardHandler
())
opCfg
.
Loggers
[
name
]
=
noopLog
}
}
}
}
...
@@ -77,12 +85,7 @@ func createE2ETestSuite(t *testing.T) E2ETestSuite {
...
@@ -77,12 +85,7 @@ func createE2ETestSuite(t *testing.T) E2ETestSuite {
// Indexer Configuration and Start
// Indexer Configuration and Start
indexerCfg
:=
&
config
.
Config
{
indexerCfg
:=
&
config
.
Config
{
DB
:
config
.
DBConfig
{
DB
:
config
.
DBConfig
{
Host
:
"127.0.0.1"
,
Port
:
5432
,
Name
:
dbName
,
User
:
dbUser
},
Host
:
"127.0.0.1"
,
Port
:
5432
,
Name
:
dbName
,
User
:
dbUser
,
},
RPCs
:
config
.
RPCsConfig
{
RPCs
:
config
.
RPCsConfig
{
L1RPC
:
opSys
.
EthInstances
[
"l1"
]
.
HTTPEndpoint
(),
L1RPC
:
opSys
.
EthInstances
[
"l1"
]
.
HTTPEndpoint
(),
L2RPC
:
opSys
.
EthInstances
[
"sequencer"
]
.
HTTPEndpoint
(),
L2RPC
:
opSys
.
EthInstances
[
"sequencer"
]
.
HTTPEndpoint
(),
...
@@ -105,10 +108,6 @@ func createE2ETestSuite(t *testing.T) E2ETestSuite {
...
@@ -105,10 +108,6 @@ func createE2ETestSuite(t *testing.T) E2ETestSuite {
MetricsServer
:
config
.
ServerConfig
{
Host
:
"127.0.0.1"
,
Port
:
0
},
MetricsServer
:
config
.
ServerConfig
{
Host
:
"127.0.0.1"
,
Port
:
0
},
}
}
// E2E tests can run on the order of magnitude of minutes. Once
// the system is running, mark this test for Parallel execution
t
.
Parallel
()
indexerLog
:=
testlog
.
Logger
(
t
,
log
.
LvlInfo
)
.
New
(
"role"
,
"indexer"
)
indexerLog
:=
testlog
.
Logger
(
t
,
log
.
LvlInfo
)
.
New
(
"role"
,
"indexer"
)
ix
,
err
:=
indexer
.
NewIndexer
(
context
.
Background
(),
indexerLog
,
indexerCfg
,
func
(
cause
error
)
{
ix
,
err
:=
indexer
.
NewIndexer
(
context
.
Background
(),
indexerLog
,
indexerCfg
,
func
(
cause
error
)
{
if
cause
!=
nil
{
if
cause
!=
nil
{
...
@@ -116,25 +115,18 @@ func createE2ETestSuite(t *testing.T) E2ETestSuite {
...
@@ -116,25 +115,18 @@ func createE2ETestSuite(t *testing.T) E2ETestSuite {
}
}
})
})
require
.
NoError
(
t
,
err
)
require
.
NoError
(
t
,
err
)
require
.
NoError
(
t
,
ix
.
Start
(
context
.
Background
()),
"cleanly start indexer"
)
require
.
NoError
(
t
,
ix
.
Start
(
context
.
Background
()),
"cleanly start indexer"
)
t
.
Cleanup
(
func
()
{
t
.
Cleanup
(
func
()
{
require
.
NoError
(
t
,
ix
.
Stop
(
context
.
Background
()),
"cleanly shut down indexer"
)
require
.
NoError
(
t
,
ix
.
Stop
(
context
.
Background
()),
"cleanly shut down indexer"
)
})
})
// API Configuration and Start
apiLog
:=
testlog
.
Logger
(
t
,
log
.
LvlInfo
)
.
New
(
"role"
,
"indexer_api"
)
apiLog
:=
testlog
.
Logger
(
t
,
log
.
LvlInfo
)
.
New
(
"role"
,
"indexer_api"
)
apiCfg
:=
&
api
.
Config
{
apiCfg
:=
&
api
.
Config
{
DB
:
&
api
.
TestDBConnector
{
BridgeTransfers
:
ix
.
DB
.
BridgeTransfers
},
// reuse the same DB
DB
:
&
api
.
TestDBConnector
{
BridgeTransfers
:
ix
.
DB
.
BridgeTransfers
},
// reuse the same DB
HTTPServer
:
config
.
ServerConfig
{
HTTPServer
:
config
.
ServerConfig
{
Host
:
"127.0.0.1"
,
Port
:
0
},
Host
:
"127.0.0.1"
,
MetricsServer
:
config
.
ServerConfig
{
Host
:
"127.0.0.1"
,
Port
:
0
},
Port
:
0
,
},
MetricsServer
:
config
.
ServerConfig
{
Host
:
"127.0.0.1"
,
Port
:
0
,
},
}
}
apiService
,
err
:=
api
.
NewApi
(
context
.
Background
(),
apiLog
,
apiCfg
)
apiService
,
err
:=
api
.
NewApi
(
context
.
Background
(),
apiLog
,
apiCfg
)
...
@@ -148,10 +140,7 @@ func createE2ETestSuite(t *testing.T) E2ETestSuite {
...
@@ -148,10 +140,7 @@ func createE2ETestSuite(t *testing.T) E2ETestSuite {
// Wait for the API to start listening
// Wait for the API to start listening
time
.
Sleep
(
1
*
time
.
Second
)
time
.
Sleep
(
1
*
time
.
Second
)
client
,
err
:=
client
.
NewClient
(
&
client
.
Config
{
client
,
err
:=
client
.
NewClient
(
&
client
.
Config
{
PaginationLimit
:
100
,
BaseURL
:
"http://"
+
apiService
.
Addr
()})
PaginationLimit
:
100
,
BaseURL
:
"http://"
+
apiService
.
Addr
(),
})
require
.
NoError
(
t
,
err
,
"must open indexer API client"
)
require
.
NoError
(
t
,
err
,
"must open indexer API client"
)
return
E2ETestSuite
{
return
E2ETestSuite
{
...
@@ -193,9 +182,9 @@ func setupTestDatabase(t *testing.T) string {
...
@@ -193,9 +182,9 @@ func setupTestDatabase(t *testing.T) string {
Password
:
""
,
Password
:
""
,
}
}
silent
Log
:=
log
.
New
()
noop
Log
:=
log
.
New
()
silent
Log
.
SetHandler
(
log
.
DiscardHandler
())
noop
Log
.
SetHandler
(
log
.
DiscardHandler
())
db
,
err
:=
database
.
NewDB
(
context
.
Background
(),
silent
Log
,
dbConfig
)
db
,
err
:=
database
.
NewDB
(
context
.
Background
(),
noop
Log
,
dbConfig
)
require
.
NoError
(
t
,
err
)
require
.
NoError
(
t
,
err
)
defer
db
.
Close
()
defer
db
.
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