mirror of
https://gitee.com/milvus-io/milvus.git
synced 2024-12-04 04:49:08 +08:00
af32f442bb
Signed-off-by: dragondriver <jiquan.long@zilliz.com>
39 lines
931 B
Go
39 lines
931 B
Go
package proxynode
|
|
|
|
import (
|
|
"fmt"
|
|
"net/http"
|
|
"strconv"
|
|
"testing"
|
|
|
|
"github.com/stretchr/testify/assert"
|
|
|
|
"github.com/jarcoal/httpmock"
|
|
)
|
|
|
|
func TestGetPulsarConfig(t *testing.T) {
|
|
httpmock.Activate()
|
|
defer httpmock.DeactivateAndReset()
|
|
|
|
runtimeConfig := make(map[string]interface{})
|
|
runtimeConfig[PulsarMaxMessageSizeKey] = strconv.FormatInt(5*1024*1024, 10)
|
|
|
|
protocol := "http"
|
|
ip := "pulsar"
|
|
port := "18080"
|
|
url := "/admin/v2/brokers/configuration/runtime"
|
|
httpmock.RegisterResponder("GET", protocol+"://"+ip+":"+port+url,
|
|
func(req *http.Request) (*http.Response, error) {
|
|
return httpmock.NewJsonResponse(200, runtimeConfig)
|
|
},
|
|
)
|
|
|
|
ret, err := GetPulsarConfig(protocol, ip, port, url)
|
|
assert.Equal(t, nil, err)
|
|
assert.Equal(t, len(ret), len(runtimeConfig))
|
|
assert.Equal(t, len(ret), 1)
|
|
for key, value := range ret {
|
|
assert.Equal(t, fmt.Sprintf("%v", value), fmt.Sprintf("%v", runtimeConfig[key]))
|
|
}
|
|
}
|