forked from ethereum-optimism/optimism
-
Notifications
You must be signed in to change notification settings - Fork 0
/
l1_beacon_client_test.go
32 lines (25 loc) · 967 Bytes
/
l1_beacon_client_test.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
package op_e2e
import (
"context"
"testing"
"github.com/ethereum-optimism/optimism/op-e2e/e2eutils/fakebeacon"
"github.com/ethereum-optimism/optimism/op-service/client"
"github.com/ethereum-optimism/optimism/op-service/sources"
"github.com/ethereum-optimism/optimism/op-service/testlog"
"github.com/ethereum/go-ethereum/log"
"github.com/stretchr/testify/require"
)
func TestGetVersion(t *testing.T) {
InitParallel(t)
l := testlog.Logger(t, log.LevelInfo)
beaconApi := fakebeacon.NewBeacon(l, t.TempDir(), uint64(0), uint64(0))
t.Cleanup(func() {
_ = beaconApi.Close()
})
require.NoError(t, beaconApi.Start("127.0.0.1:0"))
beaconCfg := sources.L1BeaconClientConfig{FetchAllSidecars: false}
cl := sources.NewL1BeaconClient(sources.NewBeaconHTTPClient(client.NewBasicHTTPClient(beaconApi.BeaconAddr(), l)), beaconCfg)
version, err := cl.GetVersion(context.Background())
require.NoError(t, err)
require.Equal(t, "fakebeacon 1.2.3", version)
}