membphis commented on a change in pull request #796:
URL: https://github.com/apache/apisix-dashboard/pull/796#discussion_r523689423



##########
File path: api/test/shell/cli_test.sh
##########
@@ -34,29 +47,47 @@ go build -o ./manager-api .
 sleep 3
 pkill -f manager-api
 
-if [[ ! -f "./logs/error.log" ]]; then
-    echo "failed: failed to write log"
+check_logfile
+
+if [[ `grep -c "INFO" ${logfile}` -ne '0' ]]; then
+    echo "failed: should not write info log when level is warn"
     exit 1
 fi
 
-if [[ `grep -c "INFO" ./logs/error.log` -ne '0' ]]; then
-    echo "failed: should not write info log when level is warn"
+clean_logfile
+
+# change level and test signal
+
+sed -i 's/warn/info/' conf/conf.yaml
+
+./manager-api &>/dev/null &
+sleep 3
+pkill -2 -f manager-api
+sleep 6
+
+check_logfile
+
+if [[ `ps -ef | grep "[m]anager-api" -c` -eq '1' ]]; then
+    echo "failed: the manager server didn't deal with signal in correct way"
     exit 1
 fi
 
-#change level and path
+if [[ `grep -c "server receive interrupt" ${logfile}` -ne '1' ]]; then
+    echo "failed: the manager server didn't deal with signal in correct way"
+    exit 1
+fi
+
+clean_logfile
+
+#change path
 
 sed -i 's/file_path: logs\/error.log/file_path: .\/error.log/' conf/conf.yaml
-sed -i 's/warn/info/' conf/conf.yaml

Review comment:
       why do we need to delete this line? I think it should be useful for old 
test case.
   
   one PR for one thing, please focus on `install signal handler for graceful 
shutdown`




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to