From 2c461460dbdedbd34451e9ff9a3657e65fbbaa3f Mon Sep 17 00:00:00 2001 From: bcambl Date: Sat, 8 Aug 2020 11:15:49 -0600 Subject: [PATCH] test with both centos7 and centos8 images Signed-off-by: bcambl --- test/centos.Dockerfile | 2 +- test/centos7.Dockerfile | 16 ++++++++++++++++ test/conftest.py | 2 +- test/test_000_build_containers.py | 1 + test/test_centos_fedora_support.py | 8 ++++---- tox.ini | 1 + 6 files changed, 24 insertions(+), 6 deletions(-) create mode 100644 test/centos7.Dockerfile diff --git a/test/centos.Dockerfile b/test/centos.Dockerfile index 00543b67..7444551b 100644 --- a/test/centos.Dockerfile +++ b/test/centos.Dockerfile @@ -1,4 +1,4 @@ -FROM centos:7 +FROM centos:8 ENV GITDIR /etc/.pihole ENV SCRIPTDIR /opt/pihole diff --git a/test/centos7.Dockerfile b/test/centos7.Dockerfile new file mode 100644 index 00000000..00543b67 --- /dev/null +++ b/test/centos7.Dockerfile @@ -0,0 +1,16 @@ +FROM centos:7 + +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/conftest.py b/test/conftest.py index 5b8be41e..69926eaf 100644 --- a/test/conftest.py +++ b/test/conftest.py @@ -69,7 +69,7 @@ def args(request): return '-t -d' -@pytest.fixture(params=['debian', 'centos', 'fedora']) +@pytest.fixture(params=['debian', 'centos7', 'centos', 'fedora']) def tag(request): ''' consumed by image to make the test matrix diff --git a/test/test_000_build_containers.py b/test/test_000_build_containers.py index 184052f3..0f3e2d1a 100644 --- a/test/test_000_build_containers.py +++ b/test/test_000_build_containers.py @@ -9,6 +9,7 @@ run_local = testinfra.get_backend( @pytest.mark.parametrize("image,tag", [ ('test/debian.Dockerfile', 'pytest_pihole:debian'), + ('test/centos7.Dockerfile', 'pytest_pihole:centos7'), ('test/centos.Dockerfile', 'pytest_pihole:centos'), ('test/fedora.Dockerfile', 'pytest_pihole:fedora'), ]) diff --git a/test/test_centos_fedora_support.py b/test/test_centos_fedora_support.py index 4b405920..e0d25634 100644 --- a/test/test_centos_fedora_support.py +++ b/test/test_centos_fedora_support.py @@ -123,7 +123,7 @@ def test_enable_epel_repository_centos(Pihole): assert epel_package.is_installed -@pytest.mark.parametrize("tag", [('centos'), ]) +@pytest.mark.parametrize("tag", [('centos7'), ('centos8'), ]) def test_php_upgrade_default_optout_centos(Pihole): ''' confirms the default behavior to opt-out of installing PHP7 from REMI @@ -139,7 +139,7 @@ def test_php_upgrade_default_optout_centos(Pihole): assert not remi_package.is_installed -@pytest.mark.parametrize("tag", [('centos'), ]) +@pytest.mark.parametrize("tag", [('centos7'), ('centos8'), ]) def test_php_upgrade_user_optout_centos(Pihole): ''' confirms installer behavior when user opt-out of installing PHP7 from REMI @@ -158,7 +158,7 @@ def test_php_upgrade_user_optout_centos(Pihole): assert not remi_package.is_installed -@pytest.mark.parametrize("tag", [('centos'), ]) +@pytest.mark.parametrize("tag", [('centos7'), ('centos8'), ]) def test_php_upgrade_user_optin_centos(Pihole): ''' confirms installer behavior when user opt-in to installing PHP7 from REMI @@ -181,7 +181,7 @@ def test_php_upgrade_user_optin_centos(Pihole): assert remi_package.is_installed -@pytest.mark.parametrize("tag", [('centos'), ]) +@pytest.mark.parametrize("tag", [('centos7'), ('centos8'), ]) def test_php_version_lt_7_detected_upgrade_default_optout_centos(Pihole): ''' confirms the default behavior to opt-out of upgrading to PHP7 from REMI diff --git a/tox.ini b/tox.ini index 346ca886..49c99066 100644 --- a/tox.ini +++ b/tox.ini @@ -5,6 +5,7 @@ envlist = py37 whitelist_externals = docker deps = -rrequirements.txt 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 . pytest {posargs:-vv -n auto} -m "not build_stage" ./test/