-
Notifications
You must be signed in to change notification settings - Fork 881
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
Fix duplicate ndots:0, and improve validation #2212
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
The "message" argument in assert.Equal expects a format string; the current string was not that, resulting in an incorrect message being printed; --- FAIL: TestDNSOptions (1.28s) Location: service_common_test.go:92 Error: Not equal: "ndots:5" (expected) != "ndots:0" (actual) Messages: The option must be ndots:5 instead:%!(EXTRA string=ndots:0) This patch removes the message altogether, because assert.Equal already prints enough information to catch the error; --- FAIL: TestDNSOptions (1.28s) Location: service_common_test.go:92 Error: Not equal: "ndots:5" (expected) != "ndots:0" (actual) Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
`ndots:0` is a valid DNS option; previously, `ndots:0` was ignored, leading to the default (`ndots:0`) also being applied; Before this change: docker network create foo docker run --rm --network foo --dns-opt ndots:0 alpine cat /etc/resolv.conf nameserver 127.0.0.11 options ndots:0 ndots:0 After this change: docker network create foo docker run --rm --network foo --dns-opt ndots:0 alpine cat /etc/resolv.conf nameserver 127.0.0.11 options ndots:0 Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
instead of printing the whole option, print the _number_ only, because that's what the error-message is pointing at; Before this change: invalid number for ndots option ndots:foobar After this change: invalid number for ndots option: foobar Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
ping @fcrisciani @selansen PTAL |
fcrisciani
approved these changes
Jun 28, 2018
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
LGTM |
Closed
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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:0
is a valid DNS option; previously,ndots:0
was 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:-1
being silently ignored