Fix start fail with kafka model (#20726)

Signed-off-by: yun.zhang <yun.zhang@zilliz.com>

Signed-off-by: yun.zhang <yun.zhang@zilliz.com>
pull/20749/head
jaime 2022-11-21 17:49:12 +08:00 committed by GitHub
parent 34c88cea32
commit d84cda22ad
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 24 additions and 1 deletions

View File

@ -351,10 +351,11 @@ func (p *PulsarConfig) Init(base *BaseTable) {
}
p.Port.Init(base.mgr)
// due to implicit rule of MQ prioritythe default address should be empty
p.Address = ParamItem{
Key: "pulsar.address",
Version: "2.0.0",
DefaultValue: "localhost",
DefaultValue: "",
Formatter: func(addr string) string {
if addr == "" {
return ""
@ -453,6 +454,7 @@ type KafkaConfig struct {
}
func (k *KafkaConfig) Init(base *BaseTable) {
// due to implicit rule of MQ prioritythe default address should be empty
k.Address = ParamItem{
Key: "kafka.brokerList",
DefaultValue: "",

View File

@ -14,6 +14,8 @@ package paramtable
import (
"testing"
"github.com/milvus-io/milvus/internal/config"
"github.com/milvus-io/milvus/internal/util/metricsinfo"
"github.com/stretchr/testify/assert"
)
@ -60,6 +62,13 @@ func TestServiceParam(t *testing.T) {
})
t.Run("test pulsarConfig", func(t *testing.T) {
// test default value
{
pc := &PulsarConfig{}
base := &BaseTable{mgr: &config.Manager{}}
pc.Init(base)
assert.Empty(t, pc.Address.GetValue())
}
{
assert.NotEqual(t, SParams.PulsarCfg.Address.GetValue(), "")
t.Logf("pulsar address = %s", SParams.PulsarCfg.Address.GetValue())
@ -118,6 +127,18 @@ func TestServiceParam(t *testing.T) {
t.Logf("rocksmq path = %s", Params.Path.GetValue())
})
t.Run("test kafkaConfig", func(t *testing.T) {
// test default value
{
kc := &KafkaConfig{}
base := &BaseTable{mgr: &config.Manager{}}
kc.Init(base)
assert.Empty(t, kc.Address.GetValue())
assert.Equal(t, kc.SaslMechanisms.GetValue(), "PLAIN")
assert.Equal(t, kc.SecurityProtocol.GetValue(), "SASL_SSL")
}
})
t.Run("test minioConfig", func(t *testing.T) {
Params := &SParams.MinioCfg