You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@dubbo.apache.org by al...@apache.org on 2020/07/12 16:33:00 UTC
[dubbo-go] branch develop updated: Fix router bug and revert test
case
This is an automated email from the ASF dual-hosted git repository.
alexstocks pushed a commit to branch develop
in repository https://gitbox.apache.org/repos/asf/dubbo-go.git
The following commit(s) were added to refs/heads/develop by this push:
new 982c3f1 Fix router bug and revert test case
new 080d8dd Merge pull request #651 from zouyx/develop
982c3f1 is described below
commit 982c3f155085d95fd825aa7b65902fc23813e533
Author: Joe Zou <yi...@gmail.com>
AuthorDate: Mon Jul 13 00:08:54 2020 +0800
Fix router bug and revert test case
---
config/router_config.go | 2 +-
config/router_config_test.go | 12 ++++++++++++
2 files changed, 13 insertions(+), 1 deletion(-)
diff --git a/config/router_config.go b/config/router_config.go
index 16943d9..16a2bec 100644
--- a/config/router_config.go
+++ b/config/router_config.go
@@ -44,7 +44,7 @@ func RouterInit(confRouterFile string) error {
r, e := factory.NewFileRouter(bytes)
if e == nil {
url := r.URL()
- routerURLSet.Add(url)
+ routerURLSet.Add(&url)
return nil
}
logger.Warnf("router config type %s create fail {%v}\n", k, e)
diff --git a/config/router_config_test.go b/config/router_config_test.go
index bf189b6..72e51c1 100644
--- a/config/router_config_test.go
+++ b/config/router_config_test.go
@@ -52,3 +52,15 @@ func TestString(t *testing.T) {
assert.Equal(t, n2[0], "a1")
assert.Equal(t, n2[1], "")
}
+
+func TestRouterInit(t *testing.T) {
+ errPro := RouterInit(errorTestYML)
+ assert.Error(t, errPro)
+
+ assert.Equal(t, 0, routerURLSet.Size())
+
+ errPro = RouterInit(testYML)
+ assert.NoError(t, errPro)
+
+ assert.Equal(t, 1, routerURLSet.Size())
+}