Browse Source

[beeswax] Test log searcher can understand different log formats

CDH nightly and snapshots have a different log configuration for Hive
Romain Rigaux 13 năm trước cách đây
mục cha
commit
7e501e9190
1 tập tin đã thay đổi với 4 bổ sung1 xóa
  1. 4 1
      apps/beeswax/src/beeswax/tests.py

+ 4 - 1
apps/beeswax/src/beeswax/tests.py

@@ -1177,6 +1177,9 @@ def test_search_log_line():
     """
   assert_true(search_log_line('ql.Driver', 'FAILED: Parse Error', logs))
 
+  logs = "12/08/22 20:50:14 ERROR ql.Driver: FAILED: Parse Error: line 1:31 cannot recognize input near '''' '_this_is_not' 'SQL' in constant'"
+  assert_true(search_log_line('ql.Driver', 'FAILED: Parse Error', logs))
+
   logs = """
     FAILED: Parse Error: line 1:31 cannot recognize input near '''' '_this_is_not' 'SQL' in constant
     2012-08-18 12:23:15,648 ERROR [pool-1-thread-2] ql.Driver (SessionState.java:printError(380)) - FAILED: Parse XXXX Error: line 1:31 cannot recognize input near '''' '_this_is_not' 'SQL' in constant
@@ -1193,4 +1196,4 @@ def test_search_log_line():
 
 def search_log_line(component, expected_log, all_logs):
   """Checks if 'expected_log' can be found in one line of 'all_logs' outputed by the logging component 'component'."""
-  return re.compile('.+? %(component)s .+? - %(expected_log)s' % {'component': component, 'expected_log': expected_log}).search(all_logs)
+  return re.compile('.+?%(component)s(.+?)%(expected_log)s' % {'component': component, 'expected_log': expected_log}).search(all_logs)