From f7982dfbe1ede1eb028716bed1d5b5ac920b8972 Mon Sep 17 00:00:00 2001 From: Adam Warner Date: Mon, 16 Nov 2020 22:39:50 +0000 Subject: [PATCH] -remove duplicate OS dockerfiles +rename centos->centos_8, centos7 -> centos_7 +update centos/fedora test script Signed-off-by: Adam Warner --- ...centos7.Dockerfile => centos_7.Dockerfile} | 0 ...{centos.Dockerfile => centos_8.Dockerfile} | 0 test/conftest.py | 6 ++-- test/debian.Dockerfile | 16 ---------- test/fedora.Dockerfile | 16 ---------- test/test_centos_fedora_support.py | 30 +++++++++---------- tox.ini | 8 ++--- 7 files changed, 20 insertions(+), 56 deletions(-) rename test/{centos7.Dockerfile => centos_7.Dockerfile} (100%) rename test/{centos.Dockerfile => centos_8.Dockerfile} (100%) delete mode 100644 test/debian.Dockerfile delete mode 100644 test/fedora.Dockerfile diff --git a/test/centos7.Dockerfile b/test/centos_7.Dockerfile similarity index 100% rename from test/centos7.Dockerfile rename to test/centos_7.Dockerfile diff --git a/test/centos.Dockerfile b/test/centos_8.Dockerfile similarity index 100% rename from test/centos.Dockerfile rename to test/centos_8.Dockerfile diff --git a/test/conftest.py b/test/conftest.py index 3fd2524a..cda861c1 100644 --- a/test/conftest.py +++ b/test/conftest.py @@ -70,12 +70,10 @@ def args(request): @pytest.fixture(params=[ - 'debian', 'debian_9', 'debian_10', - 'centos7', - 'centos', - 'fedora', + 'centos_7', + 'centos_8', 'fedora_31', 'fedora_32', 'ubuntu_16', diff --git a/test/debian.Dockerfile b/test/debian.Dockerfile deleted file mode 100644 index d6609ba3..00000000 --- a/test/debian.Dockerfile +++ /dev/null @@ -1,16 +0,0 @@ -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.Dockerfile b/test/fedora.Dockerfile deleted file mode 100644 index 02dcb733..00000000 --- a/test/fedora.Dockerfile +++ /dev/null @@ -1,16 +0,0 @@ -FROM fedora:31 - -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_centos_fedora_support.py b/test/test_centos_fedora_support.py index b4ae7c89..8dd0ee5f 100644 --- a/test/test_centos_fedora_support.py +++ b/test/test_centos_fedora_support.py @@ -23,7 +23,7 @@ def mock_selinux_config(state, Pihole): '''.format(state=state.lower())) -@pytest.mark.parametrize("tag", [('centos'), ('fedora'), ]) +@pytest.mark.parametrize("tag", [('centos_7'), ('centos_8'), ('fedora_31'), ('fedora_32'), ]) def test_selinux_enforcing_exit(Pihole): ''' confirms installer prompts to exit when SELinux is Enforcing by default @@ -40,7 +40,7 @@ def test_selinux_enforcing_exit(Pihole): assert check_selinux.rc == 1 -@pytest.mark.parametrize("tag", [('centos'), ('fedora'), ]) +@pytest.mark.parametrize("tag", [('centos_7'), ('centos_8'), ('fedora_31'), ('fedora_32'), ]) def test_selinux_permissive(Pihole): ''' confirms installer continues when SELinux is Permissive @@ -55,7 +55,7 @@ def test_selinux_permissive(Pihole): assert check_selinux.rc == 0 -@pytest.mark.parametrize("tag", [('centos'), ('fedora'), ]) +@pytest.mark.parametrize("tag", [('centos_7'), ('centos_8'), ('fedora_31'), ('fedora_32'), ]) def test_selinux_disabled(Pihole): ''' confirms installer continues when SELinux is Disabled @@ -70,7 +70,7 @@ def test_selinux_disabled(Pihole): assert check_selinux.rc == 0 -@pytest.mark.parametrize("tag", [('fedora'), ]) +@pytest.mark.parametrize("tag", [('fedora_31'), ('fedora_32'), ]) def test_epel_and_remi_not_installed_fedora(Pihole): ''' confirms installer does not attempt to install EPEL/REMI repositories @@ -88,7 +88,7 @@ def test_epel_and_remi_not_installed_fedora(Pihole): assert not remi_package.is_installed -@pytest.mark.parametrize("tag", [('centos7'), ('centos'), ]) +@pytest.mark.parametrize("tag", [('centos_7'), ('centos_8'), ]) def test_release_supported_version_check_centos(Pihole): ''' confirms installer exits on unsupported releases of CentOS @@ -105,7 +105,7 @@ def test_release_supported_version_check_centos(Pihole): assert expected_stdout in distro_check.stdout -@pytest.mark.parametrize("tag", [('centos7'), ('centos'), ]) +@pytest.mark.parametrize("tag", [('centos_7'), ('centos_8'), ]) def test_enable_epel_repository_centos(Pihole): ''' confirms the EPEL package repository is enabled when installed on CentOS @@ -123,7 +123,7 @@ def test_enable_epel_repository_centos(Pihole): assert epel_package.is_installed -@pytest.mark.parametrize("tag", [('centos7'), ]) +@pytest.mark.parametrize("tag", [('centos_7'), ]) def test_php_upgrade_default_optout_centos_eq_7(Pihole): ''' confirms the default behavior to opt-out of installing PHP7 from REMI @@ -139,7 +139,7 @@ def test_php_upgrade_default_optout_centos_eq_7(Pihole): assert not remi_package.is_installed -@pytest.mark.parametrize("tag", [('centos'), ]) +@pytest.mark.parametrize("tag", [('centos_8'), ]) def test_php_upgrade_default_continue_centos_gte_8(Pihole): ''' confirms the latest version of CentOS continues / does not optout @@ -157,7 +157,7 @@ def test_php_upgrade_default_continue_centos_gte_8(Pihole): assert not remi_package.is_installed -@pytest.mark.parametrize("tag", [('centos7'), ]) +@pytest.mark.parametrize("tag", [('centos_7'), ]) def test_php_upgrade_user_optout_centos_eq_7(Pihole): ''' confirms installer behavior when user opt-out of installing PHP7 from REMI @@ -176,7 +176,7 @@ def test_php_upgrade_user_optout_centos_eq_7(Pihole): assert not remi_package.is_installed -@pytest.mark.parametrize("tag", [('centos'), ]) +@pytest.mark.parametrize("tag", [('centos_8'), ]) def test_php_upgrade_user_optout_skipped_centos_gte_8(Pihole): ''' confirms installer skips user opt-out of installing PHP7 from REMI on @@ -197,7 +197,7 @@ def test_php_upgrade_user_optout_skipped_centos_gte_8(Pihole): assert not remi_package.is_installed -@pytest.mark.parametrize("tag", [('centos7'), ]) +@pytest.mark.parametrize("tag", [('centos_7'), ]) def test_php_upgrade_user_optin_centos_eq_7(Pihole): ''' confirms installer behavior when user opt-in to installing PHP7 from REMI @@ -220,7 +220,7 @@ def test_php_upgrade_user_optin_centos_eq_7(Pihole): assert remi_package.is_installed -@pytest.mark.parametrize("tag", [('centos'), ]) +@pytest.mark.parametrize("tag", [('centos_8'), ]) def test_php_upgrade_user_optin_skipped_centos_gte_8(Pihole): ''' confirms installer skips user opt-in to installing PHP7 from REMI on @@ -244,7 +244,7 @@ def test_php_upgrade_user_optin_skipped_centos_gte_8(Pihole): assert not remi_package.is_installed -@pytest.mark.parametrize("tag", [('centos7'), ('centos'), ]) +@pytest.mark.parametrize("tag", [('centos_7'), ('centos_8'), ]) 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 @@ -267,7 +267,7 @@ def test_php_version_lt_7_detected_upgrade_default_optout_centos(Pihole): assert not remi_package.is_installed -@pytest.mark.parametrize("tag", [('centos7'), ('centos'), ]) +@pytest.mark.parametrize("tag", [('centos_7'), ('centos_8'), ]) def test_php_version_lt_7_detected_upgrade_user_optout_centos(Pihole): ''' confirms installer behavior when user opt-out to upgrade to PHP7 via REMI @@ -292,7 +292,7 @@ def test_php_version_lt_7_detected_upgrade_user_optout_centos(Pihole): assert not remi_package.is_installed -@pytest.mark.parametrize("tag", [('centos7'), ('centos'), ]) +@pytest.mark.parametrize("tag", [('centos_7'), ('centos_8'), ]) def test_php_version_lt_7_detected_upgrade_user_optin_centos(Pihole): ''' confirms installer behavior when user opt-in to upgrade to PHP7 via REMI diff --git a/tox.ini b/tox.ini index 17d19052..1142aea8 100644 --- a/tox.ini +++ b/tox.ini @@ -4,12 +4,10 @@ envlist = py37 [testenv] 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 . +commands = 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/centos_7.Dockerfile -t pytest_pihole:centos_7 . + docker build -f test/centos_8.Dockerfile -t pytest_pihole:centos_8 . 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 .