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

Conversation

kopecmartin
Copy link
Contributor

In case there are no results, the xml files get malformed. The malformed xml is then refused by polarion.

This edits the code the way the xml and html results will be generated only in the case when the subunit was generated with 0 return code (successfull operation).

https://issues.redhat.com/browse/OSPRH-9242

In case there are no results, the xml files get malformed.
The malformed xml is then refused by polarion.

This edits the code the way the xml and html results will be
generated only in the case when the subunit was generated with
0 return code (successfull operation).

https://issues.redhat.com/browse/OSPRH-9242
@kopecmartin kopecmartin requested a review from lpiwowar September 9, 2024 10:45
@openshift-ci openshift-ci bot requested review from rabi and viroel September 9, 2024 10:45

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.

Copy link
Contributor

@lpiwowar lpiwowar left a comment

Choose a reason for hiding this comment

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

One small comment.


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

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

@kopecmartin
Copy link
Contributor Author

what are we waiting for here? it's ready to be merged or I need to hear specific feedback

Copy link
Contributor

@lpiwowar lpiwowar left a comment

Choose a reason for hiding this comment

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

LGTM 👍


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

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.

Copy link
Contributor

openshift-ci bot commented Sep 18, 2024

[APPROVALNOTIFIER] This PR is APPROVED

Approval requirements bypassed by manually added approval.

This pull-request has been approved by: kopecmartin, lpiwowar

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@openshift-merge-bot openshift-merge-bot bot merged commit c19c44a into openstack-k8s-operators:main Sep 18, 2024
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants