Test: Check port file exists and contains the expected number (4711)

Signed-off-by: DL6ER <dl6er@dl6er.de>
This commit is contained in:
DL6ER
2020-07-17 10:16:45 +02:00
parent dd927b586e
commit 41b49782c2
2 changed files with 15 additions and 1 deletions
+9 -1
View File
@@ -11,8 +11,16 @@ if ! id -u pihole &> /dev/null; then
useradd -m -s /usr/sbin/nologin pihole
fi
# Kill possibly running pihole-FTL process
while pidof -s pihole-FTL > /dev/null; do
pid="$(pidof -s pihole-FTL)"
echo "Terminating running pihole-FTL process with PID ${pid}"
kill $pid
sleep 1
done
# Clean up possible old files from earlier test runs
rm -f /etc/pihole/gravity.db /etc/pihole/pihole-FTL.db /var/log/pihole.log /var/log/pihole-FTL.log
rm -f /etc/pihole/gravity.db /etc/pihole/pihole-FTL.db /var/log/pihole.log /var/log/pihole-FTL.log /dev/shm/FTL-*
# Create necessary directories and files
mkdir -p /etc/pihole /run/pihole /var/log
+6
View File
@@ -456,3 +456,9 @@
printf "%s\n" "${lines[@]}"
[[ ${lines[0]} == "2" ]]
}
@test "Port file exists and contains expected API port" {
run bash -c 'cat /run/pihole-FTL.port'
printf "%s\n" "${lines[@]}"
[[ ${lines[0]} == "4711" ]]
}