This is an automated email from the ASF dual-hosted git repository.
iluo pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/dubbo-go-samples.git
The following commit(s) were added to refs/heads/master by this push:
new b664144 Router example enhance (#89)
b664144 is described below
commit b664144cef4fed2ff3d22481f65a91ee3afe97a1
Author: Ian Luo <[email protected]>
AuthorDate: Tue Apr 13 15:32:33 2021 +0800
Router example enhance (#89)
* enhance router_config.yaml
* enhance tag router example
* enhance tag examples
---
router/condition/go-client/conf/router_config.yml | 4 ++--
router/condition/go-server/conf/router_config.yml | 4 ++--
router/tag/go-server/conf/router_config.yml | 2 +-
router/tag/go-server/tests/integration/main_test.go | 5 ++---
4 files changed, 7 insertions(+), 8 deletions(-)
diff --git a/router/condition/go-client/conf/router_config.yml
b/router/condition/go-client/conf/router_config.yml
index fdf0333..af0abd6 100644
--- a/router/condition/go-client/conf/router_config.yml
+++ b/router/condition/go-client/conf/router_config.yml
@@ -4,10 +4,10 @@ routerRules:
key: UserInfoTest
priority: 1
force: true
- conditions: [ "host = $HOST_IP => host = $HOST_IP " ]
+ conditions: [ "host = $HOST_IP => host != $HOST_IP" ]
- scope: service
key: org.apache.dubbo.UserProvider
priority: 1
force: true
conditions:
- - method = GetUser => host = 1.2.3.4
\ No newline at end of file
+ - method = GetUser => host = $HOST_IP
\ No newline at end of file
diff --git a/router/condition/go-server/conf/router_config.yml
b/router/condition/go-server/conf/router_config.yml
index fdf0333..915d9ba 100644
--- a/router/condition/go-server/conf/router_config.yml
+++ b/router/condition/go-server/conf/router_config.yml
@@ -4,10 +4,10 @@ routerRules:
key: UserInfoTest
priority: 1
force: true
- conditions: [ "host = $HOST_IP => host = $HOST_IP " ]
+ conditions: [ "host = $HOST_IP => host == $HOST_IP" ]
- scope: service
key: org.apache.dubbo.UserProvider
priority: 1
force: true
conditions:
- - method = GetUser => host = 1.2.3.4
\ No newline at end of file
+ - method = GetUser => host != $HOST_IP
\ No newline at end of file
diff --git a/router/tag/go-server/conf/router_config.yml
b/router/tag/go-server/conf/router_config.yml
index fb8a9e6..68cd6d0 100644
--- a/router/tag/go-server/conf/router_config.yml
+++ b/router/tag/go-server/conf/router_config.yml
@@ -9,6 +9,6 @@ routerRules:
key: demo-provider
tags:
- name: beijing
- addresses: [192.168.1.1, $HOST_IP]
+ addresses: [192.168.1.1, 1.2.3.4]
- name: shenzhen
addresses: [192.168.1.3, 192.168.1.4]
\ No newline at end of file
diff --git a/router/tag/go-server/tests/integration/main_test.go
b/router/tag/go-server/tests/integration/main_test.go
index 758cc00..8d37927 100644
--- a/router/tag/go-server/tests/integration/main_test.go
+++ b/router/tag/go-server/tests/integration/main_test.go
@@ -21,10 +21,9 @@ package integration
import (
hessian "github.com/apache/dubbo-go-hessian2"
-
_ "github.com/apache/dubbo-go/cluster/cluster_impl"
_ "github.com/apache/dubbo-go/cluster/loadbalance"
- _ "github.com/apache/dubbo-go/cluster/router/condition"
+ _ "github.com/apache/dubbo-go/cluster/router/tag"
_ "github.com/apache/dubbo-go/common/proxy/proxy_factory"
"github.com/apache/dubbo-go/config"
_ "github.com/apache/dubbo-go/filter/filter_impl"
@@ -46,7 +45,7 @@ func TestMain(m *testing.M) {
config.SetConsumerService(userProvider)
hessian.RegisterPOJO(&User{})
config.Load()
- time.Sleep(6 * time.Second)
+ time.Sleep(10 * time.Second)
os.Exit(m.Run())
}