From fa9f9a9b8e8e65fbc28bec3f79ca51a93c5b0adc Mon Sep 17 00:00:00 2001 From: DL6ER Date: Sun, 3 Jul 2022 14:17:25 +0200 Subject: [PATCH] Remove some incompatible tests Signed-off-by: DL6ER --- test/pihole-FTL.db.sql | 4 ++-- test/test_suite.bats | 47 +----------------------------------------- 2 files changed, 3 insertions(+), 48 deletions(-) diff --git a/test/pihole-FTL.db.sql b/test/pihole-FTL.db.sql index 89169db7..c9d25884 100644 --- a/test/pihole-FTL.db.sql +++ b/test/pihole-FTL.db.sql @@ -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); diff --git a/test/test_suite.bats b/test/test_suite.bats index 68c8d7c8..52a84e85 100644 --- a/test/test_suite.bats +++ b/test/test_suite.bats @@ -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 ]] -}