From 344560bdaaa8e1cda3cd07d2c6895e9a5bf3db17 Mon Sep 17 00:00:00 2001
From: Shinsuke Sugaya <shinsuke@apache.org>
Date: Thu, 11 Aug 2022 08:52:22 +0900
Subject: [PATCH] update test scripts

---
 src/test/resources/before_script.sh | 21 +++++++++++----------
 src/test/resources/run.sh           |  6 ++----
 2 files changed, 13 insertions(+), 14 deletions(-)

diff --git a/src/test/resources/before_script.sh b/src/test/resources/before_script.sh
index 8c05d4f0a..30c66ef74 100644
--- a/src/test/resources/before_script.sh
+++ b/src/test/resources/before_script.sh
@@ -1,25 +1,26 @@
-#!/bin/sh
+#!/bin/bash
 
 TMP_FILE=/tmp/fess-build.$$
 unzip target/releases/fess-*.zip 2>&1 > $TMP_FILE
 tail $TMP_FILE
 
 ./fess-*/bin/fess 2>&1 > $TMP_FILE &
-sleep 3
+
+pushd /tmp
+git clone https://github.com/codelibs/fess-testdata.git
+popd
+
 tail $TMP_FILE
 touch `ls -d ./fess-*`/logs/fess-crawler.log
 tail -f ./fess-*/logs/*.log &
 
 counter=0
 ret=1
-while [ $ret != 0 -a $counter != 60 ] ; do
+while [ $ret != 0 -a $counter != 180 ] ; do
   echo "Ping Fess... $counter"
-  curl -v 127.0.0.1:8080/json/?type=ping
-  #ret=$?
-  ret=1
-  sleep 5
-  counter=`expr $counter + 1`
+  curl -v "localhost:8080/json/?type=ping"
+  ret=$?
+  sleep 1
+  counter=$((counter + 1))
 done
 
-cd /tmp
-git clone https://github.com/codelibs/fess-testdata.git
diff --git a/src/test/resources/run.sh b/src/test/resources/run.sh
index c20fbe157..9b47cbf89 100644
--- a/src/test/resources/run.sh
+++ b/src/test/resources/run.sh
@@ -1,14 +1,12 @@
 #!/bin/bash
 
-cd `dirname $0`
-cd ../../..
-BASE_DIR=`pwd`
+tail -f ./fess-*/logs/*.log &
 
 mvn test -P integrationTests -Dtest.fess.url="http://127.0.0.1:8080" -Dtest.es.url="http://127.0.0.1:9201"
 ret=$?
 
 if [ $ret != 0 ] ; then
-  for f in `find $BASE_DIR -type f | grep surefire-reports | grep -v /TEST-` ; do
+  for f in `find ./target -type f | grep surefire-reports | grep -v /TEST-` ; do
     cat $f
   done
 fi
-- 
GitLab