Fix duplicate ndots:0, and improve validation #2212
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Addresses moby/moby#37349
This PR has a couple of changes:
1. Remove redundant and faulty assert messages
The "message" argument in assert.Equal expects a format string; the current string was not that, resulting in an incorrect message being printed;
This patch removes the message altogether, because assert.Equal already prints enough information to catch the error;
2. do not ignore user-provided "ndots:0" option
This is the actual fix:
ndots:0is a valid DNS option; previously,ndots:0was ignored, leading to the default (ndots:0) also being applied;Before this change:
After this change:
3. improve error message for invalid ndots number
Just a minor enhancement; instead of printing the whole option, print the number only, because that's what the error-message is pointing at;
Before this change:
After this change:
4. ndots: produce error on negative numbers
Prevent (e.g.)
ndots:-1being silently ignored