Commit 1466ea72 authored by Alexandre's avatar Alexandre
Browse files

New tests and test reordering

parent 66ea1c09
......@@ -63,8 +63,6 @@ def error(msg=None, exit=True):
def error_and_exit(msg=None):
error(msg)
if opts.check:
print('KO')
sys.exit(1)
def usage(msg=None):
......
---
config:
timeout: 4
markers:
- "dot: test specific to DoT"
- "doh: test specific to DoH"
- "monitoring: test using monitoring"
- "exception: test raising an exception"
- "streams: test multistreams with DoH"
- "check: test related to the compliance option --check"
- "forceIPv4: test using the option -4"
......@@ -15,6 +14,10 @@ config:
- "slow: test that need time to run"
tests:
# Test options and option combination
###############################################################################
- name: 'Usage'
exe: './homer.py'
args:
......@@ -31,249 +34,860 @@ tests:
partstderr: 'option --zzz not recognized'
stdout: ''
- name: '[doh] Simple resolution'
# wrong number of options
- name: 'No arguments'
exe: './homer.py'
markers:
- 'doh'
args:
- 'https://doh.bortzmeyer.fr/'
- 'framagit.org'
retcode: 0
stderr: ''
partstdout: '2a01:4f8:'
retcode: 1
partstderr: 'Wrong number of arguments'
stdout: ''
- name: '[dot] Simple resolution'
- name: '[doh] Only a URL'
exe: './homer.py'
markers:
- 'dot'
args:
- '--dot'
- 'dot.bortzmeyer.fr'
- 'framagit.org'
retcode: 0
stderr: ''
partstdout: '2a01:4f8:'
retcode: 1
partstderr: 'Wrong number of arguments'
stdout: ''
- name: '[dot] Not a valid server name or IP'
- name: '[dot] Only a servername'
exe: './homer.py'
markers:
- 'exception'
args:
- '--dot'
- 'https//doh.bortzmeyer.fr'
- 'framagit.org'
retcode: 1
partstderr: 'not a name or'
partstderr: 'Wrong number of arguments'
stdout: ''
- name: '[doh] Repeat single test'
- name: '[doh] Using a file and specifying a domain name'
exe: './homer.py'
markers:
- 'doh'
args:
- '--repeat'
- '3'
- 'https://doh.bortzmeyer.fr/'
- 'wikimedia.org'
retcode: 0
partstdout: "NOERR"
- '-f input_file'
- 'https://doh.bortzmeyer.fr'
- 'afnic.fr'
retcode: 1
partstderr: 'Wrong number of arguments'
stdout: ''
- name: '[dot] Repeat single test'
- name: '[dot] Using a file and specifying a domain name'
exe: './homer.py'
markers:
- 'dot'
args:
- '--dot'
- '--repeat'
- '5'
- '-f input_file'
- 'dot.bortzmeyer.fr'
- 'framasoft.org'
retcode: 0
partstdout: "Test 4\n"
- 'afnic.fr'
retcode: 1
partstderr: 'Wrong number of arguments'
stdout: ''
###############################################################################
# conflicting options
- name: '--check of a correct DoH'
- name: '[doh] Force IPv4 and IPv6'
exe: './homer.py'
markers:
- 'doh'
- 'check'
- 'forceIPv4'
- 'forceIPv6'
args:
- '--check'
- '-4'
- '-6'
- 'https://doh.bortzmeyer.fr/'
- 'ressources-pedagogiques.org'
retcode: 0
stdout: "OK\n"
- 'framagit.org'
retcode: 1
partstderr: 'IPv4 *or* IPv6'
stdout: ''
- name: '--check of a broken DoH'
- name: '[dot] Force IPv4 and IPv6'
exe: './homer.py'
markers:
- 'doh'
- 'check'
- 'dot'
- 'forceIPv4'
- 'forceIPv6'
args:
- '--check'
- 'https://www.bortzmeyer.org/'
- 'ressources-pedagogiques.org'
- '-4'
- '-6'
- '--dot'
- 'dot.bortzmeyer.fr'
- 'framagit.org'
retcode: 1
stderr: ''
stdout: "KO\n"
partstderr: 'IPv4 *or* IPv6'
stdout: ''
- name: '--check of a DoH with HEAD unimplemented'
- name: '[doh] HEAD and POST'
exe: './homer.py'
markers:
- 'doh'
- 'check'
args:
- '--check'
- '--mandatory-level'
- 'nicetohave'
- 'https://doh.42l.fr/dns-query'
- 'ressources-pedagogiques.org'
- '--head'
- '--POST'
- 'https://doh.bortzmeyer.fr'
- 'framagit.org'
retcode: 1
partstderr: "Test HEAD: HTTP error 405: [No details]\n"
stdout: "KO\n"
partstderr: 'POST or HEAD'
stdout: ''
- name: '--check of a correct DoT'
- name: '[doh][pipelining] Pipelining only with dot'
exe: './homer.py'
markers:
- 'dot'
- 'check'
- 'doh'
- 'pipelining'
args:
- '--check'
- '--dot'
- 'dot.bortzmeyer.fr'
- 'ressources-pedagogiques.org'
retcode: 0
stderr: ''
stdout: "OK\n"
- '--pipelining'
- 'https://doh.bortzmeyer.fr'
retcode: 1
partstderr: 'Pipelining is only accepted for DoT'
stdout: ''
- name: '--check of a correct DoT with debug mode'
- name: '[dot][pipelining] Pipelining only with input file'
exe: './homer.py'
markers:
- 'dot'
- 'check'
- 'pipelining'
args:
- '--dot'
- '--check'
- '--debug'
- '--pipelining'
- 'dot.bortzmeyer.fr'
- 'dnsforum.bj'
retcode: 0
stderr: ''
partstdout: "OK\n"
retcode: 1
partstderr: 'Pipelining requires an input file'
stdout: ''
- name: "[doh][check] Successcul check"
- name: '[doh][streams] Multistreams with DoT (error)'
exe: './homer.py'
markers:
- 'doh'
- 'check'
- 'streams'
args:
- '--check'
- 'https://dns.google/dns-query'
- '--multistreams'
- '--dot'
- 'dot.bortzmeyer.fr'
- 'framagit.org'
retcode: 0
stderr: ''
stdout: "OK\n"
retcode: 1
partstderr: 'Multi-streams makes no sense for DoT'
stdout: ''
- name: "[doh][fail][check] 502 Bad Gateway"
- name: '[doh][streams] Multistreams without input file (error)'
exe: './homer.py'
markers:
- 'doh'
- 'check'
- 'fail'
- 'slow'
timeout: 12
- 'streams'
args:
- '--check'
- '--mandatory-level'
- 'nocrash'
- 'https://doh.42l.fr/dns-query'
- '--multistreams'
- 'dot.bortzmeyer.fr'
- 'framagit.org'
retcode: 1
partstderr: 'Test truncated data: HTTP error 502'
stdout: "KO\n"
partstderr: 'Multi-streams requires an input file'
stdout: ''
- name: '[doh][check] Test that all the resolved IPs are tried, try a first IP'
- name: '[doh][streams] Multistreams too many arguments (error)'
exe: './homer.py'
markers:
- 'doh'
- 'check'
- 'streams'
args:
- '--debug'
- '--check'
- '--multistreams'
- '--file'
- 'input_file'
- 'https://doh.bortzmeyer.fr'
- 'www.afnic.fr'
retcode: 0
partstderr: "Connecting to hostname: 2001:41d0:302:2200::180"
- 'framagit.org'
retcode: 1
partstderr: 'Wrong number of arguments'
stdout: ''
- name: '[doh][check] Test that all the resolved IPs are tried, try another IP'
- name: '[doh][streams] Multistreams invalid URL'
exe: './homer.py'
markers:
- 'doh'
- 'check'
args:
- '--debug'
- '--check'
- 'https://doh.bortzmeyer.fr'
- 'curl.haxx.se'
retcode: 0
partstderr: "Connecting to hostname: 193.70.85.11"
- name: '[dot][check] Test that all the resolved IPs are tried, try a first IP'
exe: './homer.py'
markers:
- 'dot'
- 'check'
- 'streams'
args:
- '-v'
- '--check'
- '--dot'
- '--multistreams'
- '--file'
- 'input_file'
- 'dot.bortzmeyer.fr'
- 'www.afnic.fr'
retcode: 0
partstdout: "checking IP : 193.70.85.11\nConnecting to 193.70.85.11 ..."
retcode: 1
partstderr: 'DoH requires a valid'
stdout: ''
- name: '[doh][check] Test that all the resolved IPs are tried, try another IP'
- name: '[doh][streams][check] Multistreams and check incompatible (error)'
exe: './homer.py'
markers:
- 'dot'
- 'doh'
- 'streams'
- 'check'
args:
- '-v'
- '--check'
- '--dot'
- '--multistreams'
- '--file'
- 'input_file'
- 'dot.bortzmeyer.fr'
- 'www.afnic.fr'
retcode: 0
partstdout: "checking IP : 2001:41d0:302:2200::180\nConnecting to 2001:41d0:302:2200::180 ..."
retcode: 1
partstderr: '--check and --multistreams are not compatible'
stdout: ''
- name: '[dot][check] Test all the IPs, force IPv4'
exe: './homer.py'
- name: '[monitoring][dot] Force IPv4 and IPv6 with an IPv6'
exe: './check_dot'
markers:
- 'dot'
- 'check'
- 'monitoring'
- 'forceIPv4'
- 'forceIPv6'
args:
- '-v'
- '-4'
- '--check'
- '--dot'
- 'dns.google'
- '-6'
- '-H'
- '2001:41d0:302:2200::180'
- '-V'
- 'dot.bortzmeyer.fr'
- '-n'
- 'framagit.org'
retcode: 0
partstdout: "checking IP : 8.8.8.8\nConnecting to 8.8.8.8 ..."
retcode: 2
stderr: ''
partstout: 'IPv4 *or* IPv6'
- name: '[dot][check] Test all the IPs, force IPv4, check another IP'
exe: './homer.py'
- name: '[monitoring][dot] Force IPv4 and IPv6 with an IPv4'
exe: './check_dot'
markers:
- 'dot'
- 'check'
- 'monitoring'
- 'forceIPv4'
- 'forceIPv6'
args:
- '-v'
- '-4'
- '--check'
- '--dot'
- '-6'
- '-H'
- '193.70.85.11'
- '-V'
- 'dot.bortzmeyer.fr'
- '-n'
- 'framagit.org'
retcode: 2
stderr: ''
partstdout: 'IPv4 *or* IPv6'
- name: '[monitoring][dot] Use IPv4 address and force IPv6'
exe: './check_dot'
markers:
- 'dot'
- 'monitoring'
- 'forceIPv6'
args:
- '-6'
- '-H'
- '193.70.85.11'
- '-V'
- 'dot.bortzmeyer.fr'
- '-n'
- 'framagit.org'
retcode: 2
stderr: ''
partstdout: 'litteral IPv4'
- name: '[monitoring][dot] Use IPv6 address and force IPv4'
exe: './check_dot'
markers:
- 'dot'
- 'monitoring'
- 'forceIPv4'
args:
- '-4'
- '-H'
- '2001:41d0:302:2200::180'
- '-V'
- 'dot.bortzmeyer.fr'
- '-n'
- 'framagit.org'
retcode: 2
stderr: ''
partstdout: 'litteral IPv6'
- name: '[monitoring][doh] Force IPv4 and IPv6 with an IPv6'
exe: './check_doh'
markers:
- 'doh'
- 'monitoring'
- 'forceIPv4'
- 'forceIPv6'
args:
- '-4'
- '-6'
- '-H'
- '2001:41d0:302:2200::180'
- '-V'
- 'doh.bortzmeyer.fr'
- '-n'
- 'framagit.org'
retcode: 2
stderr: ''
partstdout: 'IPv4 *or* IPv6'
- name: '[monitoring][doh] Force IPv4 and IPv6 with an IPv4'
exe: './check_doh'
markers:
- 'doh'
- 'monitoring'
- 'forceIPv4'
- 'forceIPv6'
args:
- '-4'
- '-6'
- '-H'
- '193.70.85.11'
- '-V'
- 'doh.bortzmeyer.fr'
- '-n'
- 'framagit.org'
retcode: 2
stderr: ''
partstdout: 'IPv4 *or* IPv6'
- name: '[monitoring][doh] Use IPv4 address and force IPv6'
exe: './check_doh'
markers:
- 'doh'
- 'monitoring'
- 'forceIPv6'
args:
- '-6'
- '-H'
- '193.70.85.11'
- '-V'
- 'doh.bortzmeyer.fr'
- '-n'
- 'framagit.org'
retcode: 2
stderr: ''
partstdout: 'litteral IPv4'
- name: '[monitoring][doh] Use IPv6 address and force IPv4'
exe: './check_doh'
markers:
- 'doh'
- 'monitoring'
- 'forceIPv4'
args:
- '-4'
- '-H'
- '2001:41d0:302:2200::180'
- '-V'
- 'doh.bortzmeyer.fr'
- '-n'
- 'framagit.org'
retcode: 2
stderr: ''
partstdout: 'litteral IPv6'
# valid options with valid behaviour
- name: '[doh] POST --post'
exe: './homer.py'
markers:
- 'doh'
args:
- '--post'
- 'https://doh.bortzmeyer.fr'
- 'framagit.org'
retcode: 0
stderr: ''
partstdout: '2a01:4f8:'
- name: '[doh] POST --POST'
exe: './homer.py'
markers:
- 'doh'
args:
- '--POST'
- 'https://doh.bortzmeyer.fr'
- 'framagit.org'
retcode: 0
stderr: ''
partstdout: '2a01:4f8:'
- name: '[doh] POST -P'
exe: './homer.py'
markers:
- 'doh'
args:
- '-P'
- 'https://doh.bortzmeyer.fr'
- 'framagit.org'
retcode: 0
stderr: ''
partstdout: '2a01:4f8:'
- name: '[doh] HEAD --head'
exe: './homer.py'
markers:
- 'doh'
args:
- '--head'
- 'https://doh.bortzmeyer.fr'
- 'framagit.org'
retcode: 0
stderr: ''
partstdout: 'HEAD'
- name: '[doh] HEAD --HEAD'
exe: './homer.py'
markers:
- 'doh'
args:
- '--HEAD'
- 'https://doh.bortzmeyer.fr'
- 'framagit.org'
retcode: 0
stderr: ''
partstdout: 'HEAD'
- name: '[doh] HEAD -e'
exe: './homer.py'
markers:
- 'doh'
args:
- '-e'
- 'https://doh.bortzmeyer.fr'
- 'framagit.org'
retcode: 0
stderr: ''
partstdout: 'HEAD'
# Simple behaviour
###############################################################################
- name: '[doh] Simple resolution'
exe: './homer.py'
markers:
- 'doh'
args:
- 'https://doh.bortzmeyer.fr/'
- 'framagit.org'
retcode: 0
stderr: ''
partstdout: '2a01:4f8:'
- name: '[dot] Simple resolution'
exe: './homer.py'
markers:
- 'dot'
args:
- '--dot'