Merge pull request #599 from pi-hole/test/ftl-patch

Latest CI error is a build script failure not a real build/test failure.  Its trying to push an image with this branch name as the docker tag but the image was built with v5 branch tag. merging shouldn't hurt
This commit is contained in:
Adam Hill 2020-04-18 18:48:42 -05:00 committed by GitHub
commit b9b8b1f8bd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 2 additions and 13 deletions

View File

@ -282,9 +282,6 @@ setup_web_port() {
echo "Custom WEB_PORT set to $web_port"
echo "INFO: Without proper router DNAT forwarding to $ServerIP:$web_port, you may not get any blocked websites on ads"
# Update any default port 80 references in the HTML
grep -Prl '://127\.0\.0\.1/' /var/www/html/ | xargs -r sed -i "s|/127\.0\.0\.1/|/127.0.0.1:${WEB_PORT}/|g"
grep -Prl '://pi\.hole/' /var/www/html/ | xargs -r sed -i "s|/pi\.hole/|/pi\.hole:${WEB_PORT}/|g"
# Update lighttpd's port
sed -i '/server.port\s*=\s*80\s*$/ s/80/'$WEB_PORT'/g' /etc/lighttpd/lighttpd.conf

View File

@ -69,7 +69,7 @@ fetch_release_metadata() {
if [[ $CHECKOUT_BRANCHES == true ]] ; then
ln -s /bin/true /usr/local/bin/service
ln -s /bin/true /usr/local/bin/update-rc.d
echo "${CORE_VERSION}" | sudo tee /etc/pihole/ftlbranch
echo "fix/docker_issues" | sudo tee /etc/pihole/ftlbranch
echo y | bash -x pihole checkout core ${CORE_VERSION}
echo y | bash -x pihole checkout web ${WEB_VERSION}
# echo y | bash -x pihole checkout ftl ${CORE_VERSION}

View File

@ -29,21 +29,13 @@ def test_IPv6_not_True_removes_ipv6(Docker, Slow, test_args, expected_ipv6, expe
@pytest.mark.parametrize('test_args', ['-e "WEB_PORT=999"'])
def test_overrides_default_WEB_PORT(Docker, Slow, test_args):
''' When a --net=host user sets WEB_PORT to avoid synology's 80 default IPv4 and or IPv6 ports are updated'''
CONFIG_LINE = 'server.port\s*=\s*999'
CONFIG_LINE = r'server.port\s*=\s*999'
WEB_CONFIG = '/etc/lighttpd/lighttpd.conf'
function = Docker.run('. /bash_functions.sh ; eval `grep setup_web_port /start.sh`')
assert "Custom WEB_PORT set to 999" in function.stdout
assert "INFO: Without proper router DNAT forwarding to 127.0.0.1:999, you may not get any blocked websites on ads" in function.stdout
Slow(lambda: re.search(CONFIG_LINE, Docker.run('cat {}'.format(WEB_CONFIG)).stdout) != None)
Slow(lambda: re.search('://127.0.0.1:999/', Docker.run('cat /var/www/html/pihole/index.php').stdout) != None)
# grep fails to find any of the old address w/o port
#assert Docker.run('grep -r "://127.0.0.1/" /var/www/html/').stdout == ''
#assert Docker.run('grep -r "://pi.hole/" /var/www/html/').stdout == ''
## Find at least one instance of our changes
## upstream repos determines how many and I don't want to keep updating this test
#assert int(Docker.run('grep -rl "://127.0.0.1:999/" /var/www/html/ | wc -l').stdout) >= 1
#assert int(Docker.run('grep -rl "://pi.hole:999/" /var/www/html/ | wc -l').stdout) >= 1
@pytest.mark.parametrize('test_args,expected_error', [