1
0
Fork 0
mirror of https://github.com/moby/moby.git synced 2022-11-09 12:21:53 -05:00

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>
This commit is contained in:
Sebastiaan van Stijn 2018-06-29 00:52:16 +02:00
parent 9d758090cf
commit 6e6ac3d2ac

View file

@ -62,8 +62,8 @@ func TestDNSOptions(t *testing.T) {
currRC, err := resolvconf.GetSpecific(sb.(*sandbox).config.resolvConfPath) currRC, err := resolvconf.GetSpecific(sb.(*sandbox).config.resolvConfPath)
require.NoError(t, err) require.NoError(t, err)
dnsOptionsList := resolvconf.GetOptions(currRC.Content) dnsOptionsList := resolvconf.GetOptions(currRC.Content)
assert.Equal(t, 1, len(dnsOptionsList), "There should be only 1 option instead:", dnsOptionsList) assert.Equal(t, 1, len(dnsOptionsList))
assert.Equal(t, "ndots:0", dnsOptionsList[0], "The option must be ndots:0 instead:", dnsOptionsList[0]) assert.Equal(t, "ndots:0", dnsOptionsList[0])
sb.(*sandbox).config.dnsOptionsList = []string{"ndots:5"} sb.(*sandbox).config.dnsOptionsList = []string{"ndots:5"}
err = sb.(*sandbox).setupDNS() err = sb.(*sandbox).setupDNS()
@ -71,14 +71,14 @@ func TestDNSOptions(t *testing.T) {
currRC, err = resolvconf.GetSpecific(sb.(*sandbox).config.resolvConfPath) currRC, err = resolvconf.GetSpecific(sb.(*sandbox).config.resolvConfPath)
require.NoError(t, err) require.NoError(t, err)
dnsOptionsList = resolvconf.GetOptions(currRC.Content) dnsOptionsList = resolvconf.GetOptions(currRC.Content)
assert.Equal(t, 1, len(dnsOptionsList), "There should be only 1 option instead:", dnsOptionsList) assert.Equal(t, 1, len(dnsOptionsList))
assert.Equal(t, "ndots:5", dnsOptionsList[0], "The option must be ndots:5 instead:", dnsOptionsList[0]) assert.Equal(t, "ndots:5", dnsOptionsList[0])
err = sb.(*sandbox).rebuildDNS() err = sb.(*sandbox).rebuildDNS()
require.NoError(t, err) require.NoError(t, err)
currRC, err = resolvconf.GetSpecific(sb.(*sandbox).config.resolvConfPath) currRC, err = resolvconf.GetSpecific(sb.(*sandbox).config.resolvConfPath)
require.NoError(t, err) require.NoError(t, err)
dnsOptionsList = resolvconf.GetOptions(currRC.Content) dnsOptionsList = resolvconf.GetOptions(currRC.Content)
assert.Equal(t, 1, len(dnsOptionsList), "There should be only 1 option instead:", dnsOptionsList) assert.Equal(t, 1, len(dnsOptionsList))
assert.Equal(t, "ndots:5", dnsOptionsList[0], "The option must be ndots:5 instead:", dnsOptionsList[0]) assert.Equal(t, "ndots:5", dnsOptionsList[0])
} }