fix auth config unmarshal (#21474)

Signed-off-by: Wei Liu <wei.liu@zilliz.com>
This commit is contained in:
wei liu 2023-01-03 10:13:34 +08:00 committed by GitHub
parent b684d4adf8
commit dc94fb61ac
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 10 additions and 7 deletions

View File

@ -394,12 +394,8 @@ func (p *PulsarConfig) initAuthParams() {
}
}
if len(jsonMap) == 0 {
p.AuthParams = ""
} else {
jsonData, _ := json.Marshal(&jsonMap)
p.AuthParams = string(jsonData)
}
jsonData, _ := json.Marshal(&jsonMap)
p.AuthParams = string(jsonData)
}
func (p *PulsarConfig) initTenant() {

View File

@ -112,7 +112,14 @@ func TestServiceParam(t *testing.T) {
assert.Equal(t, "", Params.AuthPlugin)
Params.initAuthParams()
assert.Equal(t, "", Params.AuthParams)
assert.Equal(t, "{}", Params.AuthParams)
})
t.Run("test pulsar auth config formatter", func(t *testing.T) {
Params := SParams.PulsarCfg
Params.initAuthParams()
assert.Equal(t, "{}", Params.AuthParams)
})
t.Run("test pulsar tenant/namespace config", func(t *testing.T) {