|
|
@@ -212,11 +212,11 @@ func doListenerTLSTest(t *testing.T, expectSuccess bool, serverConfig, clientCon
|
|
|
}
|
|
|
|
|
|
func TestSetServerName(t *testing.T) {
|
|
|
- if validServerNameTLS("kafka-server.domain.com", nil).ServerName != "kafka-server.domain.com" {
|
|
|
+ if validServerNameTLS("kafka-server.domain.com:9093", nil).ServerName != "kafka-server.domain.com" {
|
|
|
t.Fatal("Expected kafka-server.domain.com as tls.ServerName when tls config is nil")
|
|
|
}
|
|
|
|
|
|
- if validServerNameTLS("kafka-server.domain.com", &tls.Config{}).ServerName != "kafka-server.domain.com" {
|
|
|
+ if validServerNameTLS("kafka-server.domain.com:9093", &tls.Config{}).ServerName != "kafka-server.domain.com" {
|
|
|
t.Fatal("Expected kafka-server.domain.com as tls.ServerName when tls config ServerName is not provided")
|
|
|
}
|
|
|
|
|
|
@@ -224,4 +224,8 @@ func TestSetServerName(t *testing.T) {
|
|
|
if validServerNameTLS("", c).ServerName != "kafka-server-other.domain.com" {
|
|
|
t.Fatal("Expected kafka-server-other.domain.com as tls.ServerName when tls config ServerName is provided")
|
|
|
}
|
|
|
+
|
|
|
+ if validServerNameTLS("host-no-port", nil).ServerName != "" {
|
|
|
+ t.Fatal("Expected empty ServerName as the broker addr is missing the port")
|
|
|
+ }
|
|
|
}
|