diff --git a/cluster/router/condition/app_router_test.go b/cluster/router/condition/app_router_test.go index b4c3056f8a70f752f96278cf95fe608ee7468f6b..5fb776a44bc11094df9a6bc7574d6a5456a3ccc8 100644 --- a/cluster/router/condition/app_router_test.go +++ b/cluster/router/condition/app_router_test.go @@ -83,8 +83,7 @@ conditions: appRouteURL := getAppRouteURL(routerKey) notify := make(chan struct{}) go func() { - for { - <-notify + for range notify { } }() appRouter, err := NewAppRouter(appRouteURL, notify) @@ -140,8 +139,7 @@ conditions: appRouteURL := getAppRouteURL(routerKey) notify := make(chan struct{}) go func() { - for { - <-notify + for range notify { } }() appRouter, err := NewAppRouter(appRouteURL, notify) @@ -188,8 +186,7 @@ conditions: appRouteURL := getAppRouteURL(routerKey) notify := make(chan struct{}) go func() { - for { - <-notify + for range notify { } }() appRouter, err := NewAppRouter(appRouteURL, notify) diff --git a/cluster/router/condition/factory_test.go b/cluster/router/condition/factory_test.go index efbc4057bfe21ac1b549ecec9ef24aa3ec9fa680..e08016d13ebba72f0a36c944082de27d6c95afdb 100644 --- a/cluster/router/condition/factory_test.go +++ b/cluster/router/condition/factory_test.go @@ -134,8 +134,7 @@ func TestRoute_matchWhen(t *testing.T) { rule := base64.URLEncoding.EncodeToString([]byte("=> host = 1.2.3.4")) notify := make(chan struct{}) go func() { - for { - <-notify + for range notify { } }() router, _ := newConditionRouterFactory().NewPriorityRouter(getRouteUrl(rule), notify) @@ -171,8 +170,7 @@ func TestRoute_matchWhen(t *testing.T) { func TestRoute_matchFilter(t *testing.T) { notify := make(chan struct{}) go func() { - for { - <-notify + for range notify { } }() localIP := common.GetLocalIp() @@ -212,8 +210,7 @@ func TestRoute_matchFilter(t *testing.T) { func TestRoute_methodRoute(t *testing.T) { notify := make(chan struct{}) go func() { - for { - <-notify + for range notify { } }() inv := invocation.NewRPCInvocationWithOptions(invocation.WithMethodName("getFoo"), invocation.WithParameterTypes([]reflect.Type{}), invocation.WithArguments([]interface{}{})) @@ -241,8 +238,7 @@ func TestRoute_methodRoute(t *testing.T) { func TestRoute_ReturnFalse(t *testing.T) { notify := make(chan struct{}) go func() { - for { - <-notify + for range notify { } }() url, _ := common.NewURL("") @@ -259,8 +255,7 @@ func TestRoute_ReturnFalse(t *testing.T) { func TestRoute_ReturnEmpty(t *testing.T) { notify := make(chan struct{}) go func() { - for { - <-notify + for range notify { } }() localIP := common.GetLocalIp() @@ -277,8 +272,7 @@ func TestRoute_ReturnEmpty(t *testing.T) { func TestRoute_ReturnAll(t *testing.T) { notify := make(chan struct{}) go func() { - for { - <-notify + for range notify { } }() localIP := common.GetLocalIp() @@ -303,8 +297,7 @@ func TestRoute_HostFilter(t *testing.T) { url3, _ := common.NewURL(fmt.Sprintf(factoryDubboFormat, localIP)) notify := make(chan struct{}) go func() { - for { - <-notify + for range notify { } }() invoker1 := NewMockInvoker(url1, 1) @@ -324,8 +317,7 @@ func TestRoute_HostFilter(t *testing.T) { func TestRoute_Empty_HostFilter(t *testing.T) { notify := make(chan struct{}) go func() { - for { - <-notify + for range notify { } }() localIP := common.GetLocalIp() @@ -349,8 +341,7 @@ func TestRoute_Empty_HostFilter(t *testing.T) { func TestRoute_False_HostFilter(t *testing.T) { notify := make(chan struct{}) go func() { - for { - <-notify + for range notify { } }() localIP := common.GetLocalIp() @@ -374,8 +365,7 @@ func TestRoute_False_HostFilter(t *testing.T) { func TestRoute_Placeholder(t *testing.T) { notify := make(chan struct{}) go func() { - for { - <-notify + for range notify { } }() localIP := common.GetLocalIp() @@ -399,8 +389,7 @@ func TestRoute_Placeholder(t *testing.T) { func TestRoute_NoForce(t *testing.T) { notify := make(chan struct{}) go func() { - for { - <-notify + for range notify { } }() localIP := common.GetLocalIp() @@ -422,8 +411,7 @@ func TestRoute_NoForce(t *testing.T) { func TestRoute_Force(t *testing.T) { notify := make(chan struct{}) go func() { - for { - <-notify + for range notify { } }() localIP := common.GetLocalIp() diff --git a/cluster/router/condition/router_test.go b/cluster/router/condition/router_test.go index 15bf76f085f5c7750d38bba36337142b81823c45..2895703dbc4672a300468f351d667198f52b5bf7 100644 --- a/cluster/router/condition/router_test.go +++ b/cluster/router/condition/router_test.go @@ -60,8 +60,7 @@ func TestParseRule(t *testing.T) { func TestNewConditionRouter(t *testing.T) { notify := make(chan struct{}) go func() { - for { - <-notify + for range notify { } }() url, _ := common.NewURL(`condition://0.0.0.0:?application=mock-app&category=routers&force=true&priority=1&router=condition&rule=YSAmIGMgPT4gYiAmIGQ%3D`) diff --git a/cluster/router/conncheck/conn_check_route_test.go b/cluster/router/conncheck/conn_check_route_test.go index 80ec1c8ea90b5a3e0108832658f5cba58c15b2c5..fec733167f38c2c642e6a35795fcc57289d242ca 100644 --- a/cluster/router/conncheck/conn_check_route_test.go +++ b/cluster/router/conncheck/conn_check_route_test.go @@ -50,8 +50,7 @@ func TestConnCheckRouterRoute(t *testing.T) { defer protocol.CleanAllStatus() notify := make(chan struct{}) go func() { - for { - <-notify + for range notify { } }() consumerURL, _ := common.NewURL(connCheck1001URL) diff --git a/cluster/router/healthcheck/health_check_route_test.go b/cluster/router/healthcheck/health_check_route_test.go index 1d44eb1a352ac2e588ffb344c2f1ead0babef96c..f499c85c093add1cc247fdb9fac02e391ef22bfc 100644 --- a/cluster/router/healthcheck/health_check_route_test.go +++ b/cluster/router/healthcheck/health_check_route_test.go @@ -51,8 +51,7 @@ func TestHealthCheckRouterRoute(t *testing.T) { defer protocol.CleanAllStatus() notify := make(chan struct{}) go func() { - for { - <-notify + for range notify { } }() consumerURL, _ := common.NewURL(healthCheck1001URL) @@ -120,8 +119,7 @@ func TestNewHealthCheckRouter(t *testing.T) { defer protocol.CleanAllStatus() notify := make(chan struct{}) go func() { - for { - <-notify + for range notify { } }() url, _ := common.NewURL(fmt.Sprintf(healthCheckDubboUrlFormat, healthCheckDubbo1010IP)) diff --git a/cluster/router/tag/factory_test.go b/cluster/router/tag/factory_test.go index ea5ff63fa0ae8fb292fe77f1e6126def04c35e1d..2a8eac20bace9047563568d2bda2e4efef09c392 100644 --- a/cluster/router/tag/factory_test.go +++ b/cluster/router/tag/factory_test.go @@ -41,8 +41,7 @@ func TestTagRouterFactoryNewRouter(t *testing.T) { factory := NewTagRouterFactory() notify := make(chan struct{}) go func() { - for { - <-notify + for range notify { } }() tagRouter, e := factory.NewPriorityRouter(u1, notify) diff --git a/cluster/router/tag/tag_router_test.go b/cluster/router/tag/tag_router_test.go index 8dccc3420a476ce1d583e9f778886b3d9230b83a..efee5bd6848f9c19727600c789729c446106fc95 100644 --- a/cluster/router/tag/tag_router_test.go +++ b/cluster/router/tag/tag_router_test.go @@ -121,8 +121,7 @@ func TestTagRouterPriority(t *testing.T) { u1, err := common.NewURL(tagRouterTestUserConsumerTag) notify := make(chan struct{}) go func() { - for { - <-notify + for range notify { } }() assert.Nil(t, err) @@ -135,8 +134,7 @@ func TestTagRouterPriority(t *testing.T) { func TestTagRouterRouteForce(t *testing.T) { notify := make(chan struct{}) go func() { - for { - <-notify + for range notify { } }() u1, e1 := common.NewURL(tagRouterTestUserConsumerTag) @@ -175,8 +173,7 @@ func TestTagRouterRouteNoForce(t *testing.T) { assert.Nil(t, e1) notify := make(chan struct{}) go func() { - for { - <-notify + for range notify { } }() tagRouter, e := NewTagRouter(u1, notify) @@ -244,8 +241,7 @@ func TestRouteBeijingInvoker(t *testing.T) { url, _ := common.NewURL(tagRouterTestBeijingUrl) notify := make(chan struct{}) go func() { - for { - <-notify + for range notify { } }() tagRouter, _ := NewTagRouter(url, notify) @@ -326,8 +322,7 @@ tags: notify := make(chan struct{}) go func() { - for { - <-notify + for range notify { } }() tagRouter, err := NewTagRouter(url, notify) @@ -397,8 +392,7 @@ func TestProcess(t *testing.T) { assert.Nil(t, err) notify := make(chan struct{}) go func() { - for { - <-notify + for range notify { } }() tagRouter, e := NewTagRouter(u1, notify) @@ -420,8 +414,7 @@ tags: addresses: [192.168.1.3, 192.168.1.4] ` go func() { - for { - <-notify + for range notify { } }() tagRouter.Process(&config_center.ConfigChangeEvent{Value: testYML, ConfigType: remoting.EventTypeAdd})