You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@dubbo.apache.org by zh...@apache.org on 2021/09/04 15:57:50 UTC

[dubbo-go-samples] 08/18: Ftr: Add integration test multi-server support (#158)

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 e834a934184c098cce3ee6acddfe58a6c19a89b9
Author: EnableAsync <43...@users.noreply.github.com>
AuthorDate: Thu Jul 8 14:28:21 2021 +0800

    Ftr: Add integration test multi-server support (#158)
    
    Fix: add consumer config for middle
    
    Ftr: add multi-zone to integration testing
    
    Fix: start_integrate_test.sh
    
    Fix: start_integrate_test.sh
    
    Fix: test.sh
---
 chain/build/test.sh      | 44 ++++++++++++++++++++++++++++++++++++++++++++
 integrate_test.sh        | 22 ++++++++++++++--------
 multi-zone/build/test.sh | 45 +++++++++++++++++++++++++++++++++++++++++++++
 start_integrate_test.sh  | 13 ++++++++-----
 4 files changed, 111 insertions(+), 13 deletions(-)

diff --git a/chain/build/test.sh b/chain/build/test.sh
new file mode 100755
index 0000000..8cff497
--- /dev/null
+++ b/chain/build/test.sh
@@ -0,0 +1,44 @@
+# 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, softwarek
+# 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.
+
+# This file is for integration testing only
+
+P_DIR="$1"
+
+# start zookeeper
+make PROJECT_DIR="$P_DIR" PROJECT_NAME="$(basename "$P_DIR")" BASE_DIR="$P_DIR"/dist -f build/Makefile docker-up
+
+# start server
+make PROJECT_DIR="$P_DIR"/backend PROJECT_NAME="$(basename "$P_DIR"/backend)" BASE_DIR="$P_DIR"/backend/dist -f build/Makefile start
+make PROJECT_DIR="$P_DIR"/middle PROJECT_NAME="$(basename "$P_DIR"/middle)" CONF_CONSUMER_FILE_PATH="$P_DIR"/middle/conf/client.yml BASE_DIR="$P_DIR"/middle/dist -f build/Makefile start
+
+# start integration testing
+make PROJECT_DIR="$P_DIR"/backend PROJECT_NAME="$(basename "$P_DIR"/backend)" BASE_DIR="$P_DIR"/backend/dist -f build/Makefile integration
+result=$?
+
+make PROJECT_DIR="$P_DIR"/middle PROJECT_NAME="$(basename "$P_DIR"/middle)" BASE_DIR="$P_DIR"/middle/dist CONF_CONSUMER_FILE_PATH="$P_DIR"/middle/conf/test.yml -f build/Makefile integration
+result2=$?
+
+if [ $result -eq 0 ]; then
+    result=$result2
+fi
+
+# stop server and clean
+make PROJECT_DIR="$P_DIR"/backend PROJECT_NAME="$(basename "$P_DIR"/backend)" BASE_DIR="$P_DIR"/backend/dist -f build/Makefile clean
+make PROJECT_DIR="$P_DIR"/middle PROJECT_NAME="$(basename "$P_DIR"/middle)" BASE_DIR="$P_DIR"/middle/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
+
+exit $result
diff --git a/integrate_test.sh b/integrate_test.sh
old mode 100644
new mode 100755
index 16e6915..bd6d076
--- a/integrate_test.sh
+++ b/integrate_test.sh
@@ -15,22 +15,28 @@
 #  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
 
-make PROJECT_DIR=$P_DIR PROJECT_NAME=$(basename $P_DIR) BASE_DIR=$P_DIR/dist -f build/Makefile docker-up
+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
 
 # 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=$?
 # 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))
\ No newline at end of file
+exit $((result))
diff --git a/multi-zone/build/test.sh b/multi-zone/build/test.sh
new file mode 100755
index 0000000..836fea6
--- /dev/null
+++ b/multi-zone/build/test.sh
@@ -0,0 +1,45 @@
+# 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, softwarek
+# 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.
+
+# This file is for integration testing only
+
+P_DIR="$1"
+
+# start zookeeper
+make PROJECT_DIR="$P_DIR" PROJECT_NAME="$(basename "$P_DIR")" BASE_DIR="$P_DIR"/dist -f build/Makefile docker-up
+
+# start server
+make PROJECT_DIR="$P_DIR"/go-server-hz PROJECT_NAME="$(basename "$P_DIR"/go-server-hz)" BASE_DIR="$P_DIR"/go-server-hz/dist -f build/Makefile start
+make PROJECT_DIR="$P_DIR"/go-server-sh PROJECT_NAME="$(basename "$P_DIR"/go-server-sh)" BASE_DIR="$P_DIR"/go-server-sh/dist -f build/Makefile start
+
+# start integration testing
+make PROJECT_DIR="$P_DIR"/go-server-hz PROJECT_NAME="$(basename "$P_DIR"/go-server-hz)" BASE_DIR="$P_DIR"/go-server-hz/dist -f build/Makefile integration
+result=$?
+
+make PROJECT_DIR="$P_DIR"/go-server-sh PROJECT_NAME="$(basename "$P_DIR"/go-server-sh)" BASE_DIR="$P_DIR"/go-server-sh/dist -f build/Makefile integration
+result2=$?
+
+if [ $result -eq 0 ]; then
+    result=$result2
+fi
+
+# stop server and clean
+make PROJECT_DIR="$P_DIR"/go-server-hz PROJECT_NAME="$(basename "$P_DIR"/go-server-hz)" BASE_DIR="$P_DIR"/go-server-hz/dist -f build/Makefile clean
+make PROJECT_DIR="$P_DIR"/go-server-sh PROJECT_NAME="$(basename "$P_DIR"/go-server-sh)" BASE_DIR="$P_DIR"/go-server-sh/dist -f build/Makefile clean
+
+# stop zookeeper
+make PROJECT_DIR="$P_DIR" PROJECT_NAME="$(basename "$P_DIR")" BASE_DIR="$P_DIR"/dist -f build/Makefile docker-down
+
+exit $result
\ No newline at end of file
diff --git a/start_integrate_test.sh b/start_integrate_test.sh
index 181d229..0ebe563 100755
--- a/start_integrate_test.sh
+++ b/start_integrate_test.sh
@@ -23,6 +23,9 @@ array=("async/go-server")
 # attachment
 array+=("attachment/go-server")
 
+# chain
+array+=("chain")
+
 # config-api
 array+=("config-api/go-server")
 
@@ -65,6 +68,9 @@ array+=("helloworld/go-server")
 # metric
 array+=("metric/go-server")
 
+# multi-zone
+array+=("multi-zone")
+
 # registry
 #array+=("registry/etcd/go-server")
 #array+=("registry/nacos/go-server")
@@ -87,12 +93,9 @@ array+=("version/go-server-v2")
 
 for((i=0;i<${#array[*]};i++))
 do
-	./integrate_test.sh ${array[i]}
+	./integrate_test.sh "${array[i]}"
 	result=$?
 	if [ $result -gt 0 ]; then
-    exit $result
+        exit $result
 	fi
 done
-
-# chain
-# multi-zone
\ No newline at end of file