diff --git a/test/conftest.py b/test/conftest.py index 69926eaf..3fd2524a 100644 --- a/test/conftest.py +++ b/test/conftest.py @@ -69,7 +69,19 @@ def args(request): return '-t -d' -@pytest.fixture(params=['debian', 'centos7', 'centos', 'fedora']) +@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/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_31.Dockerfile b/test/fedora_31.Dockerfile new file mode 100644 index 00000000..02dcb733 --- /dev/null +++ b/test/fedora_31.Dockerfile @@ -0,0 +1,16 @@ +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/fedora_32.Dockerfile b/test/fedora_32.Dockerfile new file mode 100644 index 00000000..869efb2b --- /dev/null +++ b/test/fedora_32.Dockerfile @@ -0,0 +1,16 @@ +FROM fedora:32 + +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..dfaba1ac 100644 --- a/test/test_000_build_containers.py +++ b/test/test_000_build_containers.py @@ -9,9 +9,16 @@ 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_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_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/test/ubuntu_20.Dockerfile b/test/ubuntu_20.Dockerfile new file mode 100644 index 00000000..caa6261f --- /dev/null +++ b/test/ubuntu_20.Dockerfile @@ -0,0 +1,17 @@ +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 +ENV DEBIAN_FRONTEND=noninteractive + +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..17d19052 100644 --- a/tox.ini +++ b/tox.ini @@ -5,7 +5,14 @@ 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_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/