-
Notifications
You must be signed in to change notification settings - Fork 25.3k
Add Cluster Allocation Explain API Tests #130381
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 Cluster Allocation Explain API Tests #130381
Conversation
Adds tests for the `cluster/allocation/explain` API for when non-integer values are passed as the integer expected shard parameter. This change does not modify the `cluster/allocation/explain` API itself.
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.
IMO this is a rather excessive way to check a single line of code which calls PARSER.declareInt
. If you think the tests for AbstractObjectParser
do not adequately cover these corner cases then we should address that there, but I don't think it makes sense to test all the failure paths and other corners through the API like this. There are 351 other production calls to that one method that we'd have to test similarly after setting this precedent, and yet I'm struggling to imagine how any of these tests might fail.
Pinging @elastic/es-distributed-coordination (Team:Distributed Coordination) |
There are 2 reasons for adding these tests:
|
I see ok, yeah just seems a bit odd to nail down the current behaviour even though we don't really care about the behaviour in these corner cases today.
True, but it doesn't mean that we should have such tests either :) If you extrapolate that line of thinking you end up having to test everything at every level through every other layer of abstraction which is clearly infeasible. So there's some judgement required about whether such tests are worth it. Often they are, under-testing is more common than over-testing, but both extremes are problematic in their own ways. |
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.
LGTM
I understand what you're saying about over-testing, and if we were to extrapolate this to all APIs, then I appreciate this would be a massive bloat to our testing suite! My logic this time was 1) I am, by nature, a big advocate of tests and will always ere on the side of more tests, a line of thinking I'm happy to re-evaluate as I learn more about the codebase and 2) we're directly changing the functionality tested by these tests so in this instance it seemed a necessary addition so that I can verify my new code works as expected. Happy to discuss anything further offline! Thank you for the review |
Add Cluster Allocation Explain API Tests Adds tests for the `cluster/allocation/explain` API for when non-integer values are passed as the integer expected shard parameter. This change does not modify the `cluster/allocation/explain` API itself.
Adds tests for the
cluster/allocation/explain
API for when non-integer values are passed as the integer-expected shard parameter. This change does not modify thecluster/allocation/explain
API itself, but adds tests for current, expected behaviour. This PR is a pre-requisite for a change modifying the behaviour of the API when a float is passed, resolving a comment on #129342