Skip to content

Commit

Permalink
Fix RESULT validation
Browse files Browse the repository at this point in the history
Currently if RESULT file has an issue after the "SUCCESS" word it will
tell success. That works in most of the cases but not if validation is
done in the %post of KS but also later in the .sh file.

If %post section was fine and add SUCCESS but validation section will
found issue it would take the whole test as successful.

Fix this in all the impacted tests and also in the functions.sh.
  • Loading branch information
jkonecny12 committed Aug 12, 2024
1 parent 3ff80a3 commit a5531a1
Show file tree
Hide file tree
Showing 12 changed files with 15 additions and 39 deletions.
2 changes: 1 addition & 1 deletion encrypt-device.sh
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ validate() {
if [[ $? != 0 ]]; then
status=1
echo '*** /home/RESULT does not exist in VM image.'
elif [[ "${result}" != SUCCESS* ]]; then
elif [[ "${result%% *}" != SUCCESS ]]; then
status=1
echo "${result}"
fi
Expand Down
2 changes: 1 addition & 1 deletion encrypt-swap.sh
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ validate() {
if [[ $? != 0 ]]; then
status=1
echo '*** /root/RESULT does not exist in VM image.'
elif [[ "${result}" != SUCCESS* ]]; then
elif [[ "${result%% *}" != SUCCESS ]]; then
status=1
echo "${result}"
fi
Expand Down
2 changes: 1 addition & 1 deletion escrow-cert.sh
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ validate() {
if [[ $? != 0 ]]; then
status=1
echo '*** /root/RESULT does not exist in VM image.'
elif [[ "${result}" != SUCCESS* ]]; then
elif [[ "${result%% *}" != SUCCESS ]]; then
status=1
echo "${result}"
fi
Expand Down
2 changes: 1 addition & 1 deletion functions.sh
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,7 @@ check_result_file() {
if [[ $? != 0 ]]; then
status=1
echo '*** /root/RESULT does not exist in VM image.'
elif [[ "${result}" != SUCCESS* ]]; then
elif [[ "${result%% *}" != SUCCESS ]]; then
status=1
echo "${result}"
fi
Expand Down
2 changes: 1 addition & 1 deletion nosave-1.sh
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ validate() {
if [[ $? != 0 ]]; then
status=1
echo '*** /root/RESULT does not exist in VM image.'
elif [[ "${result}" != SUCCESS* ]]; then
elif [[ "${result%% *}" != SUCCESS ]]; then
status=1
echo "${result}"
else
Expand Down
2 changes: 1 addition & 1 deletion nosave-2.sh
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ validate() {
if [[ $? != 0 ]]; then
status=1
echo '*** /root/RESULT does not exist in VM image.'
elif [[ "${result}" != SUCCESS* ]]; then
elif [[ "${result%% *}" != SUCCESS ]]; then
status=1
echo "${result}"
else
Expand Down
2 changes: 1 addition & 1 deletion nosave-3.sh
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ validate() {
if [[ $? != 0 ]]; then
status=1
echo '*** /root/RESULT does not exist in VM image.'
elif [[ "${result}" != SUCCESS* ]]; then
elif [[ "${result%% *}" != SUCCESS ]]; then
status=1
echo "${result}"
else
Expand Down
12 changes: 2 additions & 10 deletions proxy-auth.sh
Original file line number Diff line number Diff line change
Expand Up @@ -93,16 +93,8 @@ validate() {
fi
fi

result=$(cat ${tmpdir}/RESULT)
if [[ $? != 0 ]]; then
echo '*** /root/RESULT does not exist in VM image.'
return 1
elif [[ "${result}" != SUCCESS* ]]; then
echo "${result}"
return 1
else
return 0
fi
check_result_file "${tmpdir}"
return $?
}

cleanup() {
Expand Down
12 changes: 2 additions & 10 deletions proxy-cmdline.sh
Original file line number Diff line number Diff line change
Expand Up @@ -50,14 +50,6 @@ validate() {

check_proxy_settings $tmpdir

result=$(cat ${tmpdir}/RESULT)
if [[ $? != 0 ]]; then
echo '*** /root/RESULT does not exist in VM image.'
return 1
elif [[ "${result}" != SUCCESS* ]]; then
echo "${result}"
return 1
else
return 0
fi
check_result_file "${tmpdir}"
return $?
}
12 changes: 2 additions & 10 deletions proxy-kickstart.sh
Original file line number Diff line number Diff line change
Expand Up @@ -87,16 +87,8 @@ validate() {
fi
fi

result=$(cat ${tmpdir}/RESULT)
if [[ $? != 0 ]]; then
echo '*** /root/RESULT does not exist in VM image.'
return 1
elif [[ "${result}" != SUCCESS* ]]; then
echo "${result}"
return 1
else
return 0
fi
check_result_file "${tmpdir}"
return $?
}

cleanup() {
Expand Down
2 changes: 1 addition & 1 deletion raid-1.sh
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ validate() {
if [[ $? != 0 ]]; then
status=1
echo '*** /root/RESULT does not exist in VM image.'
elif [[ "${result}" != SUCCESS* ]]; then
elif [[ "${result%% *}" != SUCCESS ]]; then
status=1
echo "${result}"
fi
Expand Down
2 changes: 1 addition & 1 deletion raid-ddf.sh
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ validate() {
if [[ $? != 0 ]]; then
status=1
echo '*** /root/RESULT does not exist in VM image.'
elif [[ "${result}" != SUCCESS* ]]; then
elif [[ "${result%% *}" != SUCCESS ]]; then
status=1
echo "${result}"
fi
Expand Down

0 comments on commit a5531a1

Please sign in to comment.