From fec15951832ce18462f198425d1a29c1b1e084cc Mon Sep 17 00:00:00 2001 From: pvogt09 <50047961+pvogt09@users.noreply.github.com> Date: Tue, 17 Mar 2020 22:23:41 +0100 Subject: [PATCH 1/7] add docker containers for debian 9 and 10, ubuntu 16 and 18, fedora 28 and 29 Signed-off-by: pvogt09 <50047961+pvogt09@users.noreply.github.com> --- test/conftest.py | 2 +- test/debian_10.Dockerfile | 16 ++++++++++++++++ test/debian_9.Dockerfile | 16 ++++++++++++++++ test/fedora_28.Dockerfile | 16 ++++++++++++++++ test/fedora_29.Dockerfile | 16 ++++++++++++++++ test/test_000_build_containers.py | 6 ++++++ test/ubuntu_16.Dockerfile | 16 ++++++++++++++++ test/ubuntu_18.Dockerfile | 16 ++++++++++++++++ tox.ini | 6 ++++++ 9 files changed, 109 insertions(+), 1 deletion(-) create mode 100644 test/debian_10.Dockerfile create mode 100644 test/debian_9.Dockerfile create mode 100644 test/fedora_28.Dockerfile create mode 100644 test/fedora_29.Dockerfile create mode 100644 test/ubuntu_16.Dockerfile create mode 100644 test/ubuntu_18.Dockerfile diff --git a/test/conftest.py b/test/conftest.py index 69926eaf..2be67ee4 100644 --- a/test/conftest.py +++ b/test/conftest.py @@ -69,7 +69,7 @@ def args(request): return '-t -d' -@pytest.fixture(params=['debian', 'centos7', 'centos', 'fedora']) +@pytest.fixture(params=['debian', 'debian_9', 'debian_10', 'centos7', 'centos', 'fedora', 'ubuntu_16', 'ubuntu_18']) def tag(request): ''' consumed by image to make the test matrix diff --git a/test/debian_10.Dockerfile b/test/debian_10.Dockerfile new file mode 100644 index 00000000..9b72fc6a --- /dev/null +++ b/test/debian_10.Dockerfile @@ -0,0 +1,16 @@ +FROM buildpack-deps:buster-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 PH_TEST true + +#sed '/# Start the installer/Q' /opt/pihole/basic-install.sh > /opt/pihole/stub_basic-install.sh && \ diff --git a/test/debian_9.Dockerfile b/test/debian_9.Dockerfile new file mode 100644 index 00000000..d6609ba3 --- /dev/null +++ b/test/debian_9.Dockerfile @@ -0,0 +1,16 @@ +FROM buildpack-deps:stretch-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 PH_TEST true + +#sed '/# Start the installer/Q' /opt/pihole/basic-install.sh > /opt/pihole/stub_basic-install.sh && \ diff --git a/test/fedora_28.Dockerfile b/test/fedora_28.Dockerfile new file mode 100644 index 00000000..76b40318 --- /dev/null +++ b/test/fedora_28.Dockerfile @@ -0,0 +1,16 @@ +FROM fedora:28 + +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 PH_TEST true + +#sed '/# Start the installer/Q' /opt/pihole/basic-install.sh > /opt/pihole/stub_basic-install.sh && \ diff --git a/test/fedora_29.Dockerfile b/test/fedora_29.Dockerfile new file mode 100644 index 00000000..8c27bbcc --- /dev/null +++ b/test/fedora_29.Dockerfile @@ -0,0 +1,16 @@ +FROM fedora:29 + +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 PH_TEST true + +#sed '/# Start the installer/Q' /opt/pihole/basic-install.sh > /opt/pihole/stub_basic-install.sh && \ diff --git a/test/test_000_build_containers.py b/test/test_000_build_containers.py index 0f3e2d1a..e2044b67 100644 --- a/test/test_000_build_containers.py +++ b/test/test_000_build_containers.py @@ -9,9 +9,15 @@ run_local = testinfra.get_backend( @pytest.mark.parametrize("image,tag", [ ('test/debian.Dockerfile', 'pytest_pihole:debian'), + ('test/debian_9.Dockerfile', 'pytest_pihole:debian_9'), + ('test/debian_10.Dockerfile', 'pytest_pihole:debian_10'), ('test/centos7.Dockerfile', 'pytest_pihole:centos7'), ('test/centos.Dockerfile', 'pytest_pihole:centos'), ('test/fedora.Dockerfile', 'pytest_pihole:fedora'), + ('test/fedora_28.Dockerfile', 'pytest_pihole:fedora_28'), + ('test/fedora_29.Dockerfile', 'pytest_pihole:fedora_29'), + ('test/ubuntu_16.Dockerfile', 'pytest_pihole:ubuntu_16'), + ('test/ubuntu_18.Dockerfile', 'pytest_pihole:ubuntu_18'), ]) # mark as 'build_stage' so we can ensure images are built first when tests # are executed in parallel. (not required when tests are executed serially) diff --git a/test/ubuntu_16.Dockerfile b/test/ubuntu_16.Dockerfile new file mode 100644 index 00000000..d1107082 --- /dev/null +++ b/test/ubuntu_16.Dockerfile @@ -0,0 +1,16 @@ +FROM buildpack-deps:xenial-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 PH_TEST true + +#sed '/# Start the installer/Q' /opt/pihole/basic-install.sh > /opt/pihole/stub_basic-install.sh && \ diff --git a/test/ubuntu_18.Dockerfile b/test/ubuntu_18.Dockerfile new file mode 100644 index 00000000..2f63ea89 --- /dev/null +++ b/test/ubuntu_18.Dockerfile @@ -0,0 +1,16 @@ +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 PH_TEST true + +#sed '/# Start the installer/Q' /opt/pihole/basic-install.sh > /opt/pihole/stub_basic-install.sh && \ diff --git a/tox.ini b/tox.ini index 49c99066..f17877b8 100644 --- a/tox.ini +++ b/tox.ini @@ -5,7 +5,13 @@ envlist = py37 whitelist_externals = docker deps = -rrequirements.txt commands = docker build -f test/debian.Dockerfile -t pytest_pihole:debian . + docker build -f test/debian_9.Dockerfile -t pytest_pihole:debian_9 . + docker build -f test/debian_10.Dockerfile -t pytest_pihole:debian_10 . docker build -f test/centos7.Dockerfile -t pytest_pihole:centos7 . docker build -f test/centos.Dockerfile -t pytest_pihole:centos . docker build -f test/fedora.Dockerfile -t pytest_pihole:fedora . + docker build -f test/fedora_28.Dockerfile -t pytest_pihole:fedora_28 . + docker build -f test/fedora_29.Dockerfile -t pytest_pihole:fedora_29 . + docker build -f test/ubuntu_16.Dockerfile -t pytest_pihole:ubuntu_16 . + docker build -f test/ubuntu_18.Dockerfile -t pytest_pihole:ubuntu_18 . pytest {posargs:-vv -n auto} -m "not build_stage" ./test/ From 60a4814ac156154c726574fd4dae1dd8d5a71821 Mon Sep 17 00:00:00 2001 From: pvogt09 <50047961+pvogt09@users.noreply.github.com> Date: Tue, 17 Mar 2020 20:15:16 +0100 Subject: [PATCH 2/7] add test case for installation of dependencies for installer, core and web Signed-off-by: pvogt09 <50047961+pvogt09@users.noreply.github.com> --- test/test_automated_install.py | 77 ++++++++++++++++++++++++++++++++++ 1 file changed, 77 insertions(+) diff --git a/test/test_automated_install.py b/test/test_automated_install.py index f6b5a87e..0810b63f 100644 --- a/test/test_automated_install.py +++ b/test/test_automated_install.py @@ -595,3 +595,80 @@ def test_os_check_passes(Pihole): ''') expected_stdout = 'Supported OS detected' assert expected_stdout in detectOS.stdout + + +def test_install_dependent_packages_no_errors(Pihole): + ''' + confirms all dependent packages are installed on a fresh build + ''' + # mock whiptail answers and ensure installer dependencies + mock_command('whiptail', {'*': ('', '0')}, Pihole) + # create configuration file + setup_var_file = 'cat < /etc/pihole/setupVars.conf\n' + for k, v in SETUPVARS.items(): + setup_var_file += "{}={}\n".format(k, v) + setup_var_file += "EOF\n" + Pihole.run(setup_var_file) + install = Pihole.run(''' + runUnattended=true + useUpdateVars=true + source /opt/pihole/basic-install.sh + runUnattended=true + useUpdateVars=true + distro_check + update_package_cache || exit 1 + install_dependent_packages "${INSTALLER_DEPS[@]}" + ''') + + assert install.rc == 0 + + +def test_install_dependent_packages_web_no_errors(Pihole): + ''' + confirms all dependent packages are installed on a fresh build + ''' + # mock whiptail answers and ensure installer dependencies + mock_command('whiptail', {'*': ('', '0')}, Pihole) + # mock systemctl to start lighttpd + mock_command_2( + 'systemctl', + { + 'enable lighttpd': ( + '', + '0' + ), + 'restart lighttpd': ( + '/etc/init.d/lighttpd restart', + '0' + ), + 'start lighttpd': ( + '/etc/init.d/lighttpd start', + '0' + ) + }, + Pihole + ) + # create configuration file + setup_var_file = 'cat < /etc/pihole/setupVars.conf\n' + for k, v in SETUPVARS.items(): + setup_var_file += "{}={}\n".format(k, v) + setup_var_file += "EOF\n" + Pihole.run(setup_var_file) + install = Pihole.run(''' + runUnattended=true + useUpdateVars=true + INSTALL_WEB_SERVER=true + source /opt/pihole/basic-install.sh + runUnattended=true + useUpdateVars=true + INSTALL_WEB_SERVER=true + distro_check + update_package_cache || exit 1 + dep_install_list=("${PIHOLE_DEPS[@]}") + if [[ "${INSTALL_WEB_SERVER}" == true ]]; then + dep_install_list+=("${PIHOLE_WEB_DEPS[@]}") + fi + install_dependent_packages "${dep_install_list[@]}" + ''') + + assert install.rc == 0 From bef9cd3bc2575ca31911178eca5b494ed2cf670f Mon Sep 17 00:00:00 2001 From: pvogt09 <50047961+pvogt09@users.noreply.github.com> Date: Wed, 18 Mar 2020 19:11:49 +0100 Subject: [PATCH 3/7] mock whiptail to add universe repo Signed-off-by: pvogt09 <50047961+pvogt09@users.noreply.github.com> --- test/test_automated_install.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/test/test_automated_install.py b/test/test_automated_install.py index 0810b63f..b830ddf4 100644 --- a/test/test_automated_install.py +++ b/test/test_automated_install.py @@ -601,8 +601,8 @@ def test_install_dependent_packages_no_errors(Pihole): ''' confirms all dependent packages are installed on a fresh build ''' - # mock whiptail answers and ensure installer dependencies - mock_command('whiptail', {'*': ('', '0')}, Pihole) + # mock whiptail answers to use universe repo if asked + mock_command('whiptail', {'*': ('', '1')}, Pihole) # create configuration file setup_var_file = 'cat < /etc/pihole/setupVars.conf\n' for k, v in SETUPVARS.items(): @@ -625,10 +625,10 @@ def test_install_dependent_packages_no_errors(Pihole): def test_install_dependent_packages_web_no_errors(Pihole): ''' - confirms all dependent packages are installed on a fresh build + confirms all dependent web packages are installed on a fresh build ''' - # mock whiptail answers and ensure installer dependencies - mock_command('whiptail', {'*': ('', '0')}, Pihole) + # mock whiptail answers to use universe repo if asked + mock_command('whiptail', {'*': ('', '1')}, Pihole) # mock systemctl to start lighttpd mock_command_2( 'systemctl', From 3128d14d1f7eaaf0241d0e1d5e56d0492e54a996 Mon Sep 17 00:00:00 2001 From: pvogt09 <50047961+pvogt09@users.noreply.github.com> Date: Tue, 27 Oct 2020 11:48:42 +0100 Subject: [PATCH 4/7] update images to versions supported by pi-hole 5 Signed-off-by: pvogt09 <50047961+pvogt09@users.noreply.github.com> --- test/conftest.py | 2 +- ...fedora_28.Dockerfile => fedora_31.Dockerfile} | 2 +- ...fedora_29.Dockerfile => fedora_32.Dockerfile} | 2 +- test/test_000_build_containers.py | 5 +++-- test/ubuntu_20.Dockerfile | 16 ++++++++++++++++ tox.ini | 5 +++-- 6 files changed, 25 insertions(+), 7 deletions(-) rename test/{fedora_28.Dockerfile => fedora_31.Dockerfile} (96%) rename test/{fedora_29.Dockerfile => fedora_32.Dockerfile} (96%) create mode 100644 test/ubuntu_20.Dockerfile diff --git a/test/conftest.py b/test/conftest.py index 2be67ee4..ade1c674 100644 --- a/test/conftest.py +++ b/test/conftest.py @@ -69,7 +69,7 @@ def args(request): return '-t -d' -@pytest.fixture(params=['debian', 'debian_9', 'debian_10', 'centos7', 'centos', 'fedora', 'ubuntu_16', 'ubuntu_18']) +@pytest.fixture(params=['debian', 'debian_9', 'debian_10', 'centos7', 'centos', 'fedora', 'fedora_31', 'fedora_32', 'ubuntu_16', 'ubuntu_18', 'ubuntu_20']) def tag(request): ''' consumed by image to make the test matrix diff --git a/test/fedora_28.Dockerfile b/test/fedora_31.Dockerfile similarity index 96% rename from test/fedora_28.Dockerfile rename to test/fedora_31.Dockerfile index 76b40318..02dcb733 100644 --- a/test/fedora_28.Dockerfile +++ b/test/fedora_31.Dockerfile @@ -1,4 +1,4 @@ -FROM fedora:28 +FROM fedora:31 ENV GITDIR /etc/.pihole ENV SCRIPTDIR /opt/pihole diff --git a/test/fedora_29.Dockerfile b/test/fedora_32.Dockerfile similarity index 96% rename from test/fedora_29.Dockerfile rename to test/fedora_32.Dockerfile index 8c27bbcc..869efb2b 100644 --- a/test/fedora_29.Dockerfile +++ b/test/fedora_32.Dockerfile @@ -1,4 +1,4 @@ -FROM fedora:29 +FROM fedora:32 ENV GITDIR /etc/.pihole ENV SCRIPTDIR /opt/pihole diff --git a/test/test_000_build_containers.py b/test/test_000_build_containers.py index e2044b67..dfaba1ac 100644 --- a/test/test_000_build_containers.py +++ b/test/test_000_build_containers.py @@ -14,10 +14,11 @@ run_local = testinfra.get_backend( ('test/centos7.Dockerfile', 'pytest_pihole:centos7'), ('test/centos.Dockerfile', 'pytest_pihole:centos'), ('test/fedora.Dockerfile', 'pytest_pihole:fedora'), - ('test/fedora_28.Dockerfile', 'pytest_pihole:fedora_28'), - ('test/fedora_29.Dockerfile', 'pytest_pihole:fedora_29'), + ('test/fedora_31.Dockerfile', 'pytest_pihole:fedora_31'), + ('test/fedora_32.Dockerfile', 'pytest_pihole:fedora_32'), ('test/ubuntu_16.Dockerfile', 'pytest_pihole:ubuntu_16'), ('test/ubuntu_18.Dockerfile', 'pytest_pihole:ubuntu_18'), + ('test/ubuntu_20.Dockerfile', 'pytest_pihole:ubuntu_20'), ]) # mark as 'build_stage' so we can ensure images are built first when tests # are executed in parallel. (not required when tests are executed serially) diff --git a/test/ubuntu_20.Dockerfile b/test/ubuntu_20.Dockerfile new file mode 100644 index 00000000..c071fcd9 --- /dev/null +++ b/test/ubuntu_20.Dockerfile @@ -0,0 +1,16 @@ +FROM buildpack-deps:focal-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 PH_TEST true + +#sed '/# Start the installer/Q' /opt/pihole/basic-install.sh > /opt/pihole/stub_basic-install.sh && \ diff --git a/tox.ini b/tox.ini index f17877b8..17d19052 100644 --- a/tox.ini +++ b/tox.ini @@ -10,8 +10,9 @@ commands = docker build -f test/debian.Dockerfile -t pytest_pihole:debian . docker build -f test/centos7.Dockerfile -t pytest_pihole:centos7 . docker build -f test/centos.Dockerfile -t pytest_pihole:centos . docker build -f test/fedora.Dockerfile -t pytest_pihole:fedora . - docker build -f test/fedora_28.Dockerfile -t pytest_pihole:fedora_28 . - docker build -f test/fedora_29.Dockerfile -t pytest_pihole:fedora_29 . + docker build -f test/fedora_31.Dockerfile -t pytest_pihole:fedora_31 . + docker build -f test/fedora_32.Dockerfile -t pytest_pihole:fedora_32 . docker build -f test/ubuntu_16.Dockerfile -t pytest_pihole:ubuntu_16 . docker build -f test/ubuntu_18.Dockerfile -t pytest_pihole:ubuntu_18 . + docker build -f test/ubuntu_20.Dockerfile -t pytest_pihole:ubuntu_20 . pytest {posargs:-vv -n auto} -m "not build_stage" ./test/ From cb49ce38f50f6d477b9e7398d265ad1550bf6d22 Mon Sep 17 00:00:00 2001 From: pvogt09 <50047961+pvogt09@users.noreply.github.com> Date: Tue, 27 Oct 2020 12:32:23 +0100 Subject: [PATCH 5/7] fix stickler errors Signed-off-by: pvogt09 <50047961+pvogt09@users.noreply.github.com> --- test/conftest.py | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/test/conftest.py b/test/conftest.py index ade1c674..3fd2524a 100644 --- a/test/conftest.py +++ b/test/conftest.py @@ -69,7 +69,19 @@ def args(request): return '-t -d' -@pytest.fixture(params=['debian', 'debian_9', 'debian_10', 'centos7', 'centos', 'fedora', 'fedora_31', 'fedora_32', 'ubuntu_16', 'ubuntu_18', 'ubuntu_20']) +@pytest.fixture(params=[ + 'debian', + 'debian_9', + 'debian_10', + 'centos7', + 'centos', + 'fedora', + 'fedora_31', + 'fedora_32', + 'ubuntu_16', + 'ubuntu_18', + 'ubuntu_20' +]) def tag(request): ''' consumed by image to make the test matrix From 4386cc4f225ed1df9c2e921751706c8e7d738866 Mon Sep 17 00:00:00 2001 From: pvogt09 <50047961+pvogt09@users.noreply.github.com> Date: Tue, 27 Oct 2020 12:44:57 +0100 Subject: [PATCH 6/7] Revert "add test case for installation of dependencies for installer, core and web" This reverts commit 60a4814ac156154c726574fd4dae1dd8d5a71821. Signed-off-by: pvogt09 <50047961+pvogt09@users.noreply.github.com> --- test/test_automated_install.py | 77 ---------------------------------- 1 file changed, 77 deletions(-) diff --git a/test/test_automated_install.py b/test/test_automated_install.py index b830ddf4..f6b5a87e 100644 --- a/test/test_automated_install.py +++ b/test/test_automated_install.py @@ -595,80 +595,3 @@ def test_os_check_passes(Pihole): ''') expected_stdout = 'Supported OS detected' assert expected_stdout in detectOS.stdout - - -def test_install_dependent_packages_no_errors(Pihole): - ''' - confirms all dependent packages are installed on a fresh build - ''' - # mock whiptail answers to use universe repo if asked - mock_command('whiptail', {'*': ('', '1')}, Pihole) - # create configuration file - setup_var_file = 'cat < /etc/pihole/setupVars.conf\n' - for k, v in SETUPVARS.items(): - setup_var_file += "{}={}\n".format(k, v) - setup_var_file += "EOF\n" - Pihole.run(setup_var_file) - install = Pihole.run(''' - runUnattended=true - useUpdateVars=true - source /opt/pihole/basic-install.sh - runUnattended=true - useUpdateVars=true - distro_check - update_package_cache || exit 1 - install_dependent_packages "${INSTALLER_DEPS[@]}" - ''') - - assert install.rc == 0 - - -def test_install_dependent_packages_web_no_errors(Pihole): - ''' - confirms all dependent web packages are installed on a fresh build - ''' - # mock whiptail answers to use universe repo if asked - mock_command('whiptail', {'*': ('', '1')}, Pihole) - # mock systemctl to start lighttpd - mock_command_2( - 'systemctl', - { - 'enable lighttpd': ( - '', - '0' - ), - 'restart lighttpd': ( - '/etc/init.d/lighttpd restart', - '0' - ), - 'start lighttpd': ( - '/etc/init.d/lighttpd start', - '0' - ) - }, - Pihole - ) - # create configuration file - setup_var_file = 'cat < /etc/pihole/setupVars.conf\n' - for k, v in SETUPVARS.items(): - setup_var_file += "{}={}\n".format(k, v) - setup_var_file += "EOF\n" - Pihole.run(setup_var_file) - install = Pihole.run(''' - runUnattended=true - useUpdateVars=true - INSTALL_WEB_SERVER=true - source /opt/pihole/basic-install.sh - runUnattended=true - useUpdateVars=true - INSTALL_WEB_SERVER=true - distro_check - update_package_cache || exit 1 - dep_install_list=("${PIHOLE_DEPS[@]}") - if [[ "${INSTALL_WEB_SERVER}" == true ]]; then - dep_install_list+=("${PIHOLE_WEB_DEPS[@]}") - fi - install_dependent_packages "${dep_install_list[@]}" - ''') - - assert install.rc == 0 From b375dd2c8172fcec2fdf54c24ddac34059b00955 Mon Sep 17 00:00:00 2001 From: pvogt09 <50047961+pvogt09@users.noreply.github.com> Date: Sun, 15 Nov 2020 20:11:25 +0100 Subject: [PATCH 7/7] Update test/ubuntu_20.Dockerfile Co-authored-by: Adam Warner Signed-off-by: pvogt09 <50047961+pvogt09@users.noreply.github.com> --- test/ubuntu_20.Dockerfile | 1 + 1 file changed, 1 insertion(+) diff --git a/test/ubuntu_20.Dockerfile b/test/ubuntu_20.Dockerfile index c071fcd9..caa6261f 100644 --- a/test/ubuntu_20.Dockerfile +++ b/test/ubuntu_20.Dockerfile @@ -7,6 +7,7 @@ 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 +ENV DEBIAN_FRONTEND=noninteractive RUN true && \ chmod +x $SCRIPTDIR/*