Commit b5bfa000 authored by Alexandre's avatar Alexandre
Browse files

Fix result for truncated test

parent 79a90891
......@@ -708,11 +708,17 @@ def run_check_trunc(connection):
error(e)
except OpenSSL.SSL.ZeroReturnError: # This is acceptable
return ok
request.check_response()
if print_result(connection, request, prefix=test_name, display_err=True): # The test must fail, or returns FORMERR.
ok = (request.rcode == dns.rcode.FORMERR)
if request.check_response(): # FORMERR is expected
if dot:
ok = request.rcode == dns.rcode.FORMERR
else:
ok = (request.response.rcode() == dns.rcode.FORMERR)
else:
ok = (request.rcode >= 400 and request.rcode < 500)
if dot:
ok = False
else: # a 400 response's status is acceptable
ok = (request.rcode >= 400 and request.rcode < 500)
print_result(connection, request, prefix=test_name, display_err=not ok)
return ok
def run_check_additionals(connection):
......
......@@ -110,6 +110,32 @@ tests:
stderr: ''
stdout: "OK\n"
- exe: './homer.py'
name: "[doh][check] Successcul check"
markers:
- 'doh'
- 'check'
args:
- '--check'
- 'https://dns.google/dns-query'
- 'framagit.org'
stderr: ''
stdout: "OK\n"
- exe: './homer.py'
name: "[doh][fail][check] 502 Bad Gateway"
markers:
- 'doh'
- 'check'
- 'fail'
timeout: 10
args:
- '--check'
- 'https://doh.42l.fr/dns-query'
- 'framagit.org'
partstderr: 'Test truncated data: HTTP error 502'
stdout: "KO\n"
- exe: './homer.py'
name: '[doh][check] Test that all the resolved IPs are tried, try a first IP'
markers:
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment