mirror of
https://github.com/pi-hole/FTL.git
synced 2024-10-26 16:52:18 +02:00
Test: Check port file exists and contains the expected number (4711)
Signed-off-by: DL6ER <dl6er@dl6er.de>
This commit is contained in:
+9
-1
@@ -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
|
||||
|
||||
@@ -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" ]]
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user