diff --git a/install.sh b/install.sh index e57c9b5..aa0103d 100755 --- a/install.sh +++ b/install.sh @@ -4,9 +4,9 @@ mkdir -p /etc/pihole/ # Make pihole scripts fail searching for `systemctl`, # which fails pretty miserably in docker compared to `service` # For more info see docker/docker issue #7459 -mv `which systemctl` /bin/no_systemctl && \ +mv "$(which systemctl)" /bin/no_systemctl && \ # debconf-apt-progress seems to hang so get rid of it too -mv `which debconf-apt-progress` /bin/no_debconf-apt-progress +mv "$(which debconf-apt-progress)" /bin/no_debconf-apt-progress # Get the install functions wget -O "$PIHOLE_INSTALL" https://install.pi-hole.net @@ -14,14 +14,15 @@ if [[ "$IMAGE" == 'alpine' ]] ; then sed -i '/OS distribution not supported/ i\ echo "Hi Alpine"' "$PIHOLE_INSTALL" sed -i '/OS distribution not supported/,+1d' "$PIHOLE_INSTALL" sed -i 's#nologin pihole#nologin pihole 2>/dev/null || adduser -S -s /sbin/nologin pihole#g' "$PIHOLE_INSTALL" + # shellcheck disable=SC2016 sed -i '/usermod -a -G/ s#$# 2> /dev/null || addgroup pihole ${LIGHTTPD_GROUP}#g' "$PIHOLE_INSTALL" sed -i 's/www-data/nginx/g' "$PIHOLE_INSTALL" sed -i '/LIGHTTPD_CFG/d' "${PIHOLE_INSTALL}" sed -i '/etc\/cron.d\//d' "${PIHOLE_INSTALL}" - LIGHTTPD_USER="nginx" - LIGHTTPD_GROUP="nginx" - LIGHTTPD_CFG="lighttpd.conf.debian" - DNSMASQ_USER="dnsmasq" + LIGHTTPD_USER="nginx" # shellcheck disable=SC2034 + LIGHTTPD_GROUP="nginx" # shellcheck disable=SC2034 + LIGHTTPD_CFG="lighttpd.conf.debian" # shellcheck disable=SC2034 + DNSMASQ_USER="dnsmasq" # shellcheck disable=SC2034 fi PH_TEST=true . "${PIHOLE_INSTALL}" diff --git a/requirements.txt b/requirements.txt index 53737ca..b455a17 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,5 +1,5 @@ docker-compose -pytest -pytest-xdist -pytest-cov -testinfra +pytest==2.9.2 +pytest-cov==2.3.0 +pytest-xdist==1.14 +testinfra==1.5.1 diff --git a/test/test_000_build_containers.py b/test/test_000_build_containers.py index fece246..1940e8f 100644 --- a/test/test_000_build_containers.py +++ b/test/test_000_build_containers.py @@ -9,7 +9,7 @@ run_local = testinfra.get_backend( @pytest.mark.parametrize("upstream,image,tag", [ ( 'alpine:edge', 'alpine.docker', 'diginc/pi-hole:alpine' ), ( 'debian:jessie', 'debian.docker', 'diginc/pi-hole:debian' ), - ( 'jsurf/rpi-raspbian', 'debian-armhf.docker', 'diginc/pi-hole:arm' ), + #( 'jsurf/rpi-raspbian', 'debian-armhf.docker', 'diginc/pi-hole:arm' ), ]) def test_build_pihole_image(upstream, image, tag): run_local('docker pull {}'.format(upstream)) diff --git a/test/test_start.py b/test/test_start.py index 6ec4301..87bb08a 100644 --- a/test/test_start.py +++ b/test/test_start.py @@ -38,7 +38,10 @@ def test_indecies_are_present(RunningPiHole): File('/var/www/html/pihole/index.html').exists File('/var/www/html/pihole/index.js').exists -@pytest.mark.parametrize('ip', [ '127.0.0.1', '[::]' ] ) +@pytest.mark.parametrize('ip,args', [ + ('127.0.0.1', '-e ServerIP="192.168.100.2" -e VIRTUAL_HOST="127.0.0.1"'), + ('[::]', '-e ServerIP="192.168.100.2" -e VIRTUAL_HOST="[::]"') +]) @pytest.mark.parametrize('url', [ '/', '/index.html', '/any.html' ] ) def test_html_index_requests_load_as_expected(RunningPiHole, ip, url): command = 'curl -s -o /tmp/curled_file -w "%{{http_code}}" http://{}{}'.format(ip, url)