Skip to content

GitLab

  • Menu
Projects Groups Snippets
    • Loading...
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in
  • Trac Trac
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Issues 246
    • Issues 246
    • List
    • Boards
    • Service Desk
    • Milestones
  • Monitor
    • Monitor
    • Metrics
    • Incidents
  • Analytics
    • Analytics
    • Value stream
  • Wiki
    • Wiki
  • Activity
  • Create a new issue
  • Issue Boards
Collapse sidebar
  • Legacy
  • TracTrac
  • Issues
  • #8432

Closed
Open
Created Mar 08, 2013 by Isis Lovecruft@isis

ooni: dnsconsistency.py should display UsageError in a more friendly manner

When running the dnsconsistency test without specifying a test resolver (the "-t" option), the test craps out with a UsageError which displays a traceback, and then it just hangs until a SIGTERM:

(ooni)?!isis?wintermute:~/code/torproject/ooni-probe ? s ./bin/ooniprobe nettests/blocking/dnsconsistency.py -f private/lists/alexa-11                         
[!] pypcap or dnet not installed. Certain tests may not work.
Log opened.
Starting
Starting sniffer
[!] Initializing DummyPcapWriter. We will not actually write to a pcapfile
[D] No test deck detected
[D] processing options
[D] Checking if backend is present
[D] Checking if file is present
[D] Running [(<class 'nettests.blocking.dnsconsistency.DNSConsistencyTest'>, 'test_a_lookup')]
[D] Options {'inputs': <ooni.nettest.inputProcessorIterator object at 0x2362390>, 'version': '0.5', 'name': 'DNS Consistency'}
[D] cmd_line_options {'pcapfile': None, 'help': 0, 'subargs': ('-f', 'private/lists/alexa-11'), 'resume': 0, 'parallelism': '10', 'test': 'nettests/blocking/dn
sconsistency.py', 'logfile': None, 'collector': None, 'reportfile': None}
[D] Creating report_dnsconsistency_2013-03-08T165102Z.yamloo
[D] Writing report with YAML reporter
Reporting to file report_dnsconsistency_2013-03-08T165102Z.yamloo
[D] Not going to resume dnsconsistency.py
[D] Running dnsconsistency default processor
[D] input_unit_items: 2
[D] test_case_number: 1.0
[D] Test case number: 1.0
[D] Total iterations: 2.0
[D] Current iteration: 0.0
[D] Running dnsconsistency default processor
[D] Running dnsconsistency.py with input unit <<class 'ooni.inputunit.InputUnit'> inputs=<listiterator object at 0x27d9e50>>
[D] Running test cases with input unit
[D] Running test with this input torproject.org
[D] Processing test_a_lookup
[D] Running test_a_lookup with torproject.org...
Traceback (most recent call last):
  File "/home/isis/code/torproject/ooni-probe/ooni/runner.py", line 462, in runTestCases
    yaml_reporter, oonib_reporter)
  File "/home/isis/code/torproject/ooni-probe/ooni/runner.py", line 267, in runTestCasesWithInputUnit
    test_input, yaml_reporter, oonib_reporter)
  File "/home/isis/code/torproject/ooni-probe/ooni/runner.py", line 230, in runTestCasesWithInput
    test_instance.setUp()
  File "/home/isis/code/torproject/ooni-probe/nettests/blocking/dnsconsistency.py", line 54, in setUp
    raise usage.UsageError("You did not specify a testresolver")
UsageError: You did not specify a testresolver
[D] testsEnded: Finished running all tests
[D] [dnsconsistency.py] 0.0%
[D] [dnsconsistency.py] 0.0%
[D] [dnsconsistency.py] 0.0%
[D] [dnsconsistency.py] 0.0%
^CReceived SIGINT, shutting down.

Instead, it should nicely display the error (without the unnecessary traceback) and then call sys.exit, or some sort of shutdown method.

Questions:

  • Do we currently, in runner.py, or somewhere in the TaskManager branch, have a safe shutdown method that can be called from within a NetTestCase?
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information
Assignee
Assign to
Time tracking