-
Notifications
You must be signed in to change notification settings - Fork 74
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* starting anvil with port 0 * nit * remove silent mode * typo
- Loading branch information
1 parent
d7153fc
commit 13aa0ec
Showing
5 changed files
with
104 additions
and
42 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
package anvil | ||
|
||
import ( | ||
"context" | ||
"testing" | ||
|
||
"github.com/ethereum-optimism/optimism/op-service/testlog" | ||
"github.com/stretchr/testify/require" | ||
|
||
"github.com/ethereum/go-ethereum/common/math" | ||
"github.com/ethereum/go-ethereum/log" | ||
"github.com/ethereum/go-ethereum/rpc" | ||
) | ||
|
||
func TestAnvil(t *testing.T) { | ||
cfg := Config{ChainId: 10, Port: 0} | ||
testlog := testlog.Logger(t, log.LevelInfo) | ||
anvil := New(testlog, &cfg) | ||
|
||
require.NoError(t, anvil.Start(context.Background())) | ||
|
||
// port overridden on startup | ||
require.NotEqual(t, cfg.Port, 0) | ||
|
||
client, err := rpc.Dial(anvil.Endpoint()) | ||
require.NoError(t, err) | ||
|
||
// query chainId | ||
var chainId math.HexOrDecimal64 | ||
require.NoError(t, client.CallContext(context.Background(), &chainId, "eth_chainId")) | ||
require.Equal(t, uint64(chainId), cfg.ChainId) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters