Skip to content

Commit eaf2778

Browse files
authored
Do not setup set -e in case function analyze_logs_by_logdetective fails (#416)
* Function analyze_logs_by_logdetective send the logs to logdetective URL. Setting set +e and afterwards set -e does not make sense. In case sending data to logdetective failed, then continue. In case set -e is set up and failed_version function returns non zero status, than script is immediatelly stopped which does not make sense in case we tested all version. Signed-off-by: Petr "Stone" Hracek <phracek@redhat.com> * Add more descriptive message in case we skip tests Signed-off-by: Petr "Stone" Hracek <phracek@redhat.com> --------- Signed-off-by: Petr "Stone" Hracek <phracek@redhat.com>
1 parent cc8fdf7 commit eaf2778

1 file changed

Lines changed: 4 additions & 8 deletions

File tree

test.sh

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -43,15 +43,11 @@ run_test_and_analyze_failed_logs() {
4343
set +o pipefail
4444
if [[ "$ret_code" != "0" ]]; then
4545
if [[ "${OS}" == "rhel8" ]] || [[ "${OS}" == "rhel9" ]] || [[ "${OS}" == "rhel10" ]]; then
46-
set +e
4746
analyze_logs_by_logdetective "$tmp_file"
48-
# Let's switch it back
49-
set -e
5047
fi
5148
fi
5249
failed_version "$ret_code" "$dir"
5350
rm -f "$tmp_file"
54-
5551
}
5652
# This adds backwards compatibility if only single version needs to be testing
5753
# In CI we would like to test single version but VERSIONS= means, that nothing is tested
@@ -87,7 +83,7 @@ for dir in ${VERSIONS}; do
8783
if [ -x test/run-openshift-remote-cluster ]; then
8884
run_test_and_analyze_failed_logs "test/run-openshift-remote-cluster"
8985
else
90-
echo "-> Tests for OpenShift 4 are not present. Add run-openshift-remote-cluster script, skipping"
86+
echo "-> Tests for OpenShift 4 for version $dir are not present. Add run-openshift-remote-cluster script, skipping"
9187
fi
9288
fi
9389

@@ -97,23 +93,23 @@ for dir in ${VERSIONS}; do
9793
if [ -x test/run-upstream ]; then
9894
run_test_and_analyze_failed_logs "test/run-upstream"
9995
else
100-
echo "-> Upstream tests are not present, skipping"
96+
echo "-> Upstream tests for version $dir are not present, skipping"
10197
fi
10298
fi
10399

104100
if [ -n "${TEST_OPENSHIFT_PYTEST}" ]; then
105101
if [ -x test/run-openshift-pytest ]; then
106102
run_test_and_analyze_failed_logs "test/run-openshift-pytest"
107103
else
108-
echo "-> OpenShift PyTest tests are not present, skipping"
104+
echo "-> OpenShift PyTest tests for version $dir are not present, skipping"
109105
fi
110106
fi
111107

112108
if [ -n "${TEST_PYTEST}" ]; then
113109
if [ -x test/run-pytest ]; then
114110
run_test_and_analyze_failed_logs "test/run-pytest"
115111
else
116-
echo "-> PyTest tests are not present, skipping"
112+
echo "-> PyTest tests for version $dir are not present, skipping"
117113
fi
118114
fi
119115

0 commit comments

Comments
 (0)