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

@@ -1,7 +1,6 @@
package main
import (
"fmt"
"os"
"testing"
@@ -158,7 +157,7 @@ func (s *DockerSuite) TestCpToCaseB(c *testing.T) {
err := runDockerCp(c, srcPath, dstDir, nil)
assert.ErrorContains(c, err, "")
assert.Assert(c, isCpDirNotExist(err), fmt.Sprintf("expected DirNotExists error, but got %T: %s", err, err))
assert.Assert(c, isCpDirNotExist(err), "expected DirNotExists error, but got %T: %s", err, err)
}
// C. SRC specifies a file and DST exists as a file. This should overwrite
@@ -288,7 +287,7 @@ func (s *DockerSuite) TestCpToCaseF(c *testing.T) {
err := runDockerCp(c, srcDir, dstFile, nil)
assert.ErrorContains(c, err, "")
assert.Assert(c, isCpCannotCopyDir(err), fmt.Sprintf("expected ErrCannotCopyDir error, but got %T: %s", err, err))
assert.Assert(c, isCpCannotCopyDir(err), "expected ErrCannotCopyDir error, but got %T: %s", err, err)
}
// G. SRC specifies a directory and DST exists as a directory. This should copy
@@ -393,7 +392,7 @@ func (s *DockerSuite) TestCpToCaseI(c *testing.T) {
err := runDockerCp(c, srcDir, dstFile, nil)
assert.ErrorContains(c, err, "")
assert.Assert(c, isCpCannotCopyDir(err), fmt.Sprintf("expected ErrCannotCopyDir error, but got %T: %s", err, err))
assert.Assert(c, isCpCannotCopyDir(err), "expected ErrCannotCopyDir error, but got %T: %s", err, err)
}
// J. SRC specifies a directory's contents only and DST exists as a directory.
@@ -462,7 +461,7 @@ func (s *DockerSuite) TestCpToErrReadOnlyRootfs(c *testing.T) {
err := runDockerCp(c, srcPath, dstPath, nil)
assert.ErrorContains(c, err, "")
assert.Assert(c, isCpCannotCopyReadOnly(err), fmt.Sprintf("expected ErrContainerRootfsReadonly error, but got %T: %s", err, err))
assert.Assert(c, isCpCannotCopyReadOnly(err), "expected ErrContainerRootfsReadonly error, but got %T: %s", err, err)
// Ensure that dstPath doesn't exist.
assert.Assert(c, containerStartOutputEquals(c, containerID, "") == nil)
@@ -489,7 +488,7 @@ func (s *DockerSuite) TestCpToErrReadOnlyVolume(c *testing.T) {
err := runDockerCp(c, srcPath, dstPath, nil)
assert.ErrorContains(c, err, "")
assert.Assert(c, isCpCannotCopyReadOnly(err), fmt.Sprintf("expected ErrVolumeReadonly error, but got %T: %s", err, err))
assert.Assert(c, isCpCannotCopyReadOnly(err), "expected ErrVolumeReadonly error, but got %T: %s", err, err)
// Ensure that dstPath doesn't exist.
assert.Assert(c, containerStartOutputEquals(c, containerID, "") == nil)