nic-chen commented on a change in pull request #847:
URL: https://github.com/apache/apisix-dashboard/pull/847#discussion_r528578058
##########
File path: api/internal/core/entity/format.go
##########
@@ -17,51 +17,73 @@
package entity
import (
- "log"
+ "net"
"strconv"
- "strings"
+
+ "github.com/apisix/manager-api/log"
)
+func MapKV2Node(key string, val float64) (*Node, error) {
Review comment:
updated.
##########
File path: api/internal/core/entity/format_test.go
##########
@@ -23,19 +23,60 @@ import (
"github.com/stretchr/testify/assert"
)
-func TestConsumer(t *testing.T) {
- nodesStr := `{
- "127.0.0.1:8080": 1
- }`
- nodesMap := map[string]float64{}
- err := json.Unmarshal([]byte(nodesStr), &nodesMap)
+func TestNodesFormat(t *testing.T) {
+ // route data saved in ETCD
+ routeStr := `{
+ "uris": ["/*"],
+ "upstream": {
+ "type": "roundrobin",
+ "nodes": [{
+ "host": "127.0.0.1",
+ "port": 80,
+ "weight": 0
+ }]
+ }
+ }`
Review comment:
fixed.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]