Skip to content

Commit

Permalink
Add config file for custom ignored_simple_tests
Browse files Browse the repository at this point in the history
  • Loading branch information
adamkankovsky committed Nov 7, 2024
1 parent e40b6ae commit 57823ca
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 0 deletions.
7 changes: 7 additions & 0 deletions script-pre-install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,13 @@ TESTTYPE="ksscript"

. ${KSTESTDIR}/functions.sh

# Define the path to the config file (must match the path in log_handler.py)
CONFIG_FILE_PATH="/tmp/ignored_simple_tests.conf"

# Write the messages to ignore into the config file
# In this example, we're adding "Traceback" to be ignored
echo "Traceback" > "${CONFIG_FILE_PATH}"

validate() {
local disksdir=$1
local status=0
Expand Down
14 changes: 14 additions & 0 deletions scripts/launcher/lib/log_monitor/log_handler.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@
#
# Red Hat Author(s): Vendula Poncova <[email protected]>
#
import os

from pylorax.monitor import LogRequestHandler


Expand All @@ -42,6 +44,18 @@ class VirtualLogRequestHandler(LogRequestHandler):
"Call Trace:"
]

# Path to the config file
CONFIG_FILE_PATH = '/tmp/ignored_simple_tests.conf'

if os.path.isfile(CONFIG_FILE_PATH):
with open(CONFIG_FILE_PATH, 'r') as config_file:
extra_ignored_tests = [line.strip() for line in config_file if line.strip()]
# Extend the ignored_simple_tests list
ignored_simple_tests.extend(extra_ignored_tests)

# Remove the config file after reading
os.remove(CONFIG_FILE_PATH)

# Specify error lines you want to add on top
# of the default ones contained in Lorax
simple_tests = LogRequestHandler.simple_tests + [
Expand Down

0 comments on commit 57823ca

Please sign in to comment.