This is an automated email from the ASF dual-hosted git repository. laurence pushed a commit to branch revert-156-tracing-integration in repository https://gitbox.apache.org/repos/asf/dubbo-go-samples.git
commit 4b0359ec9ad938f7523c3b73b913fbf48630aeac Author: Laurence <[email protected]> AuthorDate: Wed Jul 7 23:28:32 2021 +0800 Revert "add tracing integration test (#156)" This reverts commit 7c8fc1c5642c6fca8aa97697f3895d89ef4c6956. --- start_integrate_test.sh | 6 +- tracing/dubbo/go-client/{cmd => app}/client.go | 11 +--- tracing/dubbo/go-client/{pkg => app}/user.go | 16 ++++- .../{go-server/cmd => go-client/app}/version.go | 0 tracing/dubbo/go-client/conf/client.yml | 61 ----------------- tracing/dubbo/go-client/conf/log.yml | 28 -------- tracing/dubbo/go-server/{cmd => app}/server.go | 3 +- tracing/dubbo/go-server/{pkg => app}/user.go | 2 +- .../{go-client/cmd => go-server/app}/version.go | 0 tracing/dubbo/go-server/conf/client.yml | 61 ----------------- tracing/dubbo/go-server/conf/log.yml | 28 -------- tracing/dubbo/go-server/conf/server.yml | 62 ----------------- tracing/dubbo/go-server/docker/docker-compose.yml | 8 --- .../dubbo/go-server/tests/integration/main_test.go | 77 ---------------------- .../tests/integration/userprovider_test.go | 74 --------------------- 15 files changed, 21 insertions(+), 416 deletions(-) diff --git a/start_integrate_test.sh b/start_integrate_test.sh index c04e977..6f2287c 100755 --- a/start_integrate_test.sh +++ b/start_integrate_test.sh @@ -14,11 +14,8 @@ # See the License for the specific language governing permissions and # limitations under the License. -# tracing integrate test -array=("tracing/dubbo/go-server") - # async -array+=("async/go-server") +array=("async/go-server") array+=("attachment/go-server") array+=("config-api/go-server") # config center @@ -79,6 +76,7 @@ array+=("registry/servicediscovery/nacos/go-server") array+=("router/uniform-router/file/go-server") array+=("router/uniform-router/file/go-server2") + for((i=0;i<${#array[*]};i++)) do ./integrate_test.sh "${array[i]}" diff --git a/tracing/dubbo/go-client/cmd/client.go b/tracing/dubbo/go-client/app/client.go similarity index 92% rename from tracing/dubbo/go-client/cmd/client.go rename to tracing/dubbo/go-client/app/client.go index 7e23bce..45bd478 100644 --- a/tracing/dubbo/go-client/cmd/client.go +++ b/tracing/dubbo/go-client/app/client.go @@ -20,7 +20,6 @@ package main import ( "context" "fmt" - "github.com/apache/dubbo-go-samples/tracing/dubbo/go-client/pkg" "os" "os/signal" "syscall" @@ -51,25 +50,19 @@ import ( ) var ( - userProvider = new(pkg.UserProvider) survivalTimeout int = 10e9 ) -func init() { - config.SetConsumerService(userProvider) - hessian.RegisterPOJO(&pkg.User{}) -} - // they are necessary: // export CONF_CONSUMER_FILE_PATH="xxx" // export APP_LOG_CONF_FILE="xxx" func main() { - hessian.RegisterPOJO(&pkg.User{}) + hessian.RegisterPOJO(&User{}) config.Load() initZipkin() gxlog.CInfo("\n\n\nstart to test dubbo") - user := &pkg.User{} + user := &User{} span, ctx := opentracing.StartSpanFromContext(context.Background(), "Test-Client-Service") err := userProvider.GetUser(ctx, []interface{}{"A001"}, user) span.Finish() diff --git a/tracing/dubbo/go-client/pkg/user.go b/tracing/dubbo/go-client/app/user.go similarity index 82% rename from tracing/dubbo/go-client/pkg/user.go rename to tracing/dubbo/go-client/app/user.go index 42c7eb9..d144dd6 100644 --- a/tracing/dubbo/go-client/pkg/user.go +++ b/tracing/dubbo/go-client/app/user.go @@ -15,13 +15,27 @@ * limitations under the License. */ -package pkg +package main import ( "context" "time" ) +import ( + "dubbo.apache.org/dubbo-go/v3/config" + hessian "github.com/apache/dubbo-go-hessian2" +) + +var ( + userProvider = &UserProvider{} +) + +func init() { + config.SetConsumerService(userProvider) + hessian.RegisterPOJO(&User{}) +} + type User struct { ID string Name string diff --git a/tracing/dubbo/go-server/cmd/version.go b/tracing/dubbo/go-client/app/version.go similarity index 100% rename from tracing/dubbo/go-server/cmd/version.go rename to tracing/dubbo/go-client/app/version.go diff --git a/tracing/dubbo/go-client/conf/client.yml b/tracing/dubbo/go-client/conf/client.yml deleted file mode 100644 index 3bcc1cd..0000000 --- a/tracing/dubbo/go-client/conf/client.yml +++ /dev/null @@ -1,61 +0,0 @@ -# dubbo client yaml configure file - - -check: true -# client -request_timeout : "3s" -# connect timeout -connect_timeout : "3s" - -# application config -application: - organization : "ikurento.com" - name : "BDTService" - module : "dubbogo user-info client" - version : "0.0.1" - owner : "ZX" - environment : "test" - -registries : - "hangzhouzk": - protocol: "zookeeper" - timeout : "3s" - address: "127.0.0.1:2181" - username: "" - password: "" - -references: - "UserProvider": - # 可以指定多个registry,使用逗号隔开;不指定默认向所有注册中心注册 - registry: "hangzhouzk" - protocol : "dubbo" - interface : "com.ikurento.user.UserProvider" - cluster: "failover" - methods : - - name: "GetUser" - retries: 3 - -protocol_conf: - dubbo: - reconnect_interval: 0 - connection_number: 2 - heartbeat_period: "5s" - session_timeout: "180s" - pool_size: 64 - pool_ttl: 600 - getty_session_param: - compress_encoding: false - tcp_no_delay: true - tcp_keep_alive: true - keep_alive_period: "120s" - tcp_r_buf_size: 262144 - tcp_w_buf_size: 65536 - pkg_rq_size: 1024 - pkg_wq_size: 512 - tcp_read_timeout: "1s" - tcp_write_timeout: "5s" - wait_timeout: "1s" - max_msg_len: 10240 - session_name: "client" - -filter: "tracing" \ No newline at end of file diff --git a/tracing/dubbo/go-client/conf/log.yml b/tracing/dubbo/go-client/conf/log.yml deleted file mode 100644 index baee0b7..0000000 --- a/tracing/dubbo/go-client/conf/log.yml +++ /dev/null @@ -1,28 +0,0 @@ - -level: "info" -development: false -disableCaller: false -disableStacktrace: true -sampling: -encoding: "console" - -# encoder -encoderConfig: - messageKey: "message" - levelKey: "level" - timeKey: "time" - nameKey: "logger" - callerKey: "caller" - stacktraceKey: "stacktrace" - lineEnding: "" - levelEncoder: "capitalColor" - timeEncoder: "iso8601" - durationEncoder: "seconds" - callerEncoder: "short" - nameEncoder: "" - -outputPaths: - - "stderr" -errorOutputPaths: - - "stderr" -initialFields: diff --git a/tracing/dubbo/go-server/cmd/server.go b/tracing/dubbo/go-server/app/server.go similarity index 96% rename from tracing/dubbo/go-server/cmd/server.go rename to tracing/dubbo/go-server/app/server.go index 5a08497..efcdbc9 100644 --- a/tracing/dubbo/go-server/cmd/server.go +++ b/tracing/dubbo/go-server/app/server.go @@ -38,7 +38,6 @@ import ( "dubbo.apache.org/dubbo-go/v3/config" _ "dubbo.apache.org/dubbo-go/v3/protocol/dubbo" _ "dubbo.apache.org/dubbo-go/v3/registry/protocol" - "github.com/apache/dubbo-go-samples/tracing/dubbo/go-server/pkg" _ "dubbo.apache.org/dubbo-go/v3/common/proxy/proxy_factory" _ "dubbo.apache.org/dubbo-go/v3/filter/filter_impl" @@ -57,7 +56,7 @@ var ( // export APP_LOG_CONF_FILE="xxx" func main() { - hessian.RegisterPOJO(&pkg.User{}) + hessian.RegisterPOJO(&User{}) config.Load() initZipkin() diff --git a/tracing/dubbo/go-server/pkg/user.go b/tracing/dubbo/go-server/app/user.go similarity index 99% rename from tracing/dubbo/go-server/pkg/user.go rename to tracing/dubbo/go-server/app/user.go index 5e6fb21..3166b1e 100644 --- a/tracing/dubbo/go-server/pkg/user.go +++ b/tracing/dubbo/go-server/app/user.go @@ -15,7 +15,7 @@ * limitations under the License. */ -package pkg +package main import ( "context" diff --git a/tracing/dubbo/go-client/cmd/version.go b/tracing/dubbo/go-server/app/version.go similarity index 100% rename from tracing/dubbo/go-client/cmd/version.go rename to tracing/dubbo/go-server/app/version.go diff --git a/tracing/dubbo/go-server/conf/client.yml b/tracing/dubbo/go-server/conf/client.yml deleted file mode 100644 index 3bcc1cd..0000000 --- a/tracing/dubbo/go-server/conf/client.yml +++ /dev/null @@ -1,61 +0,0 @@ -# dubbo client yaml configure file - - -check: true -# client -request_timeout : "3s" -# connect timeout -connect_timeout : "3s" - -# application config -application: - organization : "ikurento.com" - name : "BDTService" - module : "dubbogo user-info client" - version : "0.0.1" - owner : "ZX" - environment : "test" - -registries : - "hangzhouzk": - protocol: "zookeeper" - timeout : "3s" - address: "127.0.0.1:2181" - username: "" - password: "" - -references: - "UserProvider": - # 可以指定多个registry,使用逗号隔开;不指定默认向所有注册中心注册 - registry: "hangzhouzk" - protocol : "dubbo" - interface : "com.ikurento.user.UserProvider" - cluster: "failover" - methods : - - name: "GetUser" - retries: 3 - -protocol_conf: - dubbo: - reconnect_interval: 0 - connection_number: 2 - heartbeat_period: "5s" - session_timeout: "180s" - pool_size: 64 - pool_ttl: 600 - getty_session_param: - compress_encoding: false - tcp_no_delay: true - tcp_keep_alive: true - keep_alive_period: "120s" - tcp_r_buf_size: 262144 - tcp_w_buf_size: 65536 - pkg_rq_size: 1024 - pkg_wq_size: 512 - tcp_read_timeout: "1s" - tcp_write_timeout: "5s" - wait_timeout: "1s" - max_msg_len: 10240 - session_name: "client" - -filter: "tracing" \ No newline at end of file diff --git a/tracing/dubbo/go-server/conf/log.yml b/tracing/dubbo/go-server/conf/log.yml deleted file mode 100644 index baee0b7..0000000 --- a/tracing/dubbo/go-server/conf/log.yml +++ /dev/null @@ -1,28 +0,0 @@ - -level: "info" -development: false -disableCaller: false -disableStacktrace: true -sampling: -encoding: "console" - -# encoder -encoderConfig: - messageKey: "message" - levelKey: "level" - timeKey: "time" - nameKey: "logger" - callerKey: "caller" - stacktraceKey: "stacktrace" - lineEnding: "" - levelEncoder: "capitalColor" - timeEncoder: "iso8601" - durationEncoder: "seconds" - callerEncoder: "short" - nameEncoder: "" - -outputPaths: - - "stderr" -errorOutputPaths: - - "stderr" -initialFields: diff --git a/tracing/dubbo/go-server/conf/server.yml b/tracing/dubbo/go-server/conf/server.yml deleted file mode 100644 index 4e101f5..0000000 --- a/tracing/dubbo/go-server/conf/server.yml +++ /dev/null @@ -1,62 +0,0 @@ -# dubbo server yaml configure file - - -# application config -application: - organization : "ikurento.com" - name : "BDTService" - module : "dubbogo user-info server" - version : "0.0.1" - owner : "ZX" - environment : "test" - -registries : - "hangzhouzk": - protocol: "zookeeper" - timeout : "3s" - address: "127.0.0.1:2181" - username: "" - password: "" - - - -services: - "UserProvider": - # 可以指定多个registry,使用逗号隔开;不指定默认向所有注册中心注册 - registry: "hangzhouzk" - protocol : "dubbo" - # 相当于dubbo.xml中的interface - interface : "com.ikurento.user.UserProvider" - loadbalance: "random" - warmup: "100" - cluster: "failover" - methods: - - name: "GetUser" - retries: 1 - loadbalance: "random" - -protocols: - "dubbo": - name: "dubbo" - # ip : "127.0.0.1" - port: 20000 - - -protocol_conf: - dubbo: - session_number: 700 - session_timeout: "180s" - getty_session_param: - compress_encoding: false - tcp_no_delay: true - tcp_keep_alive: true - keep_alive_period: "120s" - tcp_r_buf_size: 262144 - tcp_w_buf_size: 65536 - pkg_rq_size: 1024 - pkg_wq_size: 512 - tcp_read_timeout: "1s" - tcp_write_timeout: "5s" - wait_timeout: "1s" - max_msg_len: 1024 - session_name: "server" diff --git a/tracing/dubbo/go-server/docker/docker-compose.yml b/tracing/dubbo/go-server/docker/docker-compose.yml deleted file mode 100644 index 386a42e..0000000 --- a/tracing/dubbo/go-server/docker/docker-compose.yml +++ /dev/null @@ -1,8 +0,0 @@ -version: '3' - -services: - zookeeper: - image: zookeeper - ports: - - 2181:2181 - restart: on-failure \ No newline at end of file diff --git a/tracing/dubbo/go-server/tests/integration/main_test.go b/tracing/dubbo/go-server/tests/integration/main_test.go deleted file mode 100644 index 9c9dd34..0000000 --- a/tracing/dubbo/go-server/tests/integration/main_test.go +++ /dev/null @@ -1,77 +0,0 @@ -// +build integration - -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package integration - -import ( - "context" - "os" - "testing" - "time" -) - -import ( - hessian "github.com/apache/dubbo-go-hessian2" -) - -import ( - _ "dubbo.apache.org/dubbo-go/v3/cluster/cluster_impl" - _ "dubbo.apache.org/dubbo-go/v3/cluster/loadbalance" - _ "dubbo.apache.org/dubbo-go/v3/common/proxy/proxy_factory" - "dubbo.apache.org/dubbo-go/v3/config" - _ "dubbo.apache.org/dubbo-go/v3/filter/filter_impl" - _ "dubbo.apache.org/dubbo-go/v3/metadata/mapping/memory" - _ "dubbo.apache.org/dubbo-go/v3/metadata/report/zookeeper" - _ "dubbo.apache.org/dubbo-go/v3/metadata/service/inmemory" - _ "dubbo.apache.org/dubbo-go/v3/metadata/service/remoting" - _ "dubbo.apache.org/dubbo-go/v3/protocol/dubbo" - _ "dubbo.apache.org/dubbo-go/v3/registry/protocol" - _ "dubbo.apache.org/dubbo-go/v3/registry/servicediscovery" - _ "dubbo.apache.org/dubbo-go/v3/registry/zookeeper" -) - -var userProvider = new(UserProvider) - -func TestMain(m *testing.M) { - config.SetConsumerService(userProvider) - hessian.RegisterPOJO(&User{}) - config.Load() - time.Sleep(3 * time.Second) - - os.Exit(m.Run()) -} - -type User struct { - Id string - Name string - Age int32 - Time time.Time -} - -type UserProvider struct { - GetUser func(ctx context.Context, req []interface{}, rsp *User) error -} - -func (u *UserProvider) Reference() string { - return "UserProvider" -} - -func (User) JavaClassName() string { - return "com.ikurento.user.User" -} diff --git a/tracing/dubbo/go-server/tests/integration/userprovider_test.go b/tracing/dubbo/go-server/tests/integration/userprovider_test.go deleted file mode 100644 index d795eb9..0000000 --- a/tracing/dubbo/go-server/tests/integration/userprovider_test.go +++ /dev/null @@ -1,74 +0,0 @@ -// +build integration - -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package integration - -import ( - "context" - "testing" -) -import ( - "github.com/dubbogo/gost/log" - "github.com/opentracing/opentracing-go" - zipkinot "github.com/openzipkin-contrib/zipkin-go-opentracing" - "github.com/openzipkin/zipkin-go" - zipkinhttp "github.com/openzipkin/zipkin-go/reporter/http" - "github.com/stretchr/testify/assert" - - "dubbo.apache.org/dubbo-go/v3/common/logger" -) - -func TestGetUser(t *testing.T) { - initZipkin() - gxlog.CInfo("\n\n\nstart to test dubbo") - user := &User{} - span, ctx := opentracing.StartSpanFromContext(context.Background(), "Test-Client-Service") - err := userProvider.GetUser(ctx, []interface{}{"A001"}, user) - span.Finish() - assert.Nil(t, err) - - gxlog.CInfo("response result: %v\n", user) - //assert.Equal(t, "A001", user.Id) - assert.Equal(t, "Alex Stocks", user.Name) - assert.Equal(t, int32(18), user.Age) - assert.NotNil(t, user.Time) -} - -func initZipkin() { - // set up a span reporter - reporter := zipkinhttp.NewReporter("http://localhost:9411/api/v2/spans") - - // create our local service endpoint - endpoint, err := zipkin.NewEndpoint("myService", "myservice.mydomain.com:80") - if err != nil { - logger.Errorf("unable to create local endpoint: %+v\n", err) - } - - // initialize our tracer - nativeTracer, err := zipkin.NewTracer(reporter, zipkin.WithLocalEndpoint(endpoint)) - if err != nil { - logger.Errorf("unable to create tracer: %+v\n", err) - } - - // use zipkin-go-opentracing to wrap our tracer - tracer := zipkinot.Wrap(nativeTracer) - - // optionally set as Global OpenTracing tracer instance - opentracing.SetGlobalTracer(tracer) -}
