forked from ethereum-optimism/optimism
-
Notifications
You must be signed in to change notification settings - Fork 9
Expand file tree
/
Copy pathservice_test.go
More file actions
63 lines (55 loc) · 1.66 KB
/
service_test.go
File metadata and controls
63 lines (55 loc) · 1.66 KB
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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
package opnode
import (
"testing"
"github.com/ethereum-optimism/optimism/op-node/flags"
"github.com/ethereum/go-ethereum/log"
"github.com/stretchr/testify/require"
"github.com/urfave/cli/v2"
)
func syncConfigCliApp() *cli.App {
syncConfigFlags := append([]cli.Flag{
flags.SequencerEnabledFlag,
flags.L2EngineSyncEnabled,
flags.SyncModeFlag,
flags.SyncModeReqRespFlag,
flags.L2FollowSource,
flags.L2FollowSourceSkipL1Check,
flags.L2EngineKind,
flags.SkipSyncStartCheck,
}, flags.P2PFlags("")..., // For p2p.sync.req-resp
)
return &cli.App{
Flags: syncConfigFlags,
Action: func(c *cli.Context) error {
_, err := NewSyncConfig(c, log.New())
return err
},
}
}
func run(args []string) error {
return syncConfigCliApp().Run(append([]string{"test"}, args...))
}
func TestNewSyncConfigDefault(t *testing.T) {
require.NoError(t, run(nil))
}
func TestNewSyncConfig_SkipL1CheckRequiresFollowSource(t *testing.T) {
// skip-l1-check without follow source should fail
err := run([]string{"--l2.follow.source.skip-l1-check"})
require.Error(t, err)
require.Contains(t, err.Error(), "--l2.follow.source.skip-l1-check requires --l2.follow.source to be set")
}
func TestNewSyncConfig_SkipL1CheckWithFollowSource(t *testing.T) {
// skip-l1-check with follow source should succeed
err := run([]string{
"--l2.follow.source=http://localhost:9545",
"--l2.follow.source.skip-l1-check",
})
require.NoError(t, err)
}
func TestNewSyncConfig_FollowSourceWithoutSkipL1Check(t *testing.T) {
// follow source without skip-l1-check should succeed (standard Light CL mode)
err := run([]string{
"--l2.follow.source=http://localhost:9545",
})
require.NoError(t, err)
}