Parcourir la source

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>
Sebastiaan van Stijn il y a 7 ans
Parent
commit
6e6ac3d2ac
1 fichiers modifiés avec 6 ajouts et 6 suppressions
  1. 6 6
      libnetwork/service_common_test.go

+ 6 - 6
libnetwork/service_common_test.go

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