From ff0ca9363a82d2769dea5ff92f7903f363d8e0b9 Mon Sep 17 00:00:00 2001 From: Ben Pope Date: Tue, 19 Jul 2022 13:51:24 +0100 Subject: [PATCH] rpk: Add config tests for NamedAuthNSocketAddress Signed-off-by: Ben Pope --- src/go/rpk/pkg/config/config_test.go | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/src/go/rpk/pkg/config/config_test.go b/src/go/rpk/pkg/config/config_test.go index c99f140cc642..9e5768985369 100644 --- a/src/go/rpk/pkg/config/config_test.go +++ b/src/go/rpk/pkg/config/config_test.go @@ -47,6 +47,7 @@ func getValidConfig() *Config { } func TestSet(t *testing.T) { + authNSasl := "sasl" tests := []struct { name string key string @@ -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",