Skip to content

Commit e1320d3

Browse files
committed
Turn-off failure in case sending failed logs to
logdetective is called. Signed-off-by: Petr "Stone" Hracek <[email protected]>
1 parent 377dcf8 commit e1320d3

File tree

1 file changed

+6
-7
lines changed

1 file changed

+6
-7
lines changed

test.sh

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@ failed_version() {
2727
analyze_logs_by_logdetective() {
2828
# logdetective should not break the test functionality
2929
# Therefore `set +e` is setup
30-
set +e
3130
local log_file_name="$1"
3231
echo "Sending failed log by fpaste command to paste bin."
3332
paste_bin_link=$(fpaste "$log_file_name")
@@ -47,25 +46,19 @@ analyze_logs_by_logdetective() {
4746
echo "ERROR: Failed to analyze log file by logdetective server."
4847
cat "${logdetective_test_file}"
4948
echo "-------- LOGDETECTIVE TEST LOG ANALYSIS FAILED --------"
50-
# Let's switch it back
51-
set -e
5249
return
5350
fi
5451
jq -rC '.explanation.text' < "${logdetective_test_file}"
5552
# This part of code is from https://github.com/teemtee/tmt/blob/main/tmt/steps/scripts/tmt-file-submit
5653
if [ -z "$TMT_TEST_PIDFILE" ]; then
5754
echo "File submit to data dir can be used only in the context of a running test."
58-
# Let's switch it back
59-
set -e
6055
return
6156
fi
6257
# This variable is set by tmt
6358
[ -d "$TMT_TEST_DATA" ] || mkdir -p "$TMT_TEST_DATA"
6459
cp -f "${logdetective_test_file}" "$TMT_TEST_DATA"
6560
echo "File '${logdetective_test_file}' stored to '$TMT_TEST_DATA'."
6661
echo "-------- LOGDETECTIVE TEST LOG ANALYSIS FINISHED --------"
67-
# Let's switch it back
68-
set -e
6962
}
7063

7164
# This adds backwards compatibility if only single version needs to be testing
@@ -99,7 +92,10 @@ for dir in ${VERSIONS}; do
9992
cat "${tmp_file}"
10093
if [[ "$ret_code" != "0" ]]; then
10194
if [[ "${OS}" == "rhel8" ]] || [[ "${OS}" == "rhel9" ]] || [[ "${OS}" == "rhel10" ]]; then
95+
set +e
10296
analyze_logs_by_logdetective "$tmp_file"
97+
# Let's switch it back
98+
set -e
10399
fi
104100
fi
105101
failed_version "$ret_code" "$dir"
@@ -132,7 +128,10 @@ for dir in ${VERSIONS}; do
132128
cat "${tmp_file}"
133129
if [[ "$ret_code" != "0" ]]; then
134130
if [[ "${OS}" == "rhel8" ]] || [[ "${OS}" == "rhel9" ]] || [[ "${OS}" == "rhel10" ]]; then
131+
set +e
135132
analyze_logs_by_logdetective "$tmp_file"
133+
# Let's switch it back
134+
set -e
136135
fi
137136
fi
138137
failed_version "$ret_code" "$dir"

0 commit comments

Comments
 (0)