1
0
mirror of https://github.com/moby/moby.git synced 2025-07-30 18:23:29 +03:00

integration-cli: remove unneeded fmt.Sprintf() in asserts

Replaced using a bit of grep-ing;

```
find . -name "*_test.go" -exec sed -E -i 's#assert.Assert\((.*), fmt.Sprintf\((.*)\)\)$#assert.Assert\(\1, \2\)#g' '{}' \;
```

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
This commit is contained in:
Sebastiaan van Stijn
2019-09-11 12:57:29 +02:00
parent 09226c4442
commit 0fabf3e41e
30 changed files with 181 additions and 187 deletions

View File

@ -118,7 +118,7 @@ func (s *DockerSuite) TestInspectTypeFlagWithInvalidValue(c *testing.T) {
dockerCmd(c, "run", "--name=busybox", "-d", "busybox", "true")
out, exitCode, err := dockerCmdWithError("inspect", "--type=foobar", "busybox")
assert.Assert(c, err != nil, fmt.Sprintf("%d", exitCode))
assert.Assert(c, err != nil, "%d", exitCode)
assert.Equal(c, exitCode, 1, fmt.Sprintf("%s", err))
assert.Assert(c, strings.Contains(out, "not a valid value for --type"))
}
@ -129,7 +129,7 @@ func (s *DockerSuite) TestInspectImageFilterInt(c *testing.T) {
out := inspectField(c, imageTest, "Size")
size, err := strconv.Atoi(out)
assert.Assert(c, err == nil, fmt.Sprintf("failed to inspect size of the image: %s, %v", out, err))
assert.Assert(c, err == nil, "failed to inspect size of the image: %s, %v", out, err)
//now see if the size turns out to be the same
formatStr := fmt.Sprintf("--format={{eq .Size %d}}", size)
@ -151,7 +151,7 @@ func (s *DockerSuite) TestInspectContainerFilterInt(c *testing.T) {
out = inspectField(c, id, "State.ExitCode")
exitCode, err := strconv.Atoi(out)
assert.Assert(c, err == nil, fmt.Sprintf("failed to inspect exitcode of the container: %s, %v", out, err))
assert.Assert(c, err == nil, "failed to inspect exitcode of the container: %s, %v", out, err)
//now get the exit code to verify
formatStr := fmt.Sprintf("--format={{eq .State.ExitCode %d}}", exitCode)
@ -171,12 +171,12 @@ func (s *DockerSuite) TestInspectImageGraphDriver(c *testing.T) {
deviceID := inspectField(c, imageTest, "GraphDriver.Data.DeviceId")
_, err := strconv.Atoi(deviceID)
assert.Assert(c, err == nil, fmt.Sprintf("failed to inspect DeviceId of the image: %s, %v", deviceID, err))
assert.Assert(c, err == nil, "failed to inspect DeviceId of the image: %s, %v", deviceID, err)
deviceSize := inspectField(c, imageTest, "GraphDriver.Data.DeviceSize")
_, err = strconv.ParseUint(deviceSize, 10, 64)
assert.Assert(c, err == nil, fmt.Sprintf("failed to inspect DeviceSize of the image: %s, %v", deviceSize, err))
assert.Assert(c, err == nil, "failed to inspect DeviceSize of the image: %s, %v", deviceSize, err)
}
func (s *DockerSuite) TestInspectContainerGraphDriver(c *testing.T) {
@ -196,12 +196,12 @@ func (s *DockerSuite) TestInspectContainerGraphDriver(c *testing.T) {
assert.Assert(c, imageDeviceID != deviceID)
_, err := strconv.Atoi(deviceID)
assert.Assert(c, err == nil, fmt.Sprintf("failed to inspect DeviceId of the image: %s, %v", deviceID, err))
assert.Assert(c, err == nil, "failed to inspect DeviceId of the image: %s, %v", deviceID, err)
deviceSize := inspectField(c, out, "GraphDriver.Data.DeviceSize")
_, err = strconv.ParseUint(deviceSize, 10, 64)
assert.Assert(c, err == nil, fmt.Sprintf("failed to inspect DeviceSize of the image: %s, %v", deviceSize, err))
assert.Assert(c, err == nil, "failed to inspect DeviceSize of the image: %s, %v", deviceSize, err)
}
func (s *DockerSuite) TestInspectBindMountPoint(c *testing.T) {
@ -288,7 +288,7 @@ func (s *DockerSuite) TestInspectLogConfigNoType(c *testing.T) {
out := inspectFieldJSON(c, "test", "HostConfig.LogConfig")
err := json.NewDecoder(strings.NewReader(out)).Decode(&logConfig)
assert.Assert(c, err == nil, fmt.Sprintf("%v", out))
assert.Assert(c, err == nil, "%v", out)
assert.Equal(c, logConfig.Type, "json-file")
assert.Equal(c, logConfig.Config["max-file"], "42", fmt.Sprintf("%v", logConfig))