From 939055f19c2e2389b9a9db8db263f9cd26838a17 Mon Sep 17 00:00:00 2001 From: DL6ER Date: Mon, 5 Jun 2017 13:51:13 +0200 Subject: [PATCH] Revert "Add FTL tests to the test suite (#1510)" (#1519) This reverts commit cf6a1ac9adb4e26570cc5da7c8be628080f37e0f. --- test/FTL-test.sh | 76 ---------------------------------- test/test_automated_install.py | 64 ---------------------------- 2 files changed, 140 deletions(-) delete mode 100755 test/FTL-test.sh diff --git a/test/FTL-test.sh b/test/FTL-test.sh deleted file mode 100755 index 7e139c8a..00000000 --- a/test/FTL-test.sh +++ /dev/null @@ -1,76 +0,0 @@ -#!/bin/bash -FTL_communicate() { - # Open connection to FTL - exec 3<>"/dev/tcp/localhost/4711" - - # Test if connection is open - if { "true" >&3; } 2> /dev/null; then - # Send command to FTL - echo -e ">$1" >&3 - - # Read input - read -r -t 1 LINE <&3 - until [[ ! $? ]] || [[ "$LINE" == *"EOM"* ]]; do - echo "$LINE" >&1 - read -r -t 1 LINE <&3 - done - - # Close connection - exec 3>&- - exec 3<&- - fi -} - -FTL_get_version() { - FTL_communicate "version" -} - -FTL_get_stats() { - FTL_communicate "stats" -} - -FTL_get_top_clients() { - FTL_communicate "top-clients" -} - -FTL_get_top_domains() { - FTL_communicate "top-domains" -} - -FTL_prepare_files() { - ts=$(dnsmasq_pre) -cat <> /var/log/pihole.log -${ts} query[AAAA] raspberrypi from 127.0.0.1 -${ts} /etc/pihole/local.list raspberrypi is fda2:2001:5647:0:ba27:ebff:fe37:4205 -${ts} query[A] checkip.dyndns.org from 127.0.0.1 -${ts} forwarded checkip.dyndns.org to 2001:1608:10:25::9249:d69b -${ts} forwarded checkip.dyndns.org to 2001:1608:10:25::1c04:b12f -${ts} forwarded checkip.dyndns.org to 2620:0:ccd::2 -${ts} forwarded checkip.dyndns.org to 2620:0:ccc::2 -${ts} reply checkip.dyndns.org is -${ts} reply checkip.dyndns.com is 216.146.38.70 -${ts} reply checkip.dyndns.com is 216.146.43.71 -${ts} reply checkip.dyndns.com is 91.198.22.70 -${ts} reply checkip.dyndns.com is 216.146.43.70 -${ts} query[A] pi.hole from 10.8.0.2 -${ts} /etc/pihole/local.list pi.hole is 192.168.2.10 -${ts} query[A] play.google.com from 192.168.2.208 -${ts} forwarded play.google.com to 2001:1608:10:25::9249:d69b -${ts} forwarded play.google.com to 2001:1608:10:25::1c04:b12f -${ts} forwarded play.google.com to 2620:0:ccd::2 -${ts} forwarded play.google.com to 2620:0:ccc::2 -${ts} reply play.google.com is -${ts} reply play.l.google.com is 216.58.208.110 -${ts} reply play.l.google.com is 216.58.208.110 -${ts} reply play.l.google.com is 216.58.208.110 -${ts} reply play.google.com is -${ts} query[AAAA] play.google.com from 192.168.2.208 -${ts} forwarded play.google.com to 2620:0:ccd::2 -${ts} reply play.l.google.com is 2a00:1450:4017:802::200e -EOT -} - -dnsmasq_pre() { - echo -n $(date +"%b %e %H:%M:%S") - echo -n "dnsmasq[123]:" -} diff --git a/test/test_automated_install.py b/test/test_automated_install.py index 60a0f123..60772625 100644 --- a/test/test_automated_install.py +++ b/test/test_automated_install.py @@ -402,70 +402,6 @@ def test_FTL_binary_installed_and_responsive_no_errors(Pihole): # assert '644 /run/pihole-FTL.pid' in support_files.stdout # assert '644 /var/log/pihole-FTL.log' in support_files.stdout -def test_FTL_telnet_version(Pihole): - ''' confirms FTL binary is copied and functional in installed location and through telnet ''' - FTLtest = Pihole.run(''' - source /opt/pihole/basic-install.sh - source /etc/.pihole/test/FTL-test.sh - FTL_prepare_files - FTLdetect - pihole-FTL - sleep 1 - FTL_get_version - ''') - assert 'version' in FTLtest.stdout - assert 'tag' in FTLtest.stdout - assert 'branch' in FTLtest.stdout - assert 'date' in FTLtest.stdout - -def test_FTL_telnet_statistics(Pihole): - ''' confirms FTL binary is copied and functional in installed location and through telnet ''' - FTLtest = Pihole.run(''' - source /opt/pihole/basic-install.sh - source /etc/.pihole/test/FTL-test.sh - FTL_prepare_files - FTLdetect - pihole-FTL - sleep 1 - FTL_get_stats - ''') - assert 'domains_being_blocked' in FTLtest.stdout - assert 'dns_queries_today 5' in FTLtest.stdout - assert 'unique_domains 4' in FTLtest.stdout - assert 'queries_forwarded 3' in FTLtest.stdout - assert 'queries_cached 2' in FTLtest.stdout - -def test_FTL_telnet_top_clients(Pihole): - ''' confirms FTL binary is copied and functional in installed location and through telnet ''' - FTLtest = Pihole.run(''' - source /opt/pihole/basic-install.sh - source /etc/.pihole/test/FTL-test.sh - FTL_prepare_files - FTLdetect - pihole-FTL - sleep 1 - FTL_get_top_clients - ''') - assert '0 2 192.168.2.208' in FTLtest.stdout - assert '1 2 127.0.0.1' in FTLtest.stdout - assert '2 1 10.8.0.2' in FTLtest.stdout - -def test_FTL_telnet_top_domains(Pihole): - ''' confirms FTL binary is copied and functional in installed location and through telnet ''' - FTLtest = Pihole.run(''' - source /opt/pihole/basic-install.sh - source /etc/.pihole/test/FTL-test.sh - FTL_prepare_files - FTLdetect - pihole-FTL - sleep 1 - FTL_get_top_domains - ''') - assert '0 2 play.google.com' in FTLtest.stdout - assert '1 1 pi.hole' in FTLtest.stdout - assert '2 1 checkip.dyndns.org' in FTLtest.stdout - assert '3 1 raspberrypi' in FTLtest.stdout - def test_IPv6_only_link_local(Pihole): ''' confirms IPv6 blocking is disabled for Link-local address ''' # mock ip -6 address to return Link-local address