mirror of
https://github.com/moby/moby.git
synced 2022-11-09 12:21:53 -05:00
Merge pull request #11791 from moo-mou/11768-vetwarning
Fix vet warning
This commit is contained in:
commit
a196cc943c
6 changed files with 23 additions and 21 deletions
|
@ -548,7 +548,7 @@ func TestPostContainerBindNormalVolume(t *testing.T) {
|
|||
}
|
||||
|
||||
if fooDir2 != fooDir {
|
||||
t.Fatal("expected volume path to be %s, got: %s", fooDir, fooDir2)
|
||||
t.Fatalf("expected volume path to be %s, got: %s", fooDir, fooDir2)
|
||||
}
|
||||
|
||||
logDone("container REST API - can use path from normal volume as bind-mount to overwrite another volume")
|
||||
|
|
|
@ -524,7 +524,7 @@ func TestDaemonUlimitDefaults(t *testing.T) {
|
|||
|
||||
outArr := strings.Split(out, "\n")
|
||||
if len(outArr) < 2 {
|
||||
t.Fatal("got unexpected output: %s", out)
|
||||
t.Fatalf("got unexpected output: %s", out)
|
||||
}
|
||||
nofile := strings.TrimSpace(outArr[0])
|
||||
nproc := strings.TrimSpace(outArr[1])
|
||||
|
@ -548,7 +548,7 @@ func TestDaemonUlimitDefaults(t *testing.T) {
|
|||
|
||||
outArr = strings.Split(out, "\n")
|
||||
if len(outArr) < 2 {
|
||||
t.Fatal("got unexpected output: %s", out)
|
||||
t.Fatalf("got unexpected output: %s", out)
|
||||
}
|
||||
nofile = strings.TrimSpace(outArr[0])
|
||||
nproc = strings.TrimSpace(outArr[1])
|
||||
|
@ -616,9 +616,9 @@ func TestDaemonLoggingDriverDefault(t *testing.T) {
|
|||
t.Fatal(err)
|
||||
}
|
||||
var res struct {
|
||||
Log string `json:log`
|
||||
Stream string `json:stream`
|
||||
Time time.Time `json:time`
|
||||
Log string `json:"log"`
|
||||
Stream string `json:"stream"`
|
||||
Time time.Time `json:"time"`
|
||||
}
|
||||
if err := json.NewDecoder(f).Decode(&res); err != nil {
|
||||
t.Fatal(err)
|
||||
|
@ -712,9 +712,9 @@ func TestDaemonLoggingDriverNoneOverride(t *testing.T) {
|
|||
t.Fatal(err)
|
||||
}
|
||||
var res struct {
|
||||
Log string `json:log`
|
||||
Stream string `json:stream`
|
||||
Time time.Time `json:time`
|
||||
Log string `json:"log"`
|
||||
Stream string `json:"stream"`
|
||||
Time time.Time `json:"time"`
|
||||
}
|
||||
if err := json.NewDecoder(f).Decode(&res); err != nil {
|
||||
t.Fatal(err)
|
||||
|
|
|
@ -75,7 +75,7 @@ func TestLinksInvalidContainerTarget(t *testing.T) {
|
|||
t.Fatal("an invalid container target should produce an error")
|
||||
}
|
||||
if !strings.Contains(out, "Could not get container") {
|
||||
t.Fatal("error output expected 'Could not get container', but got %q instead; err: %v", out, err)
|
||||
t.Fatalf("error output expected 'Could not get container', but got %q instead; err: %v", out, err)
|
||||
}
|
||||
|
||||
logDone("links - linking to non-existent container should not work")
|
||||
|
|
|
@ -22,7 +22,7 @@ func TestPause(t *testing.T) {
|
|||
t.Fatalf("error thrown while checking if containers were paused: %v", err)
|
||||
}
|
||||
if len(pausedContainers) != 1 {
|
||||
t.Fatalf("there should be one paused container and not", len(pausedContainers))
|
||||
t.Fatalf("there should be one paused container and not %d", len(pausedContainers))
|
||||
}
|
||||
|
||||
dockerCmd(t, "unpause", name)
|
||||
|
|
|
@ -1931,9 +1931,9 @@ func TestRunAttachWithDettach(t *testing.T) {
|
|||
cmd := exec.Command(dockerBinary, "run", "-d", "--attach", "stdout", "busybox", "true")
|
||||
_, stderr, _, err := runCommandWithStdoutStderr(cmd)
|
||||
if err == nil {
|
||||
t.Fatalf("Container should have exited with error code different than 0", err)
|
||||
t.Fatal("Container should have exited with error code different than 0")
|
||||
} else if !strings.Contains(stderr, "Conflicting options: -a and -d") {
|
||||
t.Fatalf("Should have been returned an error with conflicting options -a and -d")
|
||||
t.Fatal("Should have been returned an error with conflicting options -a and -d")
|
||||
}
|
||||
|
||||
logDone("run - Attach stdout with -d")
|
||||
|
@ -2656,7 +2656,7 @@ func TestRunCreateVolumeEtc(t *testing.T) {
|
|||
cmd := exec.Command(dockerBinary, "run", "--dns=127.0.0.1", "-v", "/etc", "busybox", "cat", "/etc/resolv.conf")
|
||||
out, _, err := runCommandWithOutput(cmd)
|
||||
if err != nil {
|
||||
t.Fatal("failed to run container: %v, output: %q", err, out)
|
||||
t.Fatalf("failed to run container: %v, output: %q", err, out)
|
||||
}
|
||||
if !strings.Contains(out, "nameserver 127.0.0.1") {
|
||||
t.Fatal("/etc volume mount hides /etc/resolv.conf")
|
||||
|
@ -2665,7 +2665,7 @@ func TestRunCreateVolumeEtc(t *testing.T) {
|
|||
cmd = exec.Command(dockerBinary, "run", "-h=test123", "-v", "/etc", "busybox", "cat", "/etc/hostname")
|
||||
out, _, err = runCommandWithOutput(cmd)
|
||||
if err != nil {
|
||||
t.Fatal("failed to run container: %v, output: %q", err, out)
|
||||
t.Fatalf("failed to run container: %v, output: %q", err, out)
|
||||
}
|
||||
if !strings.Contains(out, "test123") {
|
||||
t.Fatal("/etc volume mount hides /etc/hostname")
|
||||
|
@ -2674,7 +2674,7 @@ func TestRunCreateVolumeEtc(t *testing.T) {
|
|||
cmd = exec.Command(dockerBinary, "run", "--add-host=test:192.168.0.1", "-v", "/etc", "busybox", "cat", "/etc/hosts")
|
||||
out, _, err = runCommandWithOutput(cmd)
|
||||
if err != nil {
|
||||
t.Fatal("failed to run container: %v, output: %q", err, out)
|
||||
t.Fatalf("failed to run container: %v, output: %q", err, out)
|
||||
}
|
||||
out = strings.Replace(out, "\n", " ", -1)
|
||||
if !strings.Contains(out, "192.168.0.1\ttest") || !strings.Contains(out, "127.0.0.1\tlocalhost") {
|
||||
|
@ -2858,14 +2858,16 @@ func TestRunAllowPortRangeThroughExpose(t *testing.T) {
|
|||
t.Fatal(err)
|
||||
}
|
||||
var ports nat.PortMap
|
||||
err = unmarshalJSON([]byte(portstr), &ports)
|
||||
if err = unmarshalJSON([]byte(portstr), &ports); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
for port, binding := range ports {
|
||||
portnum, _ := strconv.Atoi(strings.Split(string(port), "/")[0])
|
||||
if portnum < 3000 || portnum > 3003 {
|
||||
t.Fatalf("Port is out of range ", portnum, binding, out)
|
||||
t.Fatalf("Port %d is out of range ", portnum)
|
||||
}
|
||||
if binding == nil || len(binding) != 1 || len(binding[0].HostPort) == 0 {
|
||||
t.Fatal("Port is not mapped for the port "+port, out)
|
||||
t.Fatalf("Port is not mapped for the port %d", port)
|
||||
}
|
||||
}
|
||||
if err := deleteContainer(id); err != nil {
|
||||
|
@ -3221,7 +3223,7 @@ func TestRunAllowPortRangeThroughPublish(t *testing.T) {
|
|||
for port, binding := range ports {
|
||||
portnum, _ := strconv.Atoi(strings.Split(string(port), "/")[0])
|
||||
if portnum < 3000 || portnum > 3003 {
|
||||
t.Fatalf("Port is out of range ", portnum, binding, out)
|
||||
t.Fatalf("Port %d is out of range ", portnum)
|
||||
}
|
||||
if binding == nil || len(binding) != 1 || len(binding[0].HostPort) == 0 {
|
||||
t.Fatal("Port is not mapped for the port "+port, out)
|
||||
|
|
|
@ -1045,7 +1045,7 @@ func daemonTime(t *testing.T) time.Time {
|
|||
|
||||
body, err := sockRequest("GET", "/info", nil)
|
||||
if err != nil {
|
||||
t.Fatal("daemonTime: failed to get /info: %v", err)
|
||||
t.Fatalf("daemonTime: failed to get /info: %v", err)
|
||||
}
|
||||
|
||||
type infoJSON struct {
|
||||
|
|
Loading…
Add table
Reference in a new issue