test with both centos7 and centos8 images

Signed-off-by: bcambl <blayne@blaynecampbell.com>
This commit is contained in:
bcambl 2020-08-08 11:15:49 -06:00 committed by Adam Warner
parent 5aab68ab41
commit 2c461460db
No known key found for this signature in database
GPG key ID: 872950F3ECF2B173
6 changed files with 24 additions and 6 deletions

View file

@ -1,4 +1,4 @@
FROM centos:7 FROM centos:8
ENV GITDIR /etc/.pihole ENV GITDIR /etc/.pihole
ENV SCRIPTDIR /opt/pihole ENV SCRIPTDIR /opt/pihole

16
test/centos7.Dockerfile Normal file
View file

@ -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 && \

View file

@ -69,7 +69,7 @@ def args(request):
return '-t -d' return '-t -d'
@pytest.fixture(params=['debian', 'centos', 'fedora']) @pytest.fixture(params=['debian', 'centos7', 'centos', 'fedora'])
def tag(request): def tag(request):
''' '''
consumed by image to make the test matrix consumed by image to make the test matrix

View file

@ -9,6 +9,7 @@ run_local = testinfra.get_backend(
@pytest.mark.parametrize("image,tag", [ @pytest.mark.parametrize("image,tag", [
('test/debian.Dockerfile', 'pytest_pihole:debian'), ('test/debian.Dockerfile', 'pytest_pihole:debian'),
('test/centos7.Dockerfile', 'pytest_pihole:centos7'),
('test/centos.Dockerfile', 'pytest_pihole:centos'), ('test/centos.Dockerfile', 'pytest_pihole:centos'),
('test/fedora.Dockerfile', 'pytest_pihole:fedora'), ('test/fedora.Dockerfile', 'pytest_pihole:fedora'),
]) ])

View file

@ -123,7 +123,7 @@ def test_enable_epel_repository_centos(Pihole):
assert epel_package.is_installed assert epel_package.is_installed
@pytest.mark.parametrize("tag", [('centos'), ]) @pytest.mark.parametrize("tag", [('centos7'), ('centos8'), ])
def test_php_upgrade_default_optout_centos(Pihole): def test_php_upgrade_default_optout_centos(Pihole):
''' '''
confirms the default behavior to opt-out of installing PHP7 from REMI 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 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): def test_php_upgrade_user_optout_centos(Pihole):
''' '''
confirms installer behavior when user opt-out of installing PHP7 from REMI 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 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): def test_php_upgrade_user_optin_centos(Pihole):
''' '''
confirms installer behavior when user opt-in to installing PHP7 from REMI 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 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): 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 confirms the default behavior to opt-out of upgrading to PHP7 from REMI

View file

@ -5,6 +5,7 @@ envlist = py37
whitelist_externals = docker whitelist_externals = docker
deps = -rrequirements.txt deps = -rrequirements.txt
commands = docker build -f test/debian.Dockerfile -t pytest_pihole:debian . 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/centos.Dockerfile -t pytest_pihole:centos .
docker build -f test/fedora.Dockerfile -t pytest_pihole:fedora . docker build -f test/fedora.Dockerfile -t pytest_pihole:fedora .
pytest {posargs:-vv -n auto} -m "not build_stage" ./test/ pytest {posargs:-vv -n auto} -m "not build_stage" ./test/