mirror of
https://github.com/pi-hole/docker-pi-hole.git
synced 2025-12-20 02:18:51 +00:00
alpine 3.2 startup tests fixed, web still failing
This commit is contained in:
@@ -17,7 +17,8 @@ ENV S6OVERLAY_RELEASE https://github.com/just-containers/s6-overlay/releases/dow
|
|||||||
# TODO Re-enable upgrade after php5 packages use the latest greatest libressl packages, conflicts are breaking build 2017-11-14
|
# TODO Re-enable upgrade after php5 packages use the latest greatest libressl packages, conflicts are breaking build 2017-11-14
|
||||||
#RUN apk update && \
|
#RUN apk update && \
|
||||||
RUN apk upgrade --update && \
|
RUN apk upgrade --update && \
|
||||||
apk add bind-tools wget curl bash libcap ncurses && \
|
apk add bind-tools wget curl bash libcap ncurses shadow && \
|
||||||
|
usermod -s bash root && \
|
||||||
{% else %}
|
{% else %}
|
||||||
RUN apt-get update && \
|
RUN apt-get update && \
|
||||||
apt-get install -y wget curl net-tools cron && \
|
apt-get install -y wget curl net-tools cron && \
|
||||||
@@ -55,6 +56,7 @@ RUN mkdir -p /etc/pihole/ && \
|
|||||||
sed -i "s/@INT@/eth0/" /etc/dnsmasq.d/01-pihole.conf && \
|
sed -i "s/@INT@/eth0/" /etc/dnsmasq.d/01-pihole.conf && \
|
||||||
setcap CAP_NET_BIND_SERVICE=+eip `which dnsmasq` && \
|
setcap CAP_NET_BIND_SERVICE=+eip `which dnsmasq` && \
|
||||||
echo 'Done!'
|
echo 'Done!'
|
||||||
|
COPY s6/timeout /usr/local/bin/timeout
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
# php config start passes special ENVs into
|
# php config start passes special ENVs into
|
||||||
|
|||||||
@@ -16,7 +16,8 @@ ENV S6OVERLAY_RELEASE https://github.com/just-containers/s6-overlay/releases/dow
|
|||||||
# TODO Re-enable upgrade after php5 packages use the latest greatest libressl packages, conflicts are breaking build 2017-11-14
|
# TODO Re-enable upgrade after php5 packages use the latest greatest libressl packages, conflicts are breaking build 2017-11-14
|
||||||
#RUN apk update && \
|
#RUN apk update && \
|
||||||
RUN apk upgrade --update && \
|
RUN apk upgrade --update && \
|
||||||
apk add bind-tools wget curl bash libcap ncurses && \
|
apk add bind-tools wget curl bash libcap ncurses shadow && \
|
||||||
|
usermod -s bash root && \
|
||||||
curl -L -s $S6OVERLAY_RELEASE \
|
curl -L -s $S6OVERLAY_RELEASE \
|
||||||
| tar xvzf - -C / && \
|
| tar xvzf - -C / && \
|
||||||
docker-install.sh && \
|
docker-install.sh && \
|
||||||
@@ -45,6 +46,7 @@ RUN mkdir -p /etc/pihole/ && \
|
|||||||
sed -i "s/@INT@/eth0/" /etc/dnsmasq.d/01-pihole.conf && \
|
sed -i "s/@INT@/eth0/" /etc/dnsmasq.d/01-pihole.conf && \
|
||||||
setcap CAP_NET_BIND_SERVICE=+eip `which dnsmasq` && \
|
setcap CAP_NET_BIND_SERVICE=+eip `which dnsmasq` && \
|
||||||
echo 'Done!'
|
echo 'Done!'
|
||||||
|
COPY s6/timeout /usr/local/bin/timeout
|
||||||
|
|
||||||
# php config start passes special ENVs into
|
# php config start passes special ENVs into
|
||||||
ENV PHP_ENV_CONFIG '/etc/php5/fpm.d/envs.conf'
|
ENV PHP_ENV_CONFIG '/etc/php5/fpm.d/envs.conf'
|
||||||
|
|||||||
@@ -14,9 +14,10 @@ ENV PIHOLE_INSTALL /tmp/ph_install.sh
|
|||||||
ENV S6OVERLAY_RELEASE https://github.com/just-containers/s6-overlay/releases/download/v1.21.2.1/s6-overlay-armhf.tar.gz
|
ENV S6OVERLAY_RELEASE https://github.com/just-containers/s6-overlay/releases/download/v1.21.2.1/s6-overlay-armhf.tar.gz
|
||||||
|
|
||||||
# TODO Re-enable upgrade after php5 packages use the latest greatest libressl packages, conflicts are breaking build 2017-11-14
|
# TODO Re-enable upgrade after php5 packages use the latest greatest libressl packages, conflicts are breaking build 2017-11-14
|
||||||
# RUN apk upgrade --update && \
|
#RUN apk update && \
|
||||||
RUN apk update && \
|
RUN apk upgrade --update && \
|
||||||
apk add bind-tools wget curl bash libcap && \
|
apk add bind-tools wget curl bash libcap ncurses shadow && \
|
||||||
|
usermod -s bash root && \
|
||||||
curl -L -s $S6OVERLAY_RELEASE \
|
curl -L -s $S6OVERLAY_RELEASE \
|
||||||
| tar xvzf - -C / && \
|
| tar xvzf - -C / && \
|
||||||
docker-install.sh && \
|
docker-install.sh && \
|
||||||
@@ -45,6 +46,7 @@ RUN mkdir -p /etc/pihole/ && \
|
|||||||
sed -i "s/@INT@/eth0/" /etc/dnsmasq.d/01-pihole.conf && \
|
sed -i "s/@INT@/eth0/" /etc/dnsmasq.d/01-pihole.conf && \
|
||||||
setcap CAP_NET_BIND_SERVICE=+eip `which dnsmasq` && \
|
setcap CAP_NET_BIND_SERVICE=+eip `which dnsmasq` && \
|
||||||
echo 'Done!'
|
echo 'Done!'
|
||||||
|
COPY s6/timeout /usr/local/bin/timeout
|
||||||
|
|
||||||
# php config start passes special ENVs into
|
# php config start passes special ENVs into
|
||||||
ENV PHP_ENV_CONFIG '/etc/php5/fpm.d/envs.conf'
|
ENV PHP_ENV_CONFIG '/etc/php5/fpm.d/envs.conf'
|
||||||
|
|||||||
@@ -34,7 +34,7 @@ validate_env() {
|
|||||||
unset ServerIPv6
|
unset ServerIPv6
|
||||||
return
|
return
|
||||||
fi
|
fi
|
||||||
if nc -w 1 -z "$ServerIPv6" 53 2>&1 | grep -q "$nc_error" || ! ip route get "$ServerIPv6" ; then
|
if nc -w 1 -z "$ServerIPv6" 53 2>&1 | grep -q "$nc_error" || ! ip route get "$ServerIPv6" > /dev/null ; then
|
||||||
echo "ERROR: ServerIPv6 Environment variable ($ServerIPv6) doesn't appear to be a valid IPv6 address"
|
echo "ERROR: ServerIPv6 Environment variable ($ServerIPv6) doesn't appear to be a valid IPv6 address"
|
||||||
echo " TIP: If your server is not IPv6 enabled just remove '-e ServerIPv6' from your docker container"
|
echo " TIP: If your server is not IPv6 enabled just remove '-e ServerIPv6' from your docker container"
|
||||||
exit 1
|
exit 1
|
||||||
|
|||||||
@@ -1,10 +1,15 @@
|
|||||||
#!/usr/bin/with-contenv bash
|
#!/usr/bin/with-contenv bash
|
||||||
|
bashCmd='bash'
|
||||||
|
if [ "${PH_VERBOSE:-0}" -gt 0 ] ; then
|
||||||
|
set -x ;
|
||||||
|
bashCmd='bash -x'
|
||||||
|
fi
|
||||||
|
|
||||||
# Early DNS Startup for the gravity list process to use
|
# Early DNS Startup for the gravity list process to use
|
||||||
dnsmasq -7 /etc/dnsmasq.d
|
dnsmasq -7 /etc/dnsmasq.d
|
||||||
|
|
||||||
/start.sh
|
$bashCmd /start.sh
|
||||||
gravity.sh
|
$bashCmd gravity.sh
|
||||||
|
|
||||||
# Done with DNS, let s6 services start up properly configured dns now
|
# Done with DNS, let s6 services start up properly configured dns now
|
||||||
killall -9 dnsmasq
|
killall -9 dnsmasq
|
||||||
|
|||||||
@@ -1,10 +1,15 @@
|
|||||||
#!/usr/bin/with-contenv bash
|
#!/usr/bin/with-contenv bash
|
||||||
|
bashCmd='bash'
|
||||||
|
if [ "${PH_VERBOSE:-0}" -gt 0 ] ; then
|
||||||
|
set -x ;
|
||||||
|
bashCmd='bash -x'
|
||||||
|
fi
|
||||||
|
|
||||||
# Early DNS Startup for the gravity list process to use
|
# Early DNS Startup for the gravity list process to use
|
||||||
dnsmasq -7 /etc/dnsmasq.d
|
dnsmasq -7 /etc/dnsmasq.d
|
||||||
|
|
||||||
/start.sh
|
$bashCmd /start.sh
|
||||||
gravity.sh
|
$bashCmd gravity.sh
|
||||||
|
|
||||||
# Done with DNS, let s6 services start up properly configured dns now
|
# Done with DNS, let s6 services start up properly configured dns now
|
||||||
killall -9 dnsmasq
|
killall -9 dnsmasq
|
||||||
|
|||||||
15
s6/timeout
Executable file
15
s6/timeout
Executable file
@@ -0,0 +1,15 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
# A shim to make busybox timeout take in debian style args
|
||||||
|
# v1 only need support for this style: `timeout 1 getent hosts github.com`
|
||||||
|
|
||||||
|
# Busybox args:
|
||||||
|
# Usage: timeout [-t SECS] [-s SIG] PROG ARGS
|
||||||
|
# Debian args:
|
||||||
|
# Usage: timeout [OPTION] DURATION COMMAND [ARG]...
|
||||||
|
# or: timeout [OPTION]
|
||||||
|
|
||||||
|
TIMEOUT=/usr/bin/timeout
|
||||||
|
SECS="${1}"
|
||||||
|
ARGS="${@:2}"
|
||||||
|
|
||||||
|
$TIMEOUT -t $SECS $ARGS
|
||||||
@@ -53,9 +53,15 @@ def test_indecies_are_present(RunningPiHole):
|
|||||||
def test_html_index_requests_load_as_expected(RunningPiHole, Slow, addr, url):
|
def test_html_index_requests_load_as_expected(RunningPiHole, Slow, addr, url):
|
||||||
command = 'curl -s -o /tmp/curled_file -w "%{{http_code}}" http://{}{}'.format(addr, url)
|
command = 'curl -s -o /tmp/curled_file -w "%{{http_code}}" http://{}{}'.format(addr, url)
|
||||||
http_rc = RunningPiHole.run(command)
|
http_rc = RunningPiHole.run(command)
|
||||||
assert http_rc.rc == 0
|
|
||||||
assert int(http_rc.stdout) == 200
|
|
||||||
page_contents = RunningPiHole.run('cat /tmp/curled_file ').stdout
|
page_contents = RunningPiHole.run('cat /tmp/curled_file ').stdout
|
||||||
|
expeced_http_code = 200
|
||||||
|
|
||||||
|
if http_rc != 0 or http_rc.stdout != expected_http_code:
|
||||||
|
print 'CURL stdout: {}\nCURL stderr:{}\nCURL file:\n{}\n'.format(
|
||||||
|
http_rc.stdout, http_rc.stderr, page_contents)
|
||||||
|
|
||||||
|
assert http_rc.rc == 0
|
||||||
|
assert int(http_rc.stdout) == expected_http_code
|
||||||
assert 'testblock.pi-hole.local' in page_contents
|
assert 'testblock.pi-hole.local' in page_contents
|
||||||
|
|
||||||
@pytest.mark.parametrize('addr', [ 'testblock.pi-hole.local' ])
|
@pytest.mark.parametrize('addr', [ 'testblock.pi-hole.local' ])
|
||||||
@@ -63,9 +69,16 @@ def test_html_index_requests_load_as_expected(RunningPiHole, Slow, addr, url):
|
|||||||
def test_javascript_requests_load_as_expected(RunningPiHole, addr, url):
|
def test_javascript_requests_load_as_expected(RunningPiHole, addr, url):
|
||||||
command = 'curl -s -o /tmp/curled_file -w "%{{http_code}}" http://{}{}'.format(addr, url)
|
command = 'curl -s -o /tmp/curled_file -w "%{{http_code}}" http://{}{}'.format(addr, url)
|
||||||
http_rc = RunningPiHole.run(command)
|
http_rc = RunningPiHole.run(command)
|
||||||
|
page_contents = RunningPiHole.run('cat /tmp/curled_file ').stdout
|
||||||
|
expeced_http_code = 200
|
||||||
|
|
||||||
|
if http_rc != 0 or http_rc.stdout != expected_http_code:
|
||||||
|
print 'CURL stdout: {}\nCURL stderr:{}\nCURL file:\n{}\n'.format(
|
||||||
|
http_rc.stdout, http_rc.stderr, page_contents)
|
||||||
|
|
||||||
assert http_rc.rc == 0
|
assert http_rc.rc == 0
|
||||||
assert int(http_rc.stdout) == 200
|
assert int(http_rc.stdout) == expected_http_code
|
||||||
assert 'var x = "Pi-hole: A black hole for Internet advertisements."' in RunningPiHole.run('cat /tmp/curled_file').stdout
|
assert 'var x = "Pi-hole: A black hole for Internet advertisements."' in page_contents
|
||||||
|
|
||||||
# IPv6 checks aren't passing CORS, removed :(
|
# IPv6 checks aren't passing CORS, removed :(
|
||||||
@pytest.mark.parametrize('addr', [ 'localhost' ] )
|
@pytest.mark.parametrize('addr', [ 'localhost' ] )
|
||||||
@@ -73,9 +86,15 @@ def test_javascript_requests_load_as_expected(RunningPiHole, addr, url):
|
|||||||
def test_admin_requests_load_as_expected(RunningPiHole, addr, url):
|
def test_admin_requests_load_as_expected(RunningPiHole, addr, url):
|
||||||
command = 'curl -s -o /tmp/curled_file -w "%{{http_code}}" http://{}{}'.format(addr, url)
|
command = 'curl -s -o /tmp/curled_file -w "%{{http_code}}" http://{}{}'.format(addr, url)
|
||||||
http_rc = RunningPiHole.run(command)
|
http_rc = RunningPiHole.run(command)
|
||||||
assert http_rc.rc == 0
|
page_contents = RunningPiHole.run('cat /tmp/curled_file ').stdout
|
||||||
assert int(http_rc.stdout) == 200
|
expeced_http_code = 200
|
||||||
assert RunningPiHole.run('wc -l /tmp/curled_file ') > 10
|
|
||||||
assert RunningPiHole.run('grep -q "Content-Security-Policy" /tmp/curled_file ').rc == 0
|
if http_rc != 0 or http_rc.stdout != expected_http_code:
|
||||||
assert RunningPiHole.run('grep -q "scripts/pi-hole/js/footer.js" /tmp/curled_file ').rc == 0
|
print 'CURL stdout: {}\nCURL stderr:{}\nCURL file:\n{}\n'.format(
|
||||||
|
http_rc.stdout, http_rc.stderr, page_contents)
|
||||||
|
|
||||||
|
assert http_rc.rc == 0
|
||||||
|
assert int(http_rc.stdout) == expected_http_code
|
||||||
|
for html_text in ['dns_queries_today', 'Content-Security-Policy', 'scripts/pi-hole/js/footer.js']:
|
||||||
|
assert html_text in page_contents
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user