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

Fix showOnlyFailures for merged results #42

Merged
merged 2 commits into from
Mar 2, 2025

Conversation

d2weber
Copy link

@d2weber d2weber commented Feb 25, 2025

Fixes https://issues.jenkins.io/browse/JENKINS-75332

Testing done

Manually verified in the "TAP Extended Test Results" that the Testpipeline respects showOnlyFailures

pipeline {
    agent any
    stages {
        stage('Build') {
            steps {
                writeFile file: 'test1.tap', text: 'ok 1\nnot ok 2'
                writeFile file: 'test2.tap', text: 'ok 1\nnot ok 2'
            }
            post {
                always {
                    step $class: 'TapPublisher', testResults: 'test1.tap', showOnlyFailures: true, planRequired: false
                    step $class: 'TapPublisher', testResults: 'test2.tap', showOnlyFailures: true, planRequired: false
                }
            }
        }
    }
}

Submitter checklist

  • Make sure you are opening from a topic/feature/bugfix branch (right side) and not your main branch!
  • Ensure that the pull request title represents the desired changelog entry
  • Please describe what you did
  • Link to relevant issues in GitHub or Jira
  • Link to relevant pull requests, esp. upstream and downstream changes
  • Ensure you have provided tests - that demonstrates feature works or fixes the issue

Copy link
Member

@kinow kinow left a comment

Choose a reason for hiding this comment

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

Code looks alright to me, @d2weber. If you could write a unit test, then I'd just have a quick look with the IDE (to refresh on the code), otherwise, I can try to write one and update this branch/PR over next days and merge it.

Thanks!

@d2weber
Copy link
Author

d2weber commented Mar 2, 2025

Yes no problem. I added a Unittest somewhat similar to TapPublisherTest::merged.

The hardest part in the process of creating the test was to figure out how to run the test properly. Only mvn clean install -Dtest=PublisherKeepsPropertiesTest seemed to work reliable for me. Other methods like mvn test -Dtest=.. or using VS Codes Java Test runner seemed to work at first but there was a subtle issue: only the first TapPublishers perform was actually called, because after successful completion of perform the execution of actions was interrupted by the Exception thrown in jenkins.model.Jenkins.getDescriptorOrDie.

@kinow
Copy link
Member

kinow commented Mar 2, 2025

Thank you, @d2weber !

@kinow kinow merged commit c6b243b into jenkinsci:master Mar 2, 2025
15 checks passed
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.

2 participants