mirror of
https://github.com/pi-hole/FTL.git
synced 2025-12-20 06:48:25 +00:00
@@ -1,8 +1,8 @@
|
||||
PRAGMA foreign_keys=OFF;
|
||||
BEGIN TRANSACTION;
|
||||
CREATE TABLE queries (id INTEGER PRIMARY KEY AUTOINCREMENT, timestamp INTEGER NOT NULL, type INTEGER NOT NULL, status INTEGER NOT NULL, domain TEXT NOT NULL, client TEXT NOT NULL, forward TEXT, additional_info TEXT, reply INTEGER, dnssec INTEGER, reply_time INTEGER, client_name TEXT, ttl INTEGER, regex_id INTEGER);
|
||||
CREATE TABLE queries (id INTEGER PRIMARY KEY AUTOINCREMENT, timestamp INTEGER NOT NULL, type INTEGER NOT NULL, status INTEGER NOT NULL, domain TEXT NOT NULL, client TEXT NOT NULL, forward TEXT, additional_info TEXT);
|
||||
CREATE TABLE ftl (id INTEGER PRIMARY KEY NOT NULL, value BLOB NOT NULL);
|
||||
INSERT INTO ftl VALUES(0,10);
|
||||
INSERT INTO ftl VALUES(0,9);
|
||||
INSERT INTO ftl VALUES(1,1592886836);
|
||||
INSERT INTO ftl VALUES(2,1592886833);
|
||||
CREATE TABLE counters (id INTEGER PRIMARY KEY NOT NULL, value INTEGER NOT NULL);
|
||||
|
||||
@@ -1120,7 +1120,6 @@
|
||||
rm abc.lua
|
||||
}
|
||||
|
||||
|
||||
@test "Pi-hole PTR generation check" {
|
||||
run bash -c "bash test/hostnames.sh | tee ptr.log"
|
||||
printf "%s\n" "${lines[@]}"
|
||||
@@ -1184,7 +1183,7 @@
|
||||
}
|
||||
|
||||
@test "Pi-hole uses BLOCK_IPV4/6 for blocked domain" {
|
||||
echo "BLOCKINGMODE=IP" >> /etc/pihole/pihole-FTL.conf
|
||||
sed -i "s/blockingmode = \"NULL\"/blockingmode = \"IP\"" /etc/pihole/pihole-FTL.toml
|
||||
run bash -c "kill -HUP $(cat /run/pihole-FTL.pid)"
|
||||
sleep 2
|
||||
run bash -c "dig A blacklisted.ftl +short @127.0.0.1"
|
||||
@@ -1194,47 +1193,3 @@
|
||||
printf "%s\n" "${lines[@]}"
|
||||
[[ "${lines[0]}" == "fe80::11" ]]
|
||||
}
|
||||
|
||||
@test "Reported default gateway is correct" {
|
||||
routes="$(ip -4 route show default)"
|
||||
ipaddr="$(awk '{print $3}' <<< $routes)"
|
||||
interf="$(awk '{print $5}' <<< $routes)"
|
||||
printf "ip -4 route show default: %s\n" "${routes}"
|
||||
run bash -c 'echo ">gateway >quit" | nc 127.0.0.1 4711'
|
||||
ftlip="$(awk '{print $1}' <<< "${lines[0]}")"
|
||||
ftlif="$(awk '{print $2}' <<< "${lines[0]}")"
|
||||
printf "%s\n" "${lines[@]}"
|
||||
# Check gateway IP address
|
||||
printf "Checking IP: %s == %s\n" "$ftlip" "$ipaddr"
|
||||
[[ "$ftlip" == "$ipaddr" ]]
|
||||
# Check gateway interface
|
||||
printf "Checking IF: %s == %s\n" "$ftlif" "$interf"
|
||||
[[ "$ftlif" == "$interf" ]]
|
||||
}
|
||||
|
||||
@test "Reported interface statistics are as expected" {
|
||||
routes="$(ip -4 route show default)"
|
||||
interf="$(awk '{print $5}' <<< $routes)"
|
||||
printf "ip -4 route show default: %s\n" "${routes}"
|
||||
run bash -c 'echo ">interfaces >quit" | nc 127.0.0.1 4711'
|
||||
firstiface="$(awk '{print $1}' <<< "${lines[0]}")"
|
||||
firstcarrier="$(awk '{print $2}' <<< "${lines[0]}")"
|
||||
firstnum="$(awk '{print NF}' <<< "${lines[0]}")"
|
||||
lastiface="$(awk '{print $1}' <<< "${lines[-1]}")"
|
||||
lastcarrier="$(awk '{print $2}' <<< "${lines[-1]}")"
|
||||
lastspeed="$(awk '{print $3}' <<< "${lines[-1]}")"
|
||||
lastnum="$(awk '{print NF}' <<< "${lines[-1]}")"
|
||||
printf "%s\n" "${lines[@]}"
|
||||
# Check default interface is reported in first line
|
||||
printf "Checking IF: %s == %s\n" "$firstiface" "$interf"
|
||||
[[ "$firstiface" == "$interf" ]]
|
||||
# Check default interface is reported as being UP
|
||||
[[ "$firstcarrier" == "UP" ]]
|
||||
# Check last reported record is the sum
|
||||
[[ "$lastiface" == "sum" ]]
|
||||
[[ "$lastcarrier" == "UP" ]]
|
||||
[[ "$lastspeed" == "0" ]]
|
||||
# Check we are reporting seven quantities for the interfaces
|
||||
[[ "$firstnum" == 7 ]]
|
||||
[[ "$lastnum" == 7 ]]
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user