Commit 2698fe83 authored by Sabnock01's avatar Sabnock01

fix: signer config tests

parent bb56249f
...@@ -5,6 +5,8 @@ import ( ...@@ -5,6 +5,8 @@ import (
"github.com/stretchr/testify/require" "github.com/stretchr/testify/require"
"github.com/urfave/cli/v2" "github.com/urfave/cli/v2"
optls "github.com/ethereum-optimism/optimism/op-service/tls"
) )
func TestDefaultCLIOptionsMatchDefaultConfig(t *testing.T) { func TestDefaultCLIOptionsMatchDefaultConfig(t *testing.T) {
...@@ -22,26 +24,26 @@ func TestInvalidConfig(t *testing.T) { ...@@ -22,26 +24,26 @@ func TestInvalidConfig(t *testing.T) {
tests := []struct { tests := []struct {
name string name string
expected string expected string
configChange func(config *CLIConfig) configChange func(config *optls.SignerCLIConfig)
}{ }{
{ {
name: "MissingEndpoint", name: "MissingEndpoint",
expected: "signer endpoint and address must both be set or not set", expected: "signer endpoint and address must both be set or not set",
configChange: func(config *CLIConfig) { configChange: func(config *optls.SignerCLIConfig) {
config.Address = "0x1234" config.Address = "0x1234"
}, },
}, },
{ {
name: "MissingAddress", name: "MissingAddress",
expected: "signer endpoint and address must both be set or not set", expected: "signer endpoint and address must both be set or not set",
configChange: func(config *CLIConfig) { configChange: func(config *optls.SignerCLIConfig) {
config.Endpoint = "http://localhost" config.Endpoint = "http://localhost"
}, },
}, },
{ {
name: "InvalidTLSConfig", name: "InvalidTLSConfig",
expected: "all tls flags must be set if at least one is set", expected: "all tls flags must be set if at least one is set",
configChange: func(config *CLIConfig) { configChange: func(config *optls.SignerCLIConfig) {
config.TLSConfig.TLSKey = "" config.TLSConfig.TLSKey = ""
}, },
}, },
...@@ -56,11 +58,11 @@ func TestInvalidConfig(t *testing.T) { ...@@ -56,11 +58,11 @@ func TestInvalidConfig(t *testing.T) {
} }
} }
func configForArgs(args ...string) CLIConfig { func configForArgs(args ...string) optls.SignerCLIConfig {
app := cli.NewApp() app := cli.NewApp()
app.Flags = CLIFlags("TEST_") app.Flags = CLIFlags("TEST_")
app.Name = "test" app.Name = "test"
var config CLIConfig var config optls.SignerCLIConfig
app.Action = func(ctx *cli.Context) error { app.Action = func(ctx *cli.Context) error {
config = ReadCLIConfig(ctx) config = ReadCLIConfig(ctx)
return nil return nil
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment