This is an automated email from the ASF dual-hosted git repository. zhaoyunxing pushed a commit to branch 1.5 in repository https://gitbox.apache.org/repos/asf/dubbo-go-samples.git
commit 910b0bc5805b2b2dbc2c0bc59b0d3d96a11c7d49 Author: Laurence <[email protected]> AuthorDate: Sat Jul 10 18:22:57 2021 +0800 fix: 1.5 ci test (#165) * fix: 1.5 ci test * fix: fix etcd network * fix: fix etcd network * Fix: comment consul integ test * fix: fix etcd and nacos config * fix: fix nacos --- .../tests/integration/userprovider_test.go | 5 --- build/Makefile | 14 +++++- .../nacos/go-server/docker/docker-compose.yml | 8 ++-- .../nacos/go-server/docker/docker-health-check.sh | 3 ++ general/dubbo3/.DS_Store | Bin 0 -> 6148 bytes general/dubbo3/pb/.DS_Store | Bin 0 -> 6148 bytes go.mod | 3 +- go.sum | 4 ++ integrate_test.sh | 29 +++++++------ multi-registry/go-server/docker/docker-compose.yml | 8 +++- .../go-server/docker/docker-health-check.sh | 3 ++ registry/etcd/go-server/docker/docker-compose.yml | 12 ++---- registry/nacos/go-server/docker/docker-compose.yml | 7 ++- .../nacos/go-server/docker/docker-health-check.sh | 3 ++ .../etcd/go-server/docker/docker-compose.yml | 6 +-- .../file/go-server/tests/integration/main_test.go | 1 + .../nacos/go-server/docker/docker-compose.yml | 7 ++- .../nacos/go-server/docker/docker-health-check.sh | 3 ++ start_integrate_test.sh | 47 +++++++-------------- 19 files changed, 90 insertions(+), 73 deletions(-) diff --git a/async/go-server/tests/integration/userprovider_test.go b/async/go-server/tests/integration/userprovider_test.go index 947d2cb..fa08987 100644 --- a/async/go-server/tests/integration/userprovider_test.go +++ b/async/go-server/tests/integration/userprovider_test.go @@ -38,12 +38,7 @@ func TestGetUser(t *testing.T) { user := &User{} err := userProvider.GetUser(context.TODO(), []interface{}{"A001"}, user) assert.Nil(t, err) - assert.Equal(t, "", user.ID) - assert.Equal(t, "", user.Name) - assert.Equal(t, int32(0), user.Age) - user = <-userProvider.ch - assert.NotNil(t, user) assert.Equal(t, "A001", user.ID) assert.Equal(t, "Alex Stocks", user.Name) diff --git a/build/Makefile b/build/Makefile index efec57c..364ba5c 100644 --- a/build/Makefile +++ b/build/Makefile @@ -87,6 +87,12 @@ config: @-test -f $(PROJECT_DIR)/conf/client.yml && cat $(PROJECT_DIR)/conf/client.yml | sed "s#\$$HOST_IP#$(DOCKER_HOST_IP)#g" > $(OUT_DIR)/conf/client.yml && echo " > $(OUT_DIR)/conf/client.yml" @-test -f $(PROJECT_DIR)/conf/router_config.yml && cat $(PROJECT_DIR)/conf/router_config.yml | sed "s#\$$HOST_IP#$(DOCKER_HOST_IP)#g" > $(OUT_DIR)/conf/router_config.yml && echo " > $(OUT_DIR)/conf/router_config.yml" +## docker-health-check: check services health on docker +.PHONY: docker-health-check +docker-health-check: + $(info > run docker health check with $(PROJECT_DIR)/docker/docker-health-check.sh) + @-test -f $(PROJECT_DIR)/docker/docker-health-check.sh && bash -f $(PROJECT_DIR)/docker/docker-health-check.sh + ## docker-up: Shutdown dependency services on docker .PHONY: docker-up docker-up: @@ -114,6 +120,12 @@ start: build @-$(OUT_DIR)/$(PROJECT_NAME)$(EXT_NAME) > $(LOG_FILE) 2>&1 & echo $$! > $(PID) @cat $(PID) | sed "/^/s/^/ \> PID: /" +## start: print application log (for server) +.PHONY: print-server-log +print-server-log: + $(info > print server log with $(LOG_FILE)) + @-cat $(LOG_FILE) + ## run: Run the application (for client) .PHONY: run run: export CONF_CONSUMER_FILE_PATH ?= $(OUT_DIR)/conf/client.yml @@ -136,4 +148,4 @@ integration: export CONF_ROUTER_FILE_PATH ?= $(OUT_DIR)/conf/router_config.yml integration: $(info > Running integration test for application $(PROJECT_NAME)) @go clean -testcache - @go test -tags integration -v $(PROJECT_DIR)/tests/... \ No newline at end of file + @go test -tags integration -v $(PROJECT_DIR)/tests/... diff --git a/configcenter/nacos/go-server/docker/docker-compose.yml b/configcenter/nacos/go-server/docker/docker-compose.yml index 83e1311..d9d8b8c 100644 --- a/configcenter/nacos/go-server/docker/docker-compose.yml +++ b/configcenter/nacos/go-server/docker/docker-compose.yml @@ -6,12 +6,14 @@ services: ports: - 2181:2181 restart: on-failure - nacos: - image: nacos/nacos-server:latest + image: nacos/nacos-server:1.4.1 container_name: nacos-standalone environment: - PREFER_HOST_MODE=hostname - MODE=standalone ports: - - "8848:8848" \ No newline at end of file + - "8848:8848" + healthcheck: + test: "curl --fail http://127.0.0.1:8848/nacos/v1/console/health/liveness || exit 1" + interval: 5s diff --git a/configcenter/nacos/go-server/docker/docker-health-check.sh b/configcenter/nacos/go-server/docker/docker-health-check.sh new file mode 100644 index 0000000..e6b78dc --- /dev/null +++ b/configcenter/nacos/go-server/docker/docker-health-check.sh @@ -0,0 +1,3 @@ +sleep 10 +curl http://127.0.0.1:8848/nacos/v1/console/health/liveness +sleep 30 diff --git a/general/dubbo3/.DS_Store b/general/dubbo3/.DS_Store new file mode 100644 index 0000000..b85adcb Binary files /dev/null and b/general/dubbo3/.DS_Store differ diff --git a/general/dubbo3/pb/.DS_Store b/general/dubbo3/pb/.DS_Store new file mode 100644 index 0000000..e7e3e36 Binary files /dev/null and b/general/dubbo3/pb/.DS_Store differ diff --git a/go.mod b/go.mod index e8ae5c3..66e33eb 100644 --- a/go.mod +++ b/go.mod @@ -5,7 +5,7 @@ require ( github.com/Microsoft/go-winio v0.4.15-0.20190919025122-fc70bd9a86b5 // indirect github.com/alibaba/sentinel-golang v1.0.2 github.com/apache/dubbo-getty v1.4.3 - github.com/apache/dubbo-go v1.5.7-rc1 + github.com/apache/dubbo-go v1.5.7-rc1-tmp.0.20210705022741-5520fa1783c9 github.com/apache/dubbo-go-hessian2 v1.9.2 github.com/bwmarrin/snowflake v0.3.0 github.com/docker/go-connections v0.4.0 // indirect @@ -25,6 +25,7 @@ require ( github.com/pkg/errors v0.9.1 github.com/prometheus/client_golang v1.9.0 github.com/stretchr/testify v1.7.0 + github.com/tinylib/msgp v1.1.0 // indirect github.com/transaction-wg/seata-golang v0.2.1-alpha github.com/uber/jaeger-client-go v2.22.1+incompatible github.com/uber/jaeger-lib v2.2.0+incompatible // indirect diff --git a/go.sum b/go.sum index 357b231..7aa9179 100644 --- a/go.sum +++ b/go.sum @@ -64,6 +64,8 @@ github.com/PuerkitoBio/purell v1.0.0/go.mod h1:c11w/QuzBsJSee3cPx9rAFu61PvFxuPbt github.com/PuerkitoBio/urlesc v0.0.0-20160726150825-5bd2802263f2/go.mod h1:uGdkoq3SwY9Y+13GIhn11/XLaGBb4BfwItxLd5jeuXE= github.com/RoaringBitmap/roaring v0.5.5 h1:naNqvO1mNnghk2UvcsqnzHDBn9DRbCIRy94GmDTRVTQ= github.com/RoaringBitmap/roaring v0.5.5/go.mod h1:puNo5VdzwbaIQxSiDIwfXl4Hnc+fbovcX4IW/dSTtUk= +github.com/RoaringBitmap/roaring v0.6.1 h1:O36Tdaj1Fi/zyr25shTHwlQPGdq53+u4WkM08AOEjiE= +github.com/RoaringBitmap/roaring v0.6.1/go.mod h1:WZ83fjBF/7uBHi6QoFyfGL4+xuV4Qn+xFkm4+vSzrhE= github.com/Shopify/sarama v1.19.0/go.mod h1:FVkBWblsNy7DGZRfXLU0O9RCGt5g3g3yEuWXgklEdEo= github.com/Shopify/toxiproxy v2.1.4+incompatible/go.mod h1:OXgGpZ6Cli1/URJOF1DMxUHB2q5Ap20/P/eIdh4G0pI= github.com/StackExchange/wmi v0.0.0-20180116203802-5d049714c4a6/go.mod h1:3eOhrUMpNV+6aFIbp5/iudMxNCF27Vw2OZgy4xEx0Fg= @@ -97,6 +99,8 @@ github.com/apache/dubbo-go v1.5.6 h1:iTMrXo8jB6DxKOhM83NKDnGA8c9ZPnofCOos/GvKyF8 github.com/apache/dubbo-go v1.5.6/go.mod h1:wLJvPWbnrf6/bhoohBT404QK4t2JoNcckMw+/fJ9P+c= github.com/apache/dubbo-go v1.5.7-rc1 h1:PBK/Ox35L8QH85eBmHAqsg/EL2SnO+xwcCw67lQ4z4Q= github.com/apache/dubbo-go v1.5.7-rc1/go.mod h1:wLJvPWbnrf6/bhoohBT404QK4t2JoNcckMw+/fJ9P+c= +github.com/apache/dubbo-go v1.5.7-rc1-tmp.0.20210705022741-5520fa1783c9 h1:PZuFw8Ueg78qK7UOwenvybOP+IWGEY7VIOwN6wGQf6k= +github.com/apache/dubbo-go v1.5.7-rc1-tmp.0.20210705022741-5520fa1783c9/go.mod h1:6Hvmwl8GoXTfw7niSzn60yvUp6FAzcv5K+x++MoCoD4= github.com/apache/dubbo-go-hessian2 v1.8.2 h1:CQq2Mmlrk6Fqmudwl9Dqps8drTrBFnmXRlzgOjj0FqA= github.com/apache/dubbo-go-hessian2 v1.8.2/go.mod h1:xQUjE7F8PX49nm80kChFvepA/AvqAZ0oh/UaB6+6pBE= github.com/apache/dubbo-go-hessian2 v1.9.1 h1:ceSsU/9z/gv3hzUpl8GceEhQvF3i0BionfdHUGMmjHU= diff --git a/integrate_test.sh b/integrate_test.sh index bd6d076..8ae516c 100755 --- a/integrate_test.sh +++ b/integrate_test.sh @@ -15,28 +15,31 @@ # limitations under the License. if [ -z "$1" ]; then - echo "Provide test directory please, like : ./integrate_test.sh $(pwd)/helloworld/go-server ." - exit + echo "Provide test directory please, like : ./integrate_test.sh $(pwd)/helloworld/go-server ." + exit fi P_DIR=$(pwd)/$1 -if [ -f "$P_DIR"/build/test.sh ]; then - "$P_DIR"/build/test.sh "$P_DIR" - result=$? - exit $((result)) -fi +make PROJECT_DIR=$P_DIR PROJECT_NAME=$(basename $P_DIR) BASE_DIR=$P_DIR/dist -f build/Makefile docker-up -make PROJECT_DIR="$P_DIR" PROJECT_NAME="$(basename $P_DIR)" BASE_DIR="$P_DIR"/dist -f build/Makefile docker-up +# check docker health +make PROJECT_DIR=$P_DIR PROJECT_NAME=$(basename $P_DIR) BASE_DIR=$P_DIR/dist -f build/Makefile docker-health-check # start server -make PROJECT_DIR="$P_DIR" PROJECT_NAME="$(basename $P_DIR)" BASE_DIR="$P_DIR"/dist -f build/Makefile start +make PROJECT_DIR=$P_DIR PROJECT_NAME=$(basename $P_DIR) BASE_DIR=$P_DIR/dist -f build/Makefile start # start integration -make PROJECT_DIR="$P_DIR" PROJECT_NAME="$(basename $P_DIR)" BASE_DIR="$P_DIR"/dist -f build/Makefile integration +make PROJECT_DIR=$P_DIR PROJECT_NAME=$(basename $P_DIR) BASE_DIR=$P_DIR/dist -f build/Makefile integration result=$? + +# if fail print server log +if [ $result != 0 ];then + make PROJECT_DIR=$P_DIR PROJECT_NAME=$(basename $P_DIR) BASE_DIR=$P_DIR/dist -f build/Makefile print-server-log +fi + # stop server -make PROJECT_DIR="$P_DIR" PROJECT_NAME="$(basename $P_DIR)" BASE_DIR="$P_DIR"/dist -f build/Makefile clean +make PROJECT_DIR=$P_DIR PROJECT_NAME=$(basename $P_DIR) BASE_DIR=$P_DIR/dist -f build/Makefile clean -make PROJECT_DIR="$P_DIR" PROJECT_NAME="$(basename $P_DIR)" BASE_DIR="$P_DIR"/dist -f build/Makefile docker-down +make PROJECT_DIR=$P_DIR PROJECT_NAME=$(basename $P_DIR) BASE_DIR=$P_DIR/dist -f build/Makefile docker-down -exit $((result)) +exit $((result)) \ No newline at end of file diff --git a/multi-registry/go-server/docker/docker-compose.yml b/multi-registry/go-server/docker/docker-compose.yml index 0bbbe19..9247bf0 100644 --- a/multi-registry/go-server/docker/docker-compose.yml +++ b/multi-registry/go-server/docker/docker-compose.yml @@ -8,9 +8,9 @@ services: - dubbo ports: - 2181:2181 - naocs: + nacos: image: nacos/nacos-server:1.4.1 - container_name: nacos + container_name: nacos-standalone networks: - dubbo environment: @@ -18,6 +18,10 @@ services: - MODE=standalone ports: - "8848:8848" + healthcheck: + test: "curl --fail http://127.0.0.1:8848/nacos/v1/console/health/liveness || exit 1" + interval: 5s + # 网络 networks: dubbo: diff --git a/multi-registry/go-server/docker/docker-health-check.sh b/multi-registry/go-server/docker/docker-health-check.sh new file mode 100644 index 0000000..e6b78dc --- /dev/null +++ b/multi-registry/go-server/docker/docker-health-check.sh @@ -0,0 +1,3 @@ +sleep 10 +curl http://127.0.0.1:8848/nacos/v1/console/health/liveness +sleep 30 diff --git a/registry/etcd/go-server/docker/docker-compose.yml b/registry/etcd/go-server/docker/docker-compose.yml index 76a483e..50f97ae 100644 --- a/registry/etcd/go-server/docker/docker-compose.yml +++ b/registry/etcd/go-server/docker/docker-compose.yml @@ -4,24 +4,18 @@ services: etcd: image: "quay.io/coreos/etcd:latest" container_name: etcd - networks: - - dubbo environment: - ETCDCTL_API=3 command: [ "etcd", "--name=etcd0", - "--advertise-client-urls=http://${DOCKER_HOST_IP}:2379", + "--advertise-client-urls=http://127.0.0.1:2379", "--listen-client-urls=http://0.0.0.0:2379", - "--initial-advertise-peer-urls=http://${DOCKER_HOST_IP}:2380", + "--initial-advertise-peer-urls=http://127.0.0.1:2380", "--listen-peer-urls=http://0.0.0.0:2380", - "--initial-cluster=etcd0=http://${DOCKER_HOST_IP}:2380", + "--initial-cluster=etcd0=http://127.0.0.1:2380", ] ports: - "2379:2379" - "2380:2380" restart: always -networks: - dubbo: - name: dubbo-go-samples - driver: bridge diff --git a/registry/nacos/go-server/docker/docker-compose.yml b/registry/nacos/go-server/docker/docker-compose.yml index 4b1d3d3..168ad5f 100644 --- a/registry/nacos/go-server/docker/docker-compose.yml +++ b/registry/nacos/go-server/docker/docker-compose.yml @@ -2,10 +2,13 @@ version: "3" services: nacos: - image: nacos/nacos-server:latest + image: nacos/nacos-server:1.4.1 container_name: nacos-standalone environment: - PREFER_HOST_MODE=hostname - MODE=standalone ports: - - "8848:8848" \ No newline at end of file + - "8848:8848" + healthcheck: + test: "curl --fail http://127.0.0.1:8848/nacos/v1/console/health/liveness || exit 1" + interval: 5s diff --git a/registry/nacos/go-server/docker/docker-health-check.sh b/registry/nacos/go-server/docker/docker-health-check.sh new file mode 100644 index 0000000..e6b78dc --- /dev/null +++ b/registry/nacos/go-server/docker/docker-health-check.sh @@ -0,0 +1,3 @@ +sleep 10 +curl http://127.0.0.1:8848/nacos/v1/console/health/liveness +sleep 30 diff --git a/registry/servicediscovery/etcd/go-server/docker/docker-compose.yml b/registry/servicediscovery/etcd/go-server/docker/docker-compose.yml index 18c9d27..50f97ae 100644 --- a/registry/servicediscovery/etcd/go-server/docker/docker-compose.yml +++ b/registry/servicediscovery/etcd/go-server/docker/docker-compose.yml @@ -9,11 +9,11 @@ services: command: [ "etcd", "--name=etcd0", - "--advertise-client-urls=http://${DOCKER_HOST_IP}:2379", + "--advertise-client-urls=http://127.0.0.1:2379", "--listen-client-urls=http://0.0.0.0:2379", - "--initial-advertise-peer-urls=http://${DOCKER_HOST_IP}:2380", + "--initial-advertise-peer-urls=http://127.0.0.1:2380", "--listen-peer-urls=http://0.0.0.0:2380", - "--initial-cluster=etcd0=http://${DOCKER_HOST_IP}:2380", + "--initial-cluster=etcd0=http://127.0.0.1:2380", ] ports: - "2379:2379" diff --git a/registry/servicediscovery/file/go-server/tests/integration/main_test.go b/registry/servicediscovery/file/go-server/tests/integration/main_test.go index feb6fe2..86de468 100644 --- a/registry/servicediscovery/file/go-server/tests/integration/main_test.go +++ b/registry/servicediscovery/file/go-server/tests/integration/main_test.go @@ -32,6 +32,7 @@ import ( _ "github.com/apache/dubbo-go/metadata/service/inmemory" _ "github.com/apache/dubbo-go/protocol/dubbo" _ "github.com/apache/dubbo-go/registry/consul" + _ "github.com/apache/dubbo-go/registry/file" _ "github.com/apache/dubbo-go/registry/protocol" _ "github.com/apache/dubbo-go/registry/servicediscovery" ) diff --git a/registry/servicediscovery/nacos/go-server/docker/docker-compose.yml b/registry/servicediscovery/nacos/go-server/docker/docker-compose.yml index 4b1d3d3..168ad5f 100644 --- a/registry/servicediscovery/nacos/go-server/docker/docker-compose.yml +++ b/registry/servicediscovery/nacos/go-server/docker/docker-compose.yml @@ -2,10 +2,13 @@ version: "3" services: nacos: - image: nacos/nacos-server:latest + image: nacos/nacos-server:1.4.1 container_name: nacos-standalone environment: - PREFER_HOST_MODE=hostname - MODE=standalone ports: - - "8848:8848" \ No newline at end of file + - "8848:8848" + healthcheck: + test: "curl --fail http://127.0.0.1:8848/nacos/v1/console/health/liveness || exit 1" + interval: 5s diff --git a/registry/servicediscovery/nacos/go-server/docker/docker-health-check.sh b/registry/servicediscovery/nacos/go-server/docker/docker-health-check.sh new file mode 100644 index 0000000..e6b78dc --- /dev/null +++ b/registry/servicediscovery/nacos/go-server/docker/docker-health-check.sh @@ -0,0 +1,3 @@ +sleep 10 +curl http://127.0.0.1:8848/nacos/v1/console/health/liveness +sleep 30 diff --git a/start_integrate_test.sh b/start_integrate_test.sh index 0ebe563..add9bdc 100755 --- a/start_integrate_test.sh +++ b/start_integrate_test.sh @@ -14,25 +14,8 @@ # See the License for the specific language governing permissions and # limitations under the License. -# multi-registry -array+=("multi-registry/go-server") -# async -array=("async/go-server") - -# attachment -array+=("attachment/go-server") - -# chain -array+=("chain") - -# config-api -array+=("config-api/go-server") - -# config center -array+=("configcenter/apollo/go-server") -array+=("configcenter/nacos/go-server") -array+=("configcenter/zookeeper/go-server") +# Attention! when runing on Apple M1, pls start nacos&zk server on your computer first, and comment samples with # M1 ignore. # context array+=("context/go-server") @@ -46,14 +29,14 @@ array+=("filter/tpslimit/go-server") array+=("filter/sentinel/go-server") # game -#array+=("game/go-server-game") -#array+=("game/go-server-gate") +#array+=("game/go-server-game") # Bug +#array+=("game/go-server-gate") # Bug # general array+=("general/dubbo/go-server") array+=("general/grpc/go-server") -#array+=("general/jsonrpc/go-server") -#array+=("general/rest/go-server") +#array+=("general/jsonrpc/go-server") # Unsupported +#array+=("general/rest/go-server") # Unsupported # generic array+=("generic/go-server") @@ -69,23 +52,23 @@ array+=("helloworld/go-server") array+=("metric/go-server") # multi-zone -array+=("multi-zone") +#array+=("multi-zone") # Unsupported # registry -#array+=("registry/etcd/go-server") -#array+=("registry/nacos/go-server") -#array+=("registry/servicediscovery/consul/go-server") -#array+=("registry/servicediscovery/etcd/go-server") -#array+=("registry/servicediscovery/file/go-server") -#array+=("registry/servicediscovery/nacos/go-server") +array=("registry/etcd/go-server") # M1 ignore +array+=("registry/nacos/go-server") +#array+=("registry/servicediscovery/consul/go-server") # M1 ignore & Bug +array+=("registry/servicediscovery/etcd/go-server") # M1 ignore +array+=("registry/servicediscovery/file/go-server") +array+=("registry/servicediscovery/nacos/go-server") array+=("registry/servicediscovery/zookeeper/go-server") # router -#array+=("router/condition/go-server") -#array+=("router/tag/go-server") +#array+=("router/condition/go-server") # Bug +#array+=("router/tag/go-server") # Bug # tls -#array+=("tls/go-server") +#array+=("tls/go-server") # Bug # version array+=("version/go-server-v1")
