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
49ab9c86
Commit
49ab9c86
authored
Jun 23, 2021
by
Mark Tyneway
Committed by
Liam Horne
Jun 29, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
l2geth: test errors returning from remote
parent
648392e0
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
28 additions
and
1 deletion
+28
-1
client_test.go
l2geth/rollup/client_test.go
+28
-1
No files found.
l2geth/rollup/client_test.go
View file @
49ab9c86
package
rollup
import
(
"errors"
"fmt"
"math/big"
"testing"
...
...
@@ -8,8 +9,9 @@ import (
"github.com/jarcoal/httpmock"
)
const
url
=
"http://localhost:9999"
func
TestRollupClientGetL1GasPrice
(
t
*
testing
.
T
)
{
url
:=
"http://localhost:9999"
endpoint
:=
fmt
.
Sprintf
(
"%s/eth/gasprice"
,
url
)
// url/chain-id does not matter, we'll mock the responses
client
:=
NewClient
(
url
,
big
.
NewInt
(
1
))
...
...
@@ -41,3 +43,28 @@ func TestRollupClientGetL1GasPrice(t *testing.T) {
t
.
Fatal
(
"gasPrice is not parsed properly in the client"
)
}
}
func
TestRollupClientCannotConnect
(
t
*
testing
.
T
)
{
endpoint
:=
fmt
.
Sprintf
(
"%s/eth/context/latest"
,
url
)
client
:=
NewClient
(
url
,
big
.
NewInt
(
1
))
httpmock
.
ActivateNonDefault
(
client
.
client
.
GetClient
())
response
,
_
:=
httpmock
.
NewJsonResponder
(
400
,
map
[
string
]
interface
{}{},
)
httpmock
.
RegisterResponder
(
"GET"
,
endpoint
,
response
,
)
context
,
err
:=
client
.
GetLatestEthContext
()
if
context
!=
nil
{
t
.
Fatal
(
"returned value is not nil"
)
}
if
!
errors
.
Is
(
err
,
errHTTPError
)
{
t
.
Fatalf
(
"Incorrect error returned: %s"
,
err
)
}
}
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