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

Reuse subunit_trace output/validation logic for load/run #333

Merged
merged 1 commit into from
Sep 22, 2022

Conversation

jogo
Copy link
Contributor

@jogo jogo commented Sep 16, 2022

Previously stestr run and subunit_trace used slightly different output and validation logic. run wouldn't catch the case where a test exited without a status, while code using last and history would since they used subunit_trace.

Refactor the subunit_trace output and validation logic and use it for load/run.

Converge on the subunit_trace formatted output, in addition to the summary also show if something goes wrong.

The primary motivation for this change is to better detect when a subprocess is killed and not all tests are run as expected (segfault, OOM etc.).

Previously `stestr run` and subunit_trace used slightly different
output and validation logic. run wouldn't catch the case where a test
exited without a status, while code using `last` and `history` would
since they used subunit_trace.

Refactor the subunit_trace output and validation logic and use it for
`load`/`run`.

Converge on the subunit_trace formatted output, in addition to the
summary also show if something goes wrong.

The primary motivation for this change is to better detect when a
subprocess is killed and not all tests are run as expected (segfault,
OOM etc.).
if post_fails:
print_fails(stdout)
if not no_summary:
print_summary(stdout, elapsed_time)

# NOTE(mtreinish): Ideally this should live in testtools streamSummary
# this is just in place until the behavior lands there (if it ever does)
if count_tests("status", "^success$") == 0:
if count_tests("status", "^xfail$") + count_tests("status", "^success$") == 0:
Copy link
Contributor Author

Choose a reason for hiding this comment

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

figured this is easier to read than join the two regex

Copy link
Owner

Choose a reason for hiding this comment

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

yeah, that's fine I think the regex would just be ^xfail|success$ or something like that, but this is definitely more legible.

@codecov-commenter
Copy link

codecov-commenter commented Sep 16, 2022

Codecov Report

Merging #333 (6308805) into main (4578481) will increase coverage by 0.21%.
The diff coverage is 100.00%.

@@            Coverage Diff             @@
##             main     #333      +/-   ##
==========================================
+ Coverage   61.48%   61.69%   +0.21%     
==========================================
  Files          30       30              
  Lines        2630     2624       -6     
  Branches      472      472              
==========================================
+ Hits         1617     1619       +2     
+ Misses        888      883       -5     
+ Partials      125      122       -3     
Flag Coverage Δ
unittests 61.69% <100.00%> (+0.21%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
stestr/commands/load.py 44.20% <100.00%> (-2.33%) ⬇️
stestr/subunit_trace.py 68.79% <100.00%> (+3.00%) ⬆️

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

Copy link
Owner

@mtreinish mtreinish left a comment

Choose a reason for hiding this comment

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

LGTM, thanks for the fix

if post_fails:
print_fails(stdout)
if not no_summary:
print_summary(stdout, elapsed_time)

# NOTE(mtreinish): Ideally this should live in testtools streamSummary
# this is just in place until the behavior lands there (if it ever does)
if count_tests("status", "^success$") == 0:
if count_tests("status", "^xfail$") + count_tests("status", "^success$") == 0:
Copy link
Owner

Choose a reason for hiding this comment

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

yeah, that's fine I think the regex would just be ^xfail|success$ or something like that, but this is definitely more legible.

@mtreinish mtreinish merged commit f86e3b5 into mtreinish:main Sep 22, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants