Commit graph

7 commits

Author SHA1 Message Date
Sebastiaan van Stijn
341845b5f2 ndots: produce error on negative numbers
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2018-06-29 01:22:17 +02:00
Sebastiaan van Stijn
b306706062 improve error message for invalid ndots number
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>
2018-06-29 01:19:34 +02:00
Sebastiaan van Stijn
6e260332e8 do not ignore user-provided "ndots:0" option
`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>
2018-06-29 00:58:36 +02:00
Sebastiaan van Stijn
6e6ac3d2ac 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;

    --- 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>
2018-06-29 00:52:16 +02:00
Flavio Crisciani
5a658d4cc1 Fix user specified ndots option
Setting ndots to 0 does not allow to resolve search domains
The default will remain ndots:0 that will directly resolve
services, but if the user specify a different ndots value
just propagate it into the container

Signed-off-by: Flavio Crisciani <flavio.crisciani@docker.com>
2018-01-26 10:07:08 -08:00
Flavio Crisciani
e4f3bcb696 Add test for dns options
Validate that passing an option into the daemon config
does not corrupt the option set into the container resolv.conf

Signed-off-by: Flavio Crisciani <flavio.crisciani@docker.com>
2017-10-23 11:06:37 +02:00
Flavio Crisciani
aa81c6d265 Add test for cleanupServiceDiscovery
Unit test for the cleanupServiceDiscovery,
follow up of PR: #1985

Signed-off-by: Flavio Crisciani <flavio.crisciani@docker.com>
2017-10-19 13:36:29 +02:00