Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Avoid malformed results xml #209

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 4 additions & 8 deletions container-images/tcib/base/os/tempest/run_tempest.sh
Original file line number Diff line number Diff line change
Expand Up @@ -364,14 +364,10 @@ function generate_test_results {
TEMPEST_LOGS_DIR=${TEMPEST_PATH}${TEMPEST_WORKFLOW_STEP_DIR_NAME}/
mkdir -p ${TEMPEST_LOGS_DIR}

echo "Generate subunit"
stestr last --subunit > ${TEMPEST_LOGS_DIR}testrepository.subunit || true

echo "Generate subunit xml file"
subunit2junitxml ${TEMPEST_LOGS_DIR}testrepository.subunit > ${TEMPEST_LOGS_DIR}tempest_results.xml || true

echo "Generate html result"
subunit2html ${TEMPEST_LOGS_DIR}testrepository.subunit ${TEMPEST_LOGS_DIR}stestr_results.html || true
echo "Generate subunit, then xml and html results"
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

validation of the && and || logic, all possible situations:

# zero return code and successfully executes both of the echos - ideal case
$ true && (echo 1 || true) && echo 2 || true
1
2

# zero return code and no echo outputs - that's what we need to fix the issue 
$ false && (echo 1 || true) && echo 2 || true

# zero return code and only the second echo successful - the first echo didn't affect the second one
$ true && (false || true) && echo 2 || true
2

# zero return code and only the first echo successful - the second echo didn't affect the first one nor the overall result
$ true && (echo 1 || true) && false || true
1
$ 

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What do you think about this version?

stestr last --subunit > ${TEMPEST_LOGS_DIR}testrepository.subunit

if [[ $? -eq  0 ]]; then
  subunit2junitxml ${TEMPEST_LOGS_DIR}testrepository.subunit > ${TEMPEST_LOGS_DIR}tempest_results.xml
  subunit2html ${TEMPEST_LOGS_DIR}testrepository.subunit ${TEMPEST_LOGS_DIR}stestr_results.html
fi

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same result with the difference i need to modify the patch one more time :D

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, the result is the same. Readability wise, I'm not so sure. Take a look on how long comment you had to make just to explain how it works.

I'm not holding this. Let's move this forward.

stestr last --subunit > ${TEMPEST_LOGS_DIR}testrepository.subunit \
&& (subunit2junitxml ${TEMPEST_LOGS_DIR}testrepository.subunit > ${TEMPEST_LOGS_DIR}tempest_results.xml || true) \
&& subunit2html ${TEMPEST_LOGS_DIR}testrepository.subunit ${TEMPEST_LOGS_DIR}stestr_results.html || true

# NOTE: Remove cirros image before copying of the logs.
rm ${TEMPEST_DIR}/etc/*.img
Expand Down
Loading