-
Notifications
You must be signed in to change notification settings - Fork 75
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
Add test for Sorter strategy #439
base: master
Are you sure you want to change the base?
Conversation
Refactored the onCanceledItem method to invoke item.isCancelled for test
67e4fd9
to
54ca69c
Compare
@MarkEWaite do let me know about the changes I made. Are they viable or not |
As a general pattern, most Jenkins plugin maintainers don't review draft pull requests. A pull request is usually marked as draft by the submitter because they are not ready for review. Since you asked for my feedback, I checked the CI job. There is a spotbugs warning. You need to fix the spotbus warning before I'll spend time reviewing the pull request in any other way. |
059229f
to
49af843
Compare
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.
Needs fixes as noted in the comments. Needs more review after those fixes are applied.
@@ -23,7 +23,10 @@ | |||
*/ | |||
package jenkins.advancedqueue.sorter; | |||
|
|||
import static org.jenkinsci.plugins.scriptsecurity.sandbox.groovy.GroovySandbox.LOGGER; |
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.
Using the logger from a class that is outside this plugin is not the way to add logging to a class. Refer to src/main/java/jenkins/advancedqueue/PriorityConfiguration.java for the technique that is used to add a logger to a class.
import static org.jenkinsci.plugins.scriptsecurity.sandbox.groovy.GroovySandbox.LOGGER; |
@@ -66,7 +69,12 @@ public void onStartedItem(@NonNull LeftItem item, float weight) {} | |||
/** | |||
* Called when a {@link hudson.model.Item} leaves the queue and it is canceled. | |||
*/ | |||
public void onCanceledItem(@NonNull LeftItem item) {} | |||
@CheckReturnValue |
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.
The CheckReturnValue javadoc says:
This annotation is used to denote a method whose return value should always be checked when invoking the method.
Since the method is void
, it has no return value. That seems like the wrong annotation for the method
-Corrected the annotation method for void method and deleted @checkfornull -Imported Logger from the same plugin
Testing done
Submitter checklist