integration-cli: S1025: the argument is already a string (gosimple)
``` integration-cli/docker_cli_daemon_test.go:1753:32: S1025: the argument is already a string, there's no need to use fmt.Sprintf (gosimple) integration-cli/docker_cli_daemon_test.go:1783:31: S1025: the argument is already a string, there's no need to use fmt.Sprintf (gosimple) integration-cli/docker_cli_daemon_test.go:1893:92: S1025: the argument is already a string, there's no need to use fmt.Sprintf (gosimple) integration-cli/docker_cli_external_volume_driver_test.go:444:34: S1025: the argument is already a string, there's no need to use fmt.Sprintf (gosimple) integration-cli/docker_cli_external_volume_driver_test.go:600:36: S1025: the argument is already a string, there's no need to use fmt.Sprintf (gosimple) integration-cli/docker_cli_external_volume_driver_test.go:602:36: S1025: the argument is already a string, there's no need to use fmt.Sprintf (gosimple) integration-cli/docker_cli_external_volume_driver_test.go:610:34: S1025: the argument is already a string, there's no need to use fmt.Sprintf (gosimple) integration-cli/docker_cli_external_volume_driver_test.go:613:34: S1025: the argument is already a string, there's no need to use fmt.Sprintf (gosimple) integration-cli/docker_cli_external_volume_driver_test.go:614:36: S1025: the argument is already a string, there's no need to use fmt.Sprintf (gosimple) integration-cli/docker_cli_external_volume_driver_test.go:617:36: S1025: the argument is already a string, there's no need to use fmt.Sprintf (gosimple) integration-cli/docker_cli_plugins_test.go:431:39: S1025: the argument is already a string, there's no need to use fmt.Sprintf (gosimple) integration-cli/docker_cli_swarm_test.go:174:31: S1025: the argument is already a string, there's no need to use fmt.Sprintf (gosimple) integration-cli/docker_cli_swarm_test.go:1046:31: S1025: the argument is already a string, there's no need to use fmt.Sprintf (gosimple) integration-cli/docker_cli_swarm_test.go:1071:31: S1025: the argument is already a string, there's no need to use fmt.Sprintf (gosimple) integration-cli/docker_cli_swarm_test.go:1074:31: S1025: the argument is already a string, there's no need to use fmt.Sprintf (gosimple) integration-cli/docker_cli_swarm_test.go:1079:31: S1025: the argument is already a string, there's no need to use fmt.Sprintf (gosimple) integration-cli/docker_cli_swarm_test.go:1087:31: S1025: the argument is already a string, there's no need to use fmt.Sprintf (gosimple) integration-cli/docker_cli_swarm_test.go:1102:31: S1025: the argument is already a string, there's no need to use fmt.Sprintf (gosimple) integration-cli/docker_cli_swarm_test.go:1108:31: S1025: the argument is already a string, there's no need to use fmt.Sprintf (gosimple) integration-cli/docker_cli_swarm_test.go:1128:31: S1025: the argument is already a string, there's no need to use fmt.Sprintf (gosimple) integration-cli/docker_cli_swarm_test.go:1323:31: S1025: the argument is already a string, there's no need to use fmt.Sprintf (gosimple) integration-cli/docker_cli_swarm_test.go:1329:32: S1025: the argument is already a string, there's no need to use fmt.Sprintf (gosimple) integration-cli/docker_cli_swarm_test.go:1388:34: S1025: the argument is already a string, there's no need to use fmt.Sprintf (gosimple) integration-cli/docker_cli_swarm_test.go:1985:31: S1025: the argument is already a string, there's no need to use fmt.Sprintf (gosimple) ``` Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
This commit is contained in:
parent
5bba06e082
commit
a2f16b0ad3
4 changed files with 24 additions and 24 deletions
|
@ -1750,7 +1750,7 @@ func (s *DockerDaemonSuite) TestBridgeIPIsExcludedFromAllocatorPool(c *testing.T
|
|||
break
|
||||
}
|
||||
ip, err := s.d.Cmd("inspect", "--format", "'{{.NetworkSettings.IPAddress}}'", contName)
|
||||
assert.Assert(c, err == nil, "%s", ip)
|
||||
assert.Assert(c, err == nil, ip)
|
||||
|
||||
assert.Assert(c, ip != bridgeIP)
|
||||
cont++
|
||||
|
@ -1780,7 +1780,7 @@ func (s *DockerDaemonSuite) TestDaemonNoSpaceLeftOnDeviceError(c *testing.T) {
|
|||
|
||||
// pull a repository large enough to overfill the mounted filesystem
|
||||
pullOut, err := s.d.Cmd("pull", "debian:stretch")
|
||||
assert.Assert(c, err != nil, "%s", pullOut)
|
||||
assert.Assert(c, err != nil, pullOut)
|
||||
assert.Assert(c, strings.Contains(pullOut, "no space left on device"))
|
||||
}
|
||||
|
||||
|
@ -1890,7 +1890,7 @@ func (s *DockerDaemonSuite) TestDaemonRestartWithLinks(c *testing.T) {
|
|||
assert.NilError(c, err, out)
|
||||
out, err = s.d.Cmd("start", "-a", "test2")
|
||||
assert.NilError(c, err, out)
|
||||
assert.Equal(c, strings.Contains(out, "1 packets transmitted, 1 packets received"), true, fmt.Sprintf("%s", out))
|
||||
assert.Equal(c, strings.Contains(out, "1 packets transmitted, 1 packets received"), true, out)
|
||||
}
|
||||
|
||||
func (s *DockerDaemonSuite) TestDaemonRestartWithNames(c *testing.T) {
|
||||
|
|
|
@ -441,7 +441,7 @@ func (s *DockerExternalVolumeSuite) TestExternalVolumeDriverBindExternalVolume(c
|
|||
}
|
||||
out := inspectFieldJSON(c, "testing", "Mounts")
|
||||
assert.Assert(c, json.NewDecoder(strings.NewReader(out)).Decode(&mounts) == nil)
|
||||
assert.Equal(c, len(mounts), 1, fmt.Sprintf("%s", out))
|
||||
assert.Equal(c, len(mounts), 1, out)
|
||||
assert.Equal(c, mounts[0].Name, "foo")
|
||||
assert.Equal(c, mounts[0].Driver, volumePluginName)
|
||||
}
|
||||
|
@ -597,9 +597,9 @@ func (s *DockerExternalVolumeSuite) TestExternalVolumeDriverUnmountOnMountFail(c
|
|||
s.d.Cmd("volume", "create", "-d", "test-external-volume-driver", "--opt=invalidOption=1", "--name=testumount")
|
||||
|
||||
out, _ := s.d.Cmd("run", "-v", "testumount:/foo", "busybox", "true")
|
||||
assert.Equal(c, s.ec.unmounts, 0, fmt.Sprintf("%s", out))
|
||||
assert.Equal(c, s.ec.unmounts, 0, out)
|
||||
out, _ = s.d.Cmd("run", "-w", "/foo", "-v", "testumount:/foo", "busybox", "true")
|
||||
assert.Equal(c, s.ec.unmounts, 0, fmt.Sprintf("%s", out))
|
||||
assert.Equal(c, s.ec.unmounts, 0, out)
|
||||
}
|
||||
|
||||
func (s *DockerExternalVolumeSuite) TestExternalVolumeDriverUnmountOnCp(c *testing.T) {
|
||||
|
@ -607,12 +607,12 @@ func (s *DockerExternalVolumeSuite) TestExternalVolumeDriverUnmountOnCp(c *testi
|
|||
s.d.Cmd("volume", "create", "-d", "test-external-volume-driver", "--name=test")
|
||||
|
||||
out, _ := s.d.Cmd("run", "-d", "--name=test", "-v", "test:/foo", "busybox", "/bin/sh", "-c", "touch /test && top")
|
||||
assert.Equal(c, s.ec.mounts, 1, fmt.Sprintf("%s", out))
|
||||
assert.Equal(c, s.ec.mounts, 1, out)
|
||||
|
||||
out, _ = s.d.Cmd("cp", "test:/test", "/tmp/test")
|
||||
assert.Equal(c, s.ec.mounts, 2, fmt.Sprintf("%s", out))
|
||||
assert.Equal(c, s.ec.unmounts, 1, fmt.Sprintf("%s", out))
|
||||
assert.Equal(c, s.ec.mounts, 2, out)
|
||||
assert.Equal(c, s.ec.unmounts, 1, out)
|
||||
|
||||
out, _ = s.d.Cmd("kill", "test")
|
||||
assert.Equal(c, s.ec.unmounts, 2, fmt.Sprintf("%s", out))
|
||||
assert.Equal(c, s.ec.unmounts, 2, out)
|
||||
}
|
||||
|
|
|
@ -428,7 +428,7 @@ func (s *DockerSuite) TestPluginUpgrade(c *testing.T) {
|
|||
|
||||
// make sure "v2" does not exists
|
||||
_, err = os.Stat(filepath.Join(testEnv.DaemonInfo.DockerRootDir, "plugins", id, "rootfs", "v2"))
|
||||
assert.Assert(c, os.IsNotExist(err), "%s", out)
|
||||
assert.Assert(c, os.IsNotExist(err), out)
|
||||
|
||||
dockerCmd(c, "plugin", "disable", "-f", plugin)
|
||||
dockerCmd(c, "plugin", "upgrade", "--grant-all-permissions", "--skip-remote-check", plugin, pluginV2)
|
||||
|
|
|
@ -171,7 +171,7 @@ func (s *DockerSwarmSuite) TestSwarmIncompatibleDaemon(c *testing.T) {
|
|||
func (s *DockerSwarmSuite) TestSwarmServiceTemplatingHostname(c *testing.T) {
|
||||
d := s.AddDaemon(c, true, true)
|
||||
hostname, err := d.Cmd("node", "inspect", "--format", "{{.Description.Hostname}}", "self")
|
||||
assert.Assert(c, err == nil, "%s", hostname)
|
||||
assert.Assert(c, err == nil, hostname)
|
||||
|
||||
out, err := d.Cmd("service", "create", "--detach", "--no-resolve-image", "--name", "test", "--hostname", "{{.Service.Name}}-{{.Task.Slot}}-{{.Node.Hostname}}", "busybox", "top")
|
||||
assert.NilError(c, err, out)
|
||||
|
@ -1043,7 +1043,7 @@ func (s *DockerSwarmSuite) TestSwarmInitLocked(c *testing.T) {
|
|||
d := s.AddDaemon(c, false, false)
|
||||
|
||||
outs, err := d.Cmd("swarm", "init", "--autolock")
|
||||
assert.Assert(c, err == nil, "%s", outs)
|
||||
assert.Assert(c, err == nil, outs)
|
||||
unlockKey := getUnlockKey(d, c, outs)
|
||||
|
||||
assert.Equal(c, getNodeStatus(c, d), swarm.LocalNodeStateActive)
|
||||
|
@ -1068,15 +1068,15 @@ func (s *DockerSwarmSuite) TestSwarmInitLocked(c *testing.T) {
|
|||
assert.Equal(c, getNodeStatus(c, d), swarm.LocalNodeStateActive)
|
||||
|
||||
outs, err = d.Cmd("node", "ls")
|
||||
assert.Assert(c, err == nil, "%s", outs)
|
||||
assert.Assert(c, err == nil, outs)
|
||||
assert.Assert(c, !strings.Contains(outs, "Swarm is encrypted and needs to be unlocked"))
|
||||
outs, err = d.Cmd("swarm", "update", "--autolock=false")
|
||||
assert.Assert(c, err == nil, "%s", outs)
|
||||
assert.Assert(c, err == nil, outs)
|
||||
|
||||
checkSwarmLockedToUnlocked(c, d)
|
||||
|
||||
outs, err = d.Cmd("node", "ls")
|
||||
assert.Assert(c, err == nil, "%s", outs)
|
||||
assert.Assert(c, err == nil, outs)
|
||||
assert.Assert(c, !strings.Contains(outs, "Swarm is encrypted and needs to be unlocked"))
|
||||
}
|
||||
|
||||
|
@ -1084,7 +1084,7 @@ func (s *DockerSwarmSuite) TestSwarmLeaveLocked(c *testing.T) {
|
|||
d := s.AddDaemon(c, false, false)
|
||||
|
||||
outs, err := d.Cmd("swarm", "init", "--autolock")
|
||||
assert.Assert(c, err == nil, "%s", outs)
|
||||
assert.Assert(c, err == nil, outs)
|
||||
|
||||
// It starts off locked
|
||||
d.RestartNode(c)
|
||||
|
@ -1099,13 +1099,13 @@ func (s *DockerSwarmSuite) TestSwarmLeaveLocked(c *testing.T) {
|
|||
assert.Assert(c, strings.Contains(outs, "Swarm is encrypted and locked."))
|
||||
// It is OK for user to leave a locked swarm with --force
|
||||
outs, err = d.Cmd("swarm", "leave", "--force")
|
||||
assert.Assert(c, err == nil, "%s", outs)
|
||||
assert.Assert(c, err == nil, outs)
|
||||
|
||||
info = d.SwarmInfo(c)
|
||||
assert.Equal(c, info.LocalNodeState, swarm.LocalNodeStateInactive)
|
||||
|
||||
outs, err = d.Cmd("swarm", "init")
|
||||
assert.Assert(c, err == nil, "%s", outs)
|
||||
assert.Assert(c, err == nil, outs)
|
||||
|
||||
info = d.SwarmInfo(c)
|
||||
assert.Equal(c, info.LocalNodeState, swarm.LocalNodeStateActive)
|
||||
|
@ -1125,7 +1125,7 @@ func (s *DockerSwarmSuite) TestSwarmLockUnlockCluster(c *testing.T) {
|
|||
|
||||
// enable autolock
|
||||
outs, err := d1.Cmd("swarm", "update", "--autolock")
|
||||
assert.Assert(c, err == nil, "%s", outs)
|
||||
assert.Assert(c, err == nil, outs)
|
||||
unlockKey := getUnlockKey(d1, c, outs)
|
||||
|
||||
// The ones that got the cluster update should be set to locked
|
||||
|
@ -1320,13 +1320,13 @@ func (s *DockerSwarmSuite) TestSwarmClusterRotateUnlockKey(c *testing.T) {
|
|||
d3 := s.AddDaemon(c, true, true)
|
||||
|
||||
outs, err := d1.Cmd("swarm", "update", "--autolock")
|
||||
assert.Assert(c, err == nil, "%s", outs)
|
||||
assert.Assert(c, err == nil, outs)
|
||||
unlockKey := getUnlockKey(d1, c, outs)
|
||||
|
||||
// Rotate multiple times
|
||||
for i := 0; i != 3; i++ {
|
||||
outs, err = d1.Cmd("swarm", "unlock-key", "-q", "--rotate")
|
||||
assert.Assert(c, err == nil, "%s", outs)
|
||||
assert.Assert(c, err == nil, outs)
|
||||
// Strip \n
|
||||
newUnlockKey := outs[:len(outs)-1]
|
||||
assert.Assert(c, newUnlockKey != "")
|
||||
|
@ -1385,7 +1385,7 @@ func (s *DockerSwarmSuite) TestSwarmClusterRotateUnlockKey(c *testing.T) {
|
|||
continue
|
||||
}
|
||||
}
|
||||
assert.Assert(c, err == nil, "%s", outs)
|
||||
assert.Assert(c, err == nil, outs)
|
||||
assert.Assert(c, !strings.Contains(outs, "Swarm is encrypted and needs to be unlocked"))
|
||||
break
|
||||
}
|
||||
|
@ -1982,7 +1982,7 @@ func (s *DockerSwarmSuite) TestSwarmClusterEventsConfig(c *testing.T) {
|
|||
|
||||
func getUnlockKey(d *daemon.Daemon, c *testing.T, autolockOutput string) string {
|
||||
unlockKey, err := d.Cmd("swarm", "unlock-key", "-q")
|
||||
assert.Assert(c, err == nil, "%s", unlockKey)
|
||||
assert.Assert(c, err == nil, unlockKey)
|
||||
unlockKey = strings.TrimSuffix(unlockKey, "\n")
|
||||
|
||||
// Check that "docker swarm init --autolock" or "docker swarm update --autolock"
|
||||
|
|
Loading…
Add table
Reference in a new issue