This is an automated email from the ASF dual-hosted git repository.

dmwangnima pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/dubbo-go-samples.git


The following commit(s) were added to refs/heads/main by this push:
     new d7d1d095 Update start_integrate_test.sh (#714)
d7d1d095 is described below

commit d7d1d095dbfd522c2db3f37cf332fcd2836a0f93
Author: Tom <[email protected]>
AuthorDate: Tue Mar 12 14:27:00 2024 +0800

    Update start_integrate_test.sh (#714)
---
 start_integrate_test.sh | 31 ++++++++++++++++++-------------
 1 file changed, 18 insertions(+), 13 deletions(-)

diff --git a/start_integrate_test.sh b/start_integrate_test.sh
index 0de5c295..d78f1d8d 100755
--- a/start_integrate_test.sh
+++ b/start_integrate_test.sh
@@ -111,19 +111,24 @@ array+=("compatibility/registry/all/nacos")
 
 # replace tls config
 echo "The prefix of certificate path of the following files were replaced to 
\"$(pwd)/tls\"."
-find $(pwd)/tls -type f -name '*.yml' -print0 | xargs -0 -n1
-find $(pwd)/tls -type f -name '*.yml' -print0 | xargs -0 sed -i  
's#\.\.\/\.\.\/\.\.#'"$(pwd)/tls"'#g'
+find "$(pwd)/tls" -type f -name '*.yml' -print0 | xargs -0 -n1
+find "$(pwd)/tls" -type f -name '*.yml' -print0 | xargs -0 sed -i 
's#\.\.\/\.\.\/\.\.#'"$(pwd)/tls"'#g'
 
 DOCKER_DIR=$(pwd)/integrate_test/dockercompose
-docker-compose -f $DOCKER_DIR/docker-compose.yml up -d
-bash -f $DOCKER_DIR/docker-health-check.sh
-for ((i=0;i<${#array[*]};i++))
-do
-       ./integrate_test.sh "${array[i]}"
-       result=$?
-       if [ $result -gt 0 ]; then
-             docker-compose -f $DOCKER_DIR/docker-compose.yml down
-        exit $result
-       fi
+DOCKER_COMPOSE_CMD="docker-compose"
+
+if [ "$(docker compose version > /dev/null; echo $?)" -eq 0 ]; then
+  DOCKER_COMPOSE_CMD="docker compose"
+fi
+
+$DOCKER_COMPOSE_CMD -f "$DOCKER_DIR"/docker-compose.yml up -d
+bash -f "$DOCKER_DIR"/docker-health-check.sh
+for ((i = 0; i < ${#array[*]}; i++)); do
+  ./integrate_test.sh "${array[i]}"
+  result=$?
+  if [ $result -gt 0 ]; then
+    $DOCKER_COMPOSE_CMD -f "$DOCKER_DIR"/docker-compose.yml down
+    exit $result
+  fi
 done
-docker-compose -f $DOCKER_DIR/docker-compose.yml down
+$DOCKER_COMPOSE_CMD -f "$DOCKER_DIR"/docker-compose.yml down

Reply via email to