From 46e1a87e9e80b9e31c03cfd3b68c0812e27fb920 Mon Sep 17 00:00:00 2001 From: Adam Warner Date: Sat, 3 Sep 2022 12:09:37 +0100 Subject: [PATCH 1/3] Tweak FTL test to ensure we don't get false positives on incompatible OS (Will remote Ub18 in a separate commit) Signed-off-by: Adam Warner --- test/test_any_automated_install.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/test/test_any_automated_install.py b/test/test_any_automated_install.py index 1e2a849b..7ec75078 100644 --- a/test/test_any_automated_install.py +++ b/test/test_any_automated_install.py @@ -880,13 +880,14 @@ def test_FTL_binary_installed_and_responsive_no_errors(host): source /opt/pihole/basic-install.sh create_pihole_user funcOutput=$(get_binary_name) + echo "development" > /etc/pihole/ftlbranch binary="pihole-FTL${funcOutput##*pihole-FTL}" theRest="${funcOutput%pihole-FTL*}" FTLdetect "${binary}" "${theRest}" - pihole-FTL version ''') + version_check = host.run('pihole-FTL version') expected_stdout = 'v' - assert expected_stdout in installed_binary.stdout + assert expected_stdout in version_check.stdout def test_IPv6_only_link_local(host): From 0f74165c9d5ee23c951384dcefad8e7efa41249e Mon Sep 17 00:00:00 2001 From: Adam Warner Date: Sat, 3 Sep 2022 12:55:17 +0100 Subject: [PATCH 2/3] Drop Ubuntu 18 tests Tweek version_check to only output 1st char of the reported version Signed-off-by: Adam Warner --- .github/workflows/test.yml | 2 +- test/_ubuntu_18.Dockerfile | 17 ----------------- test/test_any_automated_install.py | 5 ++++- test/tox.ubuntu_18.ini | 8 -------- 4 files changed, 5 insertions(+), 27 deletions(-) delete mode 100644 test/_ubuntu_18.Dockerfile delete mode 100644 test/tox.ubuntu_18.ini diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 835be166..318cfcc4 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -43,7 +43,7 @@ jobs: strategy: fail-fast: false matrix: - distro: [debian_10, debian_11, ubuntu_18, ubuntu_20, ubuntu_22, centos_8, fedora_34] + distro: [debian_10, debian_11, ubuntu_20, ubuntu_22, centos_8, fedora_34] env: DISTRO: ${{matrix.distro}} steps: diff --git a/test/_ubuntu_18.Dockerfile b/test/_ubuntu_18.Dockerfile deleted file mode 100644 index 47f1893e..00000000 --- a/test/_ubuntu_18.Dockerfile +++ /dev/null @@ -1,17 +0,0 @@ -FROM buildpack-deps:bionic-scm - -ENV GITDIR /etc/.pihole -ENV SCRIPTDIR /opt/pihole - -RUN mkdir -p $GITDIR $SCRIPTDIR /etc/pihole -ADD . $GITDIR -RUN cp $GITDIR/advanced/Scripts/*.sh $GITDIR/gravity.sh $GITDIR/pihole $GITDIR/automated\ install/*.sh $SCRIPTDIR/ -ENV PATH /usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:$SCRIPTDIR - -RUN true && \ - chmod +x $SCRIPTDIR/* - -ENV SKIP_INSTALL true -ENV OS_CHECK_DOMAIN_NAME dev-supportedos.pi-hole.net - -#sed '/# Start the installer/Q' /opt/pihole/basic-install.sh > /opt/pihole/stub_basic-install.sh && \ diff --git a/test/test_any_automated_install.py b/test/test_any_automated_install.py index 7ec75078..70300243 100644 --- a/test/test_any_automated_install.py +++ b/test/test_any_automated_install.py @@ -885,7 +885,10 @@ def test_FTL_binary_installed_and_responsive_no_errors(host): theRest="${funcOutput%pihole-FTL*}" FTLdetect "${binary}" "${theRest}" ''') - version_check = host.run('pihole-FTL version') + version_check = host.run(''' + VERSION=$(pihole-FTL version) + echo ${VERSION:0:1} + ''') expected_stdout = 'v' assert expected_stdout in version_check.stdout diff --git a/test/tox.ubuntu_18.ini b/test/tox.ubuntu_18.ini deleted file mode 100644 index a2513dfd..00000000 --- a/test/tox.ubuntu_18.ini +++ /dev/null @@ -1,8 +0,0 @@ -[tox] -envlist = py38 - -[testenv] -whitelist_externals = docker -deps = -rrequirements.txt -commands = docker build -f _ubuntu_18.Dockerfile -t pytest_pihole:test_container ../ - pytest {posargs:-vv -n auto} ./test_any_automated_install.py ./test_any_utils.py From 89b88416b363840e5a7afd72e9f0f5d65ddf5d3b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christian=20K=C3=B6nig?= Date: Tue, 6 Sep 2022 17:09:52 +0200 Subject: [PATCH 3/3] Fix 4898 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Christian König --- pihole | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/pihole b/pihole index eb825965..1047d152 100755 --- a/pihole +++ b/pihole @@ -104,6 +104,9 @@ restartDNS() { local svcOption svc str output status pid icon FTL_PID_FILE svcOption="${1:-restart}" + # get the current path to the pihole-FTL.pid + FTL_PID_FILE="$(getFTLPIDFile)" + # Determine if we should reload or restart if [[ "${svcOption}" =~ "reload-lists" ]]; then # Reloading of the lists has been requested @@ -111,9 +114,6 @@ restartDNS() { # Note 2: We cannot use killall here as it does # not know about real-time signals - # get the current path to the pihole-FTL.pid - FTL_PID_FILE="$(getFTLPIDFile)" - pid="$(getFTLPID ${FTL_PID_FILE})" if [[ "$pid" -eq "-1" ]]; then svc="true"