Skip to content

prow.k8s.io: add skip reason to Spyglass JUnit lens #25221

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

Merged

Conversation

Priyankasaggu11929
Copy link
Member

@Priyankasaggu11929 Priyankasaggu11929 commented Feb 11, 2022

What does this PR do:

At present, when an e2e test is skipped, the reason for the skip (if passed to the e2eskipper.Skipf function) is reflected in the artifacts/junit-*.xml files, but not on the Prow Spyglass JUnit lens:

For example, in case of the following job:

This PR adds the skipped reason to the JUnit spyglass lens's template.html file (wherever passed).

The outcome is as follows (updated):

Screenshot 2022-02-11 at 3 05 52 PM

Screenshot 2022-02-14 at 11 07 36 AM


Addresses Issue:

Fixes #24209

@k8s-ci-robot k8s-ci-robot added cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. size/XS Denotes a PR that changes 0-9 lines, ignoring generated files. area/prow Issues or PRs related to prow area/prow/spyglass Issues or PRs related to prow's spyglass UI sig/testing Categorizes an issue or PR as relevant to SIG Testing. labels Feb 11, 2022
@@ -156,7 +156,7 @@
{{range .Skipped}}
{{$firstTest := index .Junit 0}}
<tr>
<td class="mdl-data-table__cell--non-numeric test-name">{{$firstTest.ClassName}}: {{$firstTest.Name}}</td>
<td class="mdl-data-table__cell--non-numeric test-name">{{$firstTest.ClassName}}: {{$firstTest.Name}}<br/>{{$firstTest.Skipped}}</td>
Copy link
Member

@petr-muller petr-muller Feb 11, 2022

Choose a reason for hiding this comment

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

Thank you! I wonder if it would be useful to include an explicit Reason: prefix? Up to you.

Suggested change
<td class="mdl-data-table__cell--non-numeric test-name">{{$firstTest.ClassName}}: {{$firstTest.Name}}<br/>{{$firstTest.Skipped}}</td>
<td class="mdl-data-table__cell--non-numeric test-name">{{$firstTest.ClassName}}: {{$firstTest.Name}}<br/>Reason: {{$firstTest.Skipped}}</td>

/hold

Copy link
Member Author

Choose a reason for hiding this comment

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

@petr-muller, thank you for your feedback. I've revised the PR to include the suggestion for an explicit Reason: prefix.

Adding context to the new changes:

  • There are cases (mainly) where skipped tests do not pass any skipped reason string to the e2eskipper.Skipf method. So I added an if/else conditional check in the go template to handle the scenarios of an empty skipped reason (which required the addition of a helper function SkippedReason() in thelens.go file)
  • I created the new function because:
    • directly using {{ if eq $firstTest.Skipped "" }} in the go template didn't work, throwing incompatible string & pointer type comparisons. Here's a similar example.
    • Or in case of using{{if $firstTest.Skipped}}, it is never False (since it is always pointing to an empty skipped reason, therefore the conditional didn't move).

The updated result is as follows:

Screenshot 2022-02-14 at 11 07 36 AM

@k8s-ci-robot k8s-ci-robot added the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Feb 11, 2022
@k8s-ci-robot k8s-ci-robot added lgtm "Looks good to me", indicates that a PR is ready to be merged. approved Indicates a PR has been approved by an approver from all required OWNERS files. labels Feb 11, 2022
@k8s-ci-robot k8s-ci-robot added size/S Denotes a PR that changes 10-29 lines, ignoring generated files. and removed lgtm "Looks good to me", indicates that a PR is ready to be merged. size/XS Denotes a PR that changes 0-9 lines, ignoring generated files. labels Feb 14, 2022
@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Feb 15, 2022
@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: cjwagner, petr-muller, Priyankasaggu11929

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

@Priyankasaggu11929
Copy link
Member Author

@cjwagner @petr-muller, thanks so much for the review!

The PR above has a '/hold' on it, which is stopping it from merging. I need help removing that. Thank you! 🙂

@petr-muller
Copy link
Member

/hold cancel

@Priyankasaggu11929 you can use commands like the one above too ;)

@k8s-ci-robot k8s-ci-robot removed the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Feb 15, 2022
@Priyankasaggu11929
Copy link
Member Author

/retest

@k8s-ci-robot k8s-ci-robot merged commit f713022 into kubernetes:master Feb 15, 2022
@k8s-ci-robot k8s-ci-robot added this to the v1.24 milestone Feb 15, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. area/prow/spyglass Issues or PRs related to prow's spyglass UI area/prow Issues or PRs related to prow cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. lgtm "Looks good to me", indicates that a PR is ready to be merged. sig/testing Categorizes an issue or PR as relevant to SIG Testing. size/S Denotes a PR that changes 10-29 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

prow.k8s.io: show skip reason
4 participants