mirror of
https://github.com/pi-hole/pi-hole.git
synced 2025-04-22 23:30:13 +00:00
resolve with dig instead of relying on /etc/resolv.conf
Signed-off-by: pvogt09 <50047961+pvogt09@users.noreply.github.com>
This commit is contained in:
parent
8ad746c1d4
commit
47658cec51
1 changed files with 17 additions and 7 deletions
|
@ -636,8 +636,10 @@ def test_installPihole_fresh_install_readableBlockpage(Pihole, test_webpage):
|
||||||
# TODO: which other files have to be checked?
|
# TODO: which other files have to be checked?
|
||||||
# check web interface files
|
# check web interface files
|
||||||
# change nameserver to pi-hole
|
# change nameserver to pi-hole
|
||||||
ns = Pihole.run('sed -i "s/nameserver.*/nameserver 127.0.0.1/" /etc/resolv.conf')
|
# setting nameserver in /etc/resolv.conf to pi-hole does
|
||||||
print(ns.stdout)
|
# not work here because of the way docker uses this file
|
||||||
|
ns = Pihole.run("sed -i 's/nameserver.*/nameserver 127.0.0.1/' /etc/resolv.conf")
|
||||||
|
pihole_is_ns = ns.rc == 0
|
||||||
if installWebInterface is True:
|
if installWebInterface is True:
|
||||||
# TODO: login into admin interface?
|
# TODO: login into admin interface?
|
||||||
passwordcommand = 'grep "WEBPASSWORD" -c "/etc/pihole/setupVars.conf"'
|
passwordcommand = 'grep "WEBPASSWORD" -c "/etc/pihole/setupVars.conf"'
|
||||||
|
@ -665,17 +667,25 @@ def test_installPihole_fresh_install_readableBlockpage(Pihole, test_webpage):
|
||||||
r"failed to open stream: " +
|
r"failed to open stream: " +
|
||||||
r"Permission denied in"),
|
r"Permission denied in"),
|
||||||
re.I)
|
re.I)
|
||||||
|
# using cURL option --dns-servers is not possible
|
||||||
status = (
|
status = (
|
||||||
'curl -s --head "{}" | ' +
|
'curl -s --head "{}" | ' +
|
||||||
'head -n 1 | ' +
|
'head -n 1 | ' +
|
||||||
'grep "HTTP/1.[01] [23].." > /dev/null')
|
'grep "HTTP/1.[01] [23].." > /dev/null')
|
||||||
pagecontent = 'curl --verbose -L "{}"'
|
pagecontent = 'curl --verbose -L "{}"'
|
||||||
for page in piholeWebpage:
|
for page in piholeWebpage:
|
||||||
# check HTTP status of blockpage
|
d = Pihole.run("echo {} | sed -e 's|http://||' -e 's|/.*||'".format(page))
|
||||||
actual_rc = Pihole.run(status.format(page))
|
print(d.stdout)
|
||||||
assert exit_status_success == actual_rc.rc
|
dig = Pihole.run("dig @127.0.0.1 $(echo {} | sed -e 's|http://||' -e 's|/.*||')".format(page))
|
||||||
actual_output = Pihole.run(pagecontent.format(page))
|
print(dig.stdout)
|
||||||
assert noPHPfopen.match(actual_output.stdout) is None
|
dig = Pihole.run("nslookup $(echo {} | sed -e 's|http://||' -e 's|/.*||') 127.0.0.1".format(page))
|
||||||
|
print(dig.stdout)
|
||||||
|
if dig.rc == 0 or pihole_is_ns:
|
||||||
|
# check HTTP status of blockpage
|
||||||
|
actual_rc = Pihole.run(status.format(page))
|
||||||
|
assert exit_status_success == actual_rc.rc
|
||||||
|
actual_output = Pihole.run(pagecontent.format(page))
|
||||||
|
assert noPHPfopen.match(actual_output.stdout) is None
|
||||||
|
|
||||||
|
|
||||||
def test_update_package_cache_success_no_errors(Pihole):
|
def test_update_package_cache_success_no_errors(Pihole):
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue