mirror of
https://github.com/moby/moby.git
synced 2025-12-04 19:23:06 +03:00
integration: use %s for check.Commentf()
It is wrong to pass an arbitrary string to a function expecting
%-style formatting. One solution would be to replace any % with %%,
but it's easier to just do what this patch does.
Generated with:
for f in $(git grep -l 'check.Commentf(out)'); do \
sed -i -e 's/check\.Commentf(out)/check.Commentf("%s", out)/g' $f; \
done
Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
This commit is contained in:
@@ -579,7 +579,7 @@ func (s *DockerSuite) TestRunWithBlkioWeight(c *check.C) {
|
||||
func (s *DockerSuite) TestRunWithInvalidBlkioWeight(c *check.C) {
|
||||
testRequires(c, blkioWeight)
|
||||
out, _, err := dockerCmdWithError("run", "--blkio-weight", "5", "busybox", "true")
|
||||
c.Assert(err, check.NotNil, check.Commentf(out))
|
||||
c.Assert(err, check.NotNil, check.Commentf("%s", out))
|
||||
expected := "Range of blkio weight is from 10 to 1000"
|
||||
c.Assert(out, checker.Contains, expected)
|
||||
}
|
||||
@@ -587,31 +587,31 @@ func (s *DockerSuite) TestRunWithInvalidBlkioWeight(c *check.C) {
|
||||
func (s *DockerSuite) TestRunWithInvalidPathforBlkioWeightDevice(c *check.C) {
|
||||
testRequires(c, blkioWeight)
|
||||
out, _, err := dockerCmdWithError("run", "--blkio-weight-device", "/dev/sdX:100", "busybox", "true")
|
||||
c.Assert(err, check.NotNil, check.Commentf(out))
|
||||
c.Assert(err, check.NotNil, check.Commentf("%s", out))
|
||||
}
|
||||
|
||||
func (s *DockerSuite) TestRunWithInvalidPathforBlkioDeviceReadBps(c *check.C) {
|
||||
testRequires(c, blkioWeight)
|
||||
out, _, err := dockerCmdWithError("run", "--device-read-bps", "/dev/sdX:500", "busybox", "true")
|
||||
c.Assert(err, check.NotNil, check.Commentf(out))
|
||||
c.Assert(err, check.NotNil, check.Commentf("%s", out))
|
||||
}
|
||||
|
||||
func (s *DockerSuite) TestRunWithInvalidPathforBlkioDeviceWriteBps(c *check.C) {
|
||||
testRequires(c, blkioWeight)
|
||||
out, _, err := dockerCmdWithError("run", "--device-write-bps", "/dev/sdX:500", "busybox", "true")
|
||||
c.Assert(err, check.NotNil, check.Commentf(out))
|
||||
c.Assert(err, check.NotNil, check.Commentf("%s", out))
|
||||
}
|
||||
|
||||
func (s *DockerSuite) TestRunWithInvalidPathforBlkioDeviceReadIOps(c *check.C) {
|
||||
testRequires(c, blkioWeight)
|
||||
out, _, err := dockerCmdWithError("run", "--device-read-iops", "/dev/sdX:500", "busybox", "true")
|
||||
c.Assert(err, check.NotNil, check.Commentf(out))
|
||||
c.Assert(err, check.NotNil, check.Commentf("%s", out))
|
||||
}
|
||||
|
||||
func (s *DockerSuite) TestRunWithInvalidPathforBlkioDeviceWriteIOps(c *check.C) {
|
||||
testRequires(c, blkioWeight)
|
||||
out, _, err := dockerCmdWithError("run", "--device-write-iops", "/dev/sdX:500", "busybox", "true")
|
||||
c.Assert(err, check.NotNil, check.Commentf(out))
|
||||
c.Assert(err, check.NotNil, check.Commentf("%s", out))
|
||||
}
|
||||
|
||||
func (s *DockerSuite) TestRunOOMExitCode(c *check.C) {
|
||||
@@ -767,17 +767,17 @@ func (s *DockerSuite) TestRunInvalidCpusetMemsFlagValue(c *check.C) {
|
||||
func (s *DockerSuite) TestRunInvalidCPUShares(c *check.C) {
|
||||
testRequires(c, cpuShare, DaemonIsLinux)
|
||||
out, _, err := dockerCmdWithError("run", "--cpu-shares", "1", "busybox", "echo", "test")
|
||||
c.Assert(err, check.NotNil, check.Commentf(out))
|
||||
c.Assert(err, check.NotNil, check.Commentf("%s", out))
|
||||
expected := "The minimum allowed cpu-shares is 2"
|
||||
c.Assert(out, checker.Contains, expected)
|
||||
|
||||
out, _, err = dockerCmdWithError("run", "--cpu-shares", "-1", "busybox", "echo", "test")
|
||||
c.Assert(err, check.NotNil, check.Commentf(out))
|
||||
c.Assert(err, check.NotNil, check.Commentf("%s", out))
|
||||
expected = "shares: invalid argument"
|
||||
c.Assert(out, checker.Contains, expected)
|
||||
|
||||
out, _, err = dockerCmdWithError("run", "--cpu-shares", "99999999", "busybox", "echo", "test")
|
||||
c.Assert(err, check.NotNil, check.Commentf(out))
|
||||
c.Assert(err, check.NotNil, check.Commentf("%s", out))
|
||||
expected = "The maximum allowed cpu-shares is"
|
||||
c.Assert(out, checker.Contains, expected)
|
||||
}
|
||||
@@ -1349,7 +1349,7 @@ func (s *DockerSuite) TestRunSeccompWithDefaultProfile(c *check.C) {
|
||||
testRequires(c, SameHostDaemon, seccompEnabled)
|
||||
|
||||
out, _, err := dockerCmdWithError("run", "--security-opt", "seccomp=../profiles/seccomp/default.json", "debian:jessie", "unshare", "--map-root-user", "--user", "sh", "-c", "whoami")
|
||||
c.Assert(err, checker.NotNil, check.Commentf(out))
|
||||
c.Assert(err, checker.NotNil, check.Commentf("%s", out))
|
||||
c.Assert(strings.TrimSpace(out), checker.Equals, "unshare: unshare failed: Operation not permitted")
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user