Skip to content
Snippets Groups Projects
Commit 6b04b966 authored by scott's avatar scott
Browse files

Fix create-path and push to test

parent 92f9ea21
No related branches found
No related tags found
No related merge requests found
......@@ -64,19 +64,21 @@ func (l *dataListener) DataChange(eventType remoting.Event) bool {
return false
}
if _, ok := l.interestedURL[serviceURL.String()]; !ok {
return false
for _, v := range l.interestedURL {
if serviceURL.URLEqual(*v) {
l.listener.Process(
&config_center.ConfigChangeEvent{
Key: eventType.Path,
Value: serviceURL,
ConfigType: eventType.Action,
},
)
return true
}
}
l.listener.Process(
&config_center.ConfigChangeEvent{
Key: eventType.Path,
Value: serviceURL,
ConfigType: eventType.Action,
},
)
return true
return false
}
type configurationListener struct {
......
......@@ -19,8 +19,6 @@ package kubernetes
import (
"encoding/json"
"net/http"
_ "net/http/pprof"
"os"
"strconv"
"testing"
......@@ -239,9 +237,6 @@ func (s *KubernetesRegistryTestSuite) SetupSuite() {
if err := os.Setenv(nameSpaceKey, s.currentPod.GetNamespace()); err != nil {
t.Fatal(err)
}
go http.ListenAndServe(":6061", nil)
}
func (s *KubernetesRegistryTestSuite) TestDataChange() {
......
......@@ -97,14 +97,9 @@ func (r *kubernetesRegistry) CloseListener() {
}
func (r *kubernetesRegistry) CreatePath(k string) error {
var tmpPath string
for _, str := range strings.Split(k, "/")[1:] {
tmpPath = path.Join(tmpPath, "/", str)
if err := r.client.Create(tmpPath, ""); err != nil {
return perrors.WithMessagef(err, "create path %s in kubernetes", tmpPath)
}
if err := r.client.Create(k, ""); err != nil {
return perrors.WithMessagef(err, "create path %s in kubernetes", k)
}
return nil
}
......
......@@ -38,7 +38,11 @@ func (s *KubernetesRegistryTestSuite) TestRegister() {
r := s.initRegistry()
defer r.Destroy()
url, _ := common.NewURL("dubbo://127.0.0.1:20000/com.ikurento.user.UserProvider", common.WithParamsValue(constant.CLUSTER_KEY, "mock"), common.WithMethods([]string{"GetUser", "AddUser"}))
url, _ := common.NewURL(
"dubbo://127.0.0.1:20000/com.ikurento.user.UserProvider",
common.WithParamsValue(constant.CLUSTER_KEY, "mock"),
common.WithMethods([]string{"GetUser", "AddUser"}),
)
err := r.Register(url)
assert.NoError(t, err)
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment