send unsupported answer only when applicable - #2714
Conversation
| return true; | ||
| } | ||
|
|
||
| /** |
There was a problem hiding this comment.
Big 👍 . We really need more of these in our code base :)
Great job!
| * @return the for the {@see Command} appropriate {@see Answer} or {@see UnsupportedAnswer} | ||
| */ | ||
| @Override | ||
| public Answer executeRequest(final Command cmd) { |
There was a problem hiding this comment.
What about a unit test cases? Then, you can have a test case that detects if we catch only RequestWrapper.CommandNotSupported exceptions.
There was a problem hiding this comment.
that would require throwing everything else. I will add a subset to catch the most obvious cases
There was a problem hiding this comment.
Ah, yes. If you want to check all possible cases. However, you can test with the most obvious ones such as Nullpointer, Exception, CloudRuntimeException, and RuntimeException
There was a problem hiding this comment.
I am not really convinced that any of these make a lot of difference to one and another. How about the known and unknown case I just added?
There was a problem hiding this comment.
It helps. I only think that you could go and test the method retryWhenAllFails instead of using executeRequest. If we want unit tests, we should write them for the units.
There was a problem hiding this comment.
we could also unittest RequestWrapper, yes.
executeRequest is the unit here.
higher prios came up, i might revisit
There was a problem hiding this comment.
No problems ;)
Thanks anyways for writing at least some tests.
|
|
||
| public abstract class RequestWrapper { | ||
| static public class CommandNotSupported extends NullPointerException { | ||
| Throwable reason = null; |
There was a problem hiding this comment.
What about overriding the method getCause to return this value here?
There was a problem hiding this comment.
sorry, didn't think of it. should do.
GabrielBrascher
left a comment
There was a problem hiding this comment.
Code LGTM.
The code is documented and with test cases, well done :)
|
@blueorangutan package |
|
@DaanHoogland a Jenkins job has been kicked to build packages. I'll keep you posted as I make progress. |
|
Packaging result: ✔centos6 ✔centos7 ✔debian. JID-2137 |
|
@blueorangutan test |
|
@PaulAngus a Trillian-Jenkins test job (centos7 mgmt + kvm-centos7) has been kicked to run smoke tests |
|
Trillian test result (tid-2773)
|
|
@blueorangutan test |
|
@rhtyd a Trillian-Jenkins test job (centos7 mgmt + kvm-centos7) has been kicked to run smoke tests |
|
@borisstoyanov what is your LGTM based on? |
|
@PaulAngus, I've did a code review, and noticed that the errors reported in the last run are repeating with other PRs. |
|
Trillian test result (tid-2775)
|
|
@blueorangutan package |
|
@DaanHoogland a Jenkins job has been kicked to build packages. I'll keep you posted as I make progress. |
|
Packaging result: ✔centos6 ✔centos7 ✔debian. JID-2141 |
|
@blueorangutan test |
|
@rhtyd a Trillian-Jenkins test job (centos7 mgmt + kvm-centos7) has been kicked to run smoke tests |
|
Trillian test result (tid-2778)
|
|
Test LGTM, failing tests are due to known issues or intermittent in nature, but not related to KVM agent/libvirt resource class changes. |
Throw specific NPE child when command is known not to be known. Add unit tests.
Description
A pokemon catch was handling all errors in the agent with libvirt resource loaded.
Types of changes
GitHub Issue/PRs
Screenshots (if appropriate):
How Has This Been Tested?
Checklist:
Testing