mirror of
https://github.com/pi-hole/docker-pi-hole.git
synced 2025-12-20 02:18:51 +00:00
various test fixes
This commit is contained in:
13
install.sh
13
install.sh
@@ -4,9 +4,9 @@ mkdir -p /etc/pihole/
|
|||||||
# Make pihole scripts fail searching for `systemctl`,
|
# Make pihole scripts fail searching for `systemctl`,
|
||||||
# which fails pretty miserably in docker compared to `service`
|
# which fails pretty miserably in docker compared to `service`
|
||||||
# For more info see docker/docker issue #7459
|
# 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
|
# 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
|
# Get the install functions
|
||||||
wget -O "$PIHOLE_INSTALL" https://install.pi-hole.net
|
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/ i\ echo "Hi Alpine"' "$PIHOLE_INSTALL"
|
||||||
sed -i '/OS distribution not supported/,+1d' "$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"
|
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 '/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 's/www-data/nginx/g' "$PIHOLE_INSTALL"
|
||||||
sed -i '/LIGHTTPD_CFG/d' "${PIHOLE_INSTALL}"
|
sed -i '/LIGHTTPD_CFG/d' "${PIHOLE_INSTALL}"
|
||||||
sed -i '/etc\/cron.d\//d' "${PIHOLE_INSTALL}"
|
sed -i '/etc\/cron.d\//d' "${PIHOLE_INSTALL}"
|
||||||
LIGHTTPD_USER="nginx"
|
LIGHTTPD_USER="nginx" # shellcheck disable=SC2034
|
||||||
LIGHTTPD_GROUP="nginx"
|
LIGHTTPD_GROUP="nginx" # shellcheck disable=SC2034
|
||||||
LIGHTTPD_CFG="lighttpd.conf.debian"
|
LIGHTTPD_CFG="lighttpd.conf.debian" # shellcheck disable=SC2034
|
||||||
DNSMASQ_USER="dnsmasq"
|
DNSMASQ_USER="dnsmasq" # shellcheck disable=SC2034
|
||||||
fi
|
fi
|
||||||
PH_TEST=true . "${PIHOLE_INSTALL}"
|
PH_TEST=true . "${PIHOLE_INSTALL}"
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
docker-compose
|
docker-compose
|
||||||
pytest
|
pytest==2.9.2
|
||||||
pytest-xdist
|
pytest-cov==2.3.0
|
||||||
pytest-cov
|
pytest-xdist==1.14
|
||||||
testinfra
|
testinfra==1.5.1
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ run_local = testinfra.get_backend(
|
|||||||
@pytest.mark.parametrize("upstream,image,tag", [
|
@pytest.mark.parametrize("upstream,image,tag", [
|
||||||
( 'alpine:edge', 'alpine.docker', 'diginc/pi-hole:alpine' ),
|
( 'alpine:edge', 'alpine.docker', 'diginc/pi-hole:alpine' ),
|
||||||
( 'debian:jessie', 'debian.docker', 'diginc/pi-hole:debian' ),
|
( '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):
|
def test_build_pihole_image(upstream, image, tag):
|
||||||
run_local('docker pull {}'.format(upstream))
|
run_local('docker pull {}'.format(upstream))
|
||||||
|
|||||||
@@ -38,7 +38,10 @@ def test_indecies_are_present(RunningPiHole):
|
|||||||
File('/var/www/html/pihole/index.html').exists
|
File('/var/www/html/pihole/index.html').exists
|
||||||
File('/var/www/html/pihole/index.js').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' ] )
|
@pytest.mark.parametrize('url', [ '/', '/index.html', '/any.html' ] )
|
||||||
def test_html_index_requests_load_as_expected(RunningPiHole, ip, url):
|
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)
|
command = 'curl -s -o /tmp/curled_file -w "%{{http_code}}" http://{}{}'.format(ip, url)
|
||||||
|
|||||||
Reference in New Issue
Block a user