Sfoglia il codice sorgente

func tests: don't return pid of started process unless asked (#1821)

mmetc 2 anni fa
parent
commit
7866729d3b
2 ha cambiato i file con 14 aggiunte e 0 eliminazioni
  1. 7 0
      tests/lib/init/crowdsec-daemon
  2. 7 0
      tests/lib/init/crowdsec-systemd

+ 7 - 0
tests/lib/init/crowdsec-daemon

@@ -37,6 +37,10 @@ start() {
         -o "${LOG_DIR}/crowdsec.out" \
         -o "${LOG_DIR}/crowdsec.out" \
         "${CROWDSEC}"
         "${CROWDSEC}"
     ./bin/wait-for-port 6060
     ./bin/wait-for-port 6060
+}
+
+start_pid() {
+    start
     cat "$DAEMON_PID"
     cat "$DAEMON_PID"
 }
 }
 
 
@@ -63,6 +67,9 @@ case "$1" in
     start)
     start)
         start
         start
         ;;
         ;;
+    start-pid)
+        start_pid
+        ;;
     stop)
     stop)
         stop
         stop
         ;;
         ;;

+ 7 - 0
tests/lib/init/crowdsec-systemd

@@ -33,6 +33,10 @@ fi
 start() {
 start() {
     systemctl start crowdsec
     systemctl start crowdsec
     ./bin/wait-for-port 6060
     ./bin/wait-for-port 6060
+}
+
+start_pid() {
+    start
     pidof /usr/bin/crowdsec
     pidof /usr/bin/crowdsec
 }
 }
 
 
@@ -50,6 +54,9 @@ case "$1" in
     start)
     start)
         start
         start
         ;;
         ;;
+    start-pid)
+        start_pid
+        ;;
     stop)
     stop)
         stop
         stop
         ;;
         ;;