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
9e0702db
Commit
9e0702db
authored
May 23, 2023
by
Andreas Bigger
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix tests with e2eutils.
parent
7317e94d
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
12 deletions
+11
-12
log_store_test.go
op-challenger/challenger/log_store_test.go
+11
-12
No files found.
op-challenger/challenger/log_store_test.go
View file @
9e0702db
...
@@ -11,6 +11,7 @@ import (
...
@@ -11,6 +11,7 @@ import (
"github.com/ethereum/go-ethereum/core/types"
"github.com/ethereum/go-ethereum/core/types"
"github.com/ethereum/go-ethereum/log"
"github.com/ethereum/go-ethereum/log"
"github.com/ethereum-optimism/optimism/op-e2e/e2eutils"
"github.com/ethereum-optimism/optimism/op-node/testlog"
"github.com/ethereum-optimism/optimism/op-node/testlog"
"github.com/stretchr/testify/require"
"github.com/stretchr/testify/require"
...
@@ -158,22 +159,21 @@ func TestLogStore_DispatchLogs(t *testing.T) {
...
@@ -158,22 +159,21 @@ func TestLogStore_DispatchLogs(t *testing.T) {
// Dispatch logs on the logStore.
// Dispatch logs on the logStore.
go
logStore
.
dispatchLogs
()
go
logStore
.
dispatchLogs
()
time
.
Sleep
(
1
*
time
.
Second
)
// Send logs through the subscription.
// Send logs through the subscription.
blockHash
:=
common
.
HexToHash
(
"0x1"
)
logStore
.
subscription
.
logs
<-
types
.
Log
{
logStore
.
subscription
.
logs
<-
types
.
Log
{
BlockHash
:
common
.
HexToHash
(
"0x1"
),
BlockHash
:
blockHash
,
}
time
.
Sleep
(
1
*
time
.
Second
)
logStore
.
subscription
.
logs
<-
types
.
Log
{
BlockHash
:
common
.
HexToHash
(
"0x1"
),
}
}
time
.
Sleep
(
1
*
time
.
Second
)
// Verify that the log was inserted correctly.
// Wait for the logs to be dispatched.
require
.
Equal
(
t
,
2
,
len
(
logStore
.
logList
))
timeout
,
tCancel
:=
context
.
WithTimeout
(
context
.
Background
(),
30
*
time
.
Second
)
require
.
Equal
(
t
,
2
,
len
(
logStore
.
GetLogByBlockHash
(
common
.
HexToHash
(
"0x1"
))))
defer
tCancel
()
require
.
Equal
(
t
,
2
,
len
(
logStore
.
GetLogs
()))
err
=
e2eutils
.
WaitFor
(
timeout
,
500
*
time
.
Millisecond
,
func
()
(
bool
,
error
)
{
result
:=
logStore
.
GetLogByBlockHash
(
blockHash
)
return
result
[
0
]
.
BlockHash
==
blockHash
,
nil
})
require
.
NoError
(
t
,
err
)
// Quit the subscription.
// Quit the subscription.
logStore
.
Quit
()
logStore
.
Quit
()
...
@@ -193,7 +193,6 @@ func TestLogStore_DispatchLogs_SubscriptionError(t *testing.T) {
...
@@ -193,7 +193,6 @@ func TestLogStore_DispatchLogs_SubscriptionError(t *testing.T) {
// Dispatch logs on the logStore.
// Dispatch logs on the logStore.
go
logStore
.
dispatchLogs
()
go
logStore
.
dispatchLogs
()
time
.
Sleep
(
1
*
time
.
Second
)
// Send an error through the subscription.
// Send an error through the subscription.
client
.
sub
.
errorChan
<-
errors
.
New
(
"test error"
)
client
.
sub
.
errorChan
<-
errors
.
New
(
"test error"
)
...
...
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