-
Notifications
You must be signed in to change notification settings - Fork 334
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
[JENKINS-36305] Fix TestObject url in order to fix TestActions links #50
Conversation
This pull request originates from a CloudBees employee. At CloudBees, we require that all pull requests be reviewed by other CloudBees employees before we seek to have the change accepted. If you want to learn more about our process please see this explanation. |
This seems like it would be incompatible. What was the actual source of the 404? Sounds like a bug in the |
yes indeed it is incompatible. junit-attachments could implement a workaround by building an absolute path at the line you pointed. But I believe the bug lies in junit-plugin, which is using a taglib expecting a different contract on #getUrl(). |
@jglick do you think it is unacceptable to break compatibility here? With the current implementation, TestActions that want to be exposed in sidebar cannot use relative urls, unlike regular Actions. |
Perhaps this was not the best design choice, if |
I gave a shot to specifying getUrlName with the following contract in junit-attachments
But then I realised this can't work because of https://github.com/jenkinsci/junit-plugin/blob/master/src/main/java/hudson/tasks/test/TestObject.java#L442. Bottom line: if you don't use relative path, then the action isn't bound so you can't access it. The current PR is the only way I see to fix it. |
@Vlatombe are you still working on it? |
@oleg-nenashev I still stand by what I said in my last comment. IMO this PR is the only way to fix properly the link in junit-attachment, and I don't see any simple solution to fix it without affecting junit-plugin. |
After some review 👍 from me |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure I understand the compatibility implications well enough to be comfortable merging. Will leave it to @oleg-nenashev to consider.
* | ||
* @return the url relative to {@link TestResult}. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Perhaps we could deprecate the old method and introduce a replacement intended to have different behavior?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I had documented the problem in
https://issues.jenkins-ci.org/browse/JENKINS-36305?focusedCommentId=262717&page=com.atlassian.jira.plugin.system.issuetabpanels%3Acomment-tabpanel#comment-262717
I don't see how it can be fixed otherwise.
I should have explained my PoV regarding the compatibility more explicitly. Then I would be able to read it now and restore the context :( Will review from scratch |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Apparently I did not. I will leave the decision about merge to the plugin maintainer (if any)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Vlatombe are you still interested in this PR? or shall we close it.
@timja I'll check whether it still makes sense. |
Updated. |
I’ll take a look next week |
I'm struggling to test this any hints? I have a freestyle build with this:
and I've configured the publisher =/ the attachment isn't showing up |
@Override | ||
public String getUrl() { | ||
return '/' + getId(); | ||
return getRun().getUrl() + getTestResultAction().getUrlName() + "/" + getId(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
at first glance this could break https://github.com/jenkinsci/cucumber-testresult-plugin
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
not really sure how to test this =/, I tried with the tests in https://github.com/jenkinsci/cucumber-testresult-plugin and these: https://github.com/testdouble/java-cucumber-example
normally the "output" needs to be part of the test output not the job console output (and captured by junit (in its sdr-err or std-out element IIRC)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
reproduced the bug and verified that this PR fixes it.
I created https://github.com/timja/junit-attachments-test/blob/master/src/test/java/com/github/AppTest.java#L25 to verify it.
Checking @jtnord 's comment before merging
@reviewbybees
https://issues.jenkins-ci.org/browse/JENKINS-36305