Project

General

Profile

Task #2503

Task #2484: Python 3 support

Fix test failures due to no matches

Added by Luke Murphey over 4 years ago. Updated over 4 years ago.

Status:
Closed
Priority:
Normal
Assignee:
Category:
Input: Web Spider
Target version:
Start date:
11/08/2019
Due date:
% Done:

100%


Description

     [exec] ======================================================================
     [exec] ERROR: test_scrape_page_include_empty_matches (__main__.TestWebInput)
     [exec] ----------------------------------------------------------------------
     [exec] Traceback (most recent call last):
     [exec]   File "/Users/lmurphey/git/splunk-web-input/tests/unit_test_web_server.py", line 89, in _decorator
     [exec]     return func(self, *args, **kwargs)
     [exec]   File "unit.py", line 423, in test_scrape_page_include_empty_matches
     [exec]     self.assertEqual(result['match'][0], ',,,Text_1,,Text_2,,,')
     [exec] KeyError: 'match'
     [exec] 
     [exec] ======================================================================
     [exec] ERROR: test_scrape_page_include_empty_matches_nulls (__main__.TestWebInput)
     [exec] ----------------------------------------------------------------------
     [exec] Traceback (most recent call last):
     [exec]   File "/Users/lmurphey/git/splunk-web-input/tests/unit_test_web_server.py", line 89, in _decorator
     [exec]     return func(self, *args, **kwargs)
     [exec]   File "unit.py", line 442, in test_scrape_page_include_empty_matches_nulls
     [exec]     self.assertEqual(result['match'][0], 'NULL')
     [exec] KeyError: 'match'
     [exec] 
     [exec] ======================================================================
     [exec] ERROR: test_scrape_page_match_prefix (__main__.TestWebInput)
     [exec] ----------------------------------------------------------------------
     [exec] Traceback (most recent call last):
     [exec]   File "/Users/lmurphey/git/splunk-web-input/tests/unit_test_web_server.py", line 89, in _decorator
     [exec]     return func(self, *args, **kwargs)
     [exec]   File "unit.py", line 523, in test_scrape_page_match_prefix
     [exec]     self.assertEqual(len(result['prefix_cook_temp']), 1)
     [exec] KeyError: 'prefix_cook_temp'
     [exec] 
     [exec] ======================================================================
     [exec] ERROR: test_scrape_page_match_prefix_with_multiple (__main__.TestWebInput)
     [exec] ----------------------------------------------------------------------
     [exec] Traceback (most recent call last):
     [exec]   File "/Users/lmurphey/git/splunk-web-input/tests/unit_test_web_server.py", line 89, in _decorator
     [exec]     return func(self, *args, **kwargs)
     [exec]   File "unit.py", line 537, in test_scrape_page_match_prefix_with_multiple
     [exec]     self.assertEqual(len(result['prefix_string']), 3)
     [exec] KeyError: 'prefix_string'
     [exec] 
     [exec] ======================================================================
     [exec] ERROR: test_scrape_page_mv (__main__.TestWebInput)
     [exec] ----------------------------------------------------------------------
     [exec] Traceback (most recent call last):
     [exec]   File "unit.py", line 221, in test_scrape_page_mv
     [exec]     self.assertEqual(result['response_code'], 200)
     [exec] KeyError: 'response_code'
     [exec] 
     [exec] ----------------------------------------------------------------------

Associated revisions

Revision 734 (diff)
Added by lmurphey over 4 years ago

Increasing timeouts to make tests more stable

Reference #2503

Revision 736 (diff)
Added by lmurphey over 4 years ago

Putting a size limit on files

Reference #2503

History

#1 Updated by Luke Murphey over 4 years ago

Questions:
  • What is the result that is getting returned?
    • Timed out error
  • Does increasing the timeout fix it?
    • Seems to fix most
    • test_scrape_page_include_empty_matches is still failing
      • This test succeeds if I run it again though
      • ant test -Dtest=TestWebInput.test_scrape_page_include_empty_matches
  • Do the tests pass when the browser is disabled?
  • Does it work with a really high timeout?
    • Still fails at 30 seconds
  • Does it work if I connect to it ahead of time before the tests run with my own browser (since the page seems load fast after the first time)?
Observations:
  • This doesn't fail on 7.3.1
  • There is a delay when connecting to the web-server from my browser
  • The output on the server also seems very, very slow
  • Seeing the following upon connection to /html:
         [exec] ----------------------------------------
         [exec] 127.0.0.1 - - [08/Nov/2019 18:13:52] "GET /html HTTP/1.1" 200 -
         [exec] ----------------------------------------
         [exec] Exception happened during processing of request from ('127.0.0.1', 54963)
         [exec] Traceback (most recent call last):
         [exec]   File "/Users/lmurphey/Splunk/py3/lib/python3.7/socketserver.py", line 316, in _handle_request_noblock
         [exec]     self.process_request(request, client_address)
         [exec]   File "/Users/lmurphey/Splunk/py3/lib/python3.7/socketserver.py", line 347, in process_request
         [exec]     self.finish_request(request, client_address)
         [exec]   File "/Users/lmurphey/Splunk/py3/lib/python3.7/socketserver.py", line 360, in finish_request
         [exec]     self.RequestHandlerClass(request, client_address, self)
         [exec]   File "/Users/lmurphey/Splunk/py3/lib/python3.7/socketserver.py", line 720, in __init__
         [exec]     self.handle()
         [exec]   File "/Users/lmurphey/Splunk/py3/lib/python3.7/http/server.py", line 426, in handle
         [exec]     self.handle_one_request()
         [exec]   File "/Users/lmurphey/Splunk/py3/lib/python3.7/http/server.py", line 414, in handle_one_request
         [exec]     method()
         [exec]   File "/Users/lmurphey/git/splunk-web-input/tests/test_web_server.py", line 187, in do_GET
         [exec]     self.get_file("web_files", "simple.html")
         [exec]   File "/Users/lmurphey/git/splunk-web-input/tests/test_web_server.py", line 148, in get_file
         [exec]     return self.wfile.write(content)
         [exec]   File "/Users/lmurphey/Splunk/py3/lib/python3.7/socketserver.py", line 799, in write
         [exec]     self._sock.sendall(b)
         [exec] BrokenPipeError: [Errno 32] Broken pipe
         [exec] ----------------------------------------
    
  • Disabling test_scrape_page_download_limit seems to fix it. It appears that the failure of the web-server in that case leaks over to the next test case somehow.

#2 Updated by Luke Murphey over 4 years ago

  • Status changed from New to Closed
  • % Done changed from 0 to 100

Also available in: Atom PDF