Skip to content

Commit

Permalink
rpk: Add config tests for NamedAuthNSocketAddress
Browse files Browse the repository at this point in the history
Signed-off-by: Ben Pope <ben@redpanda.com>
  • Loading branch information
BenPope committed Jul 19, 2022
1 parent e336288 commit ff0ca93
Showing 1 changed file with 26 additions and 0 deletions.
26 changes: 26 additions & 0 deletions src/go/rpk/pkg/config/config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ func getValidConfig() *Config {
}

func TestSet(t *testing.T) {
authNSasl := "sasl"
tests := []struct {
name string
key string
Expand Down Expand Up @@ -226,6 +227,31 @@ tune_cpu: true`,
require.Exactly(st, expected, c.Redpanda.KafkaAPI)
},
},
{
name: "extract kafka_api[].authentication_method",
key: "redpanda.kafka_api",
value: `- name: external
address: 192.168.73.45
port: 9092
authentication_method: sasl
- name: internal
address: 10.21.34.58
port: 9092
`,
check: func(st *testing.T, c *Config) {
expected := []NamedAuthNSocketAddress{{
Name: "external",
Address: "192.168.73.45",
Port: 9092,
AuthN: &authNSasl,
}, {
Name: "internal",
Address: "10.21.34.58",
Port: 9092,
}}
require.Exactly(st, expected, c.Redpanda.KafkaAPI)
},
},
{
name: "partially set map fields (json)",
key: "redpanda.kafka_api",
Expand Down

0 comments on commit ff0ca93

Please sign in to comment.