Skip to content

Commit 03cccf7

Browse files
authored
Fix LogAnalyzer to force load regular expressions from common files (sonic-net#5193)
What is the motivation for this PR? Looks like commit sonic-net#3235 caused issue that LA has empty list of match errors expressions. How did you do it? Fix LogAnalyzer to force load regular expressions from common files How did you verify/test it? Executed tests which using LA, checked that LA failed in case when we have errors in logs Signed-off-by: Petro Pikh <[email protected]>
1 parent 20757ed commit 03cccf7

1 file changed

Lines changed: 3 additions & 4 deletions

File tree

tests/common/plugins/loganalyzer/__init__.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,9 +30,6 @@ def analyzer_add_marker(analyzers, node=None, results=None):
3030
loganalyzer = analyzers[node.hostname]
3131
logging.info("Add start marker into DUT syslog for host {}".format(node.hostname))
3232
marker = loganalyzer.init()
33-
logging.info("Load config and analyze log for host {}".format(node.hostname))
34-
# Read existed common regular expressions located with legacy loganalyzer module
35-
loganalyzer.load_common_config()
3633
results[node.hostname] = marker
3734

3835

@@ -53,7 +50,9 @@ def loganalyzer(duthosts, request):
5350
analyzers = {}
5451
parallel_run(analyzer_logrotate, [], {}, duthosts, timeout=120)
5552
for duthost in duthosts:
56-
analyzers[duthost.hostname] = LogAnalyzer(ansible_host=duthost, marker_prefix=request.node.name)
53+
analyzer = LogAnalyzer(ansible_host=duthost, marker_prefix=request.node.name)
54+
analyzer.load_common_config()
55+
analyzers[duthost.hostname] = analyzer
5756
markers = parallel_run(analyzer_add_marker, [analyzers], {}, duthosts, timeout=120)
5857

5958
yield analyzers

0 commit comments

Comments
 (0)