Signed-off-by: Paul Mou <ppymou@gmail.com>
| ... | ... |
@@ -548,7 +548,7 @@ func TestPostContainerBindNormalVolume(t *testing.T) {
|
| 548 | 548 |
} |
| 549 | 549 |
|
| 550 | 550 |
if fooDir2 != fooDir {
|
| 551 |
- t.Fatal("expected volume path to be %s, got: %s", fooDir, fooDir2)
|
|
| 551 |
+ t.Fatalf("expected volume path to be %s, got: %s", fooDir, fooDir2)
|
|
| 552 | 552 |
} |
| 553 | 553 |
|
| 554 | 554 |
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) {
|
| 524 | 524 |
|
| 525 | 525 |
outArr := strings.Split(out, "\n") |
| 526 | 526 |
if len(outArr) < 2 {
|
| 527 |
- t.Fatal("got unexpected output: %s", out)
|
|
| 527 |
+ t.Fatalf("got unexpected output: %s", out)
|
|
| 528 | 528 |
} |
| 529 | 529 |
nofile := strings.TrimSpace(outArr[0]) |
| 530 | 530 |
nproc := strings.TrimSpace(outArr[1]) |
| ... | ... |
@@ -548,7 +548,7 @@ func TestDaemonUlimitDefaults(t *testing.T) {
|
| 548 | 548 |
|
| 549 | 549 |
outArr = strings.Split(out, "\n") |
| 550 | 550 |
if len(outArr) < 2 {
|
| 551 |
- t.Fatal("got unexpected output: %s", out)
|
|
| 551 |
+ t.Fatalf("got unexpected output: %s", out)
|
|
| 552 | 552 |
} |
| 553 | 553 |
nofile = strings.TrimSpace(outArr[0]) |
| 554 | 554 |
nproc = strings.TrimSpace(outArr[1]) |
| ... | ... |
@@ -616,9 +616,9 @@ func TestDaemonLoggingDriverDefault(t *testing.T) {
|
| 616 | 616 |
t.Fatal(err) |
| 617 | 617 |
} |
| 618 | 618 |
var res struct {
|
| 619 |
- Log string `json:log` |
|
| 620 |
- Stream string `json:stream` |
|
| 621 |
- Time time.Time `json:time` |
|
| 619 |
+ Log string `json:"log"` |
|
| 620 |
+ Stream string `json:"stream"` |
|
| 621 |
+ Time time.Time `json:"time"` |
|
| 622 | 622 |
} |
| 623 | 623 |
if err := json.NewDecoder(f).Decode(&res); err != nil {
|
| 624 | 624 |
t.Fatal(err) |
| ... | ... |
@@ -712,9 +712,9 @@ func TestDaemonLoggingDriverNoneOverride(t *testing.T) {
|
| 712 | 712 |
t.Fatal(err) |
| 713 | 713 |
} |
| 714 | 714 |
var res struct {
|
| 715 |
- Log string `json:log` |
|
| 716 |
- Stream string `json:stream` |
|
| 717 |
- Time time.Time `json:time` |
|
| 715 |
+ Log string `json:"log"` |
|
| 716 |
+ Stream string `json:"stream"` |
|
| 717 |
+ Time time.Time `json:"time"` |
|
| 718 | 718 |
} |
| 719 | 719 |
if err := json.NewDecoder(f).Decode(&res); err != nil {
|
| 720 | 720 |
t.Fatal(err) |
| ... | ... |
@@ -75,7 +75,7 @@ func TestLinksInvalidContainerTarget(t *testing.T) {
|
| 75 | 75 |
t.Fatal("an invalid container target should produce an error")
|
| 76 | 76 |
} |
| 77 | 77 |
if !strings.Contains(out, "Could not get container") {
|
| 78 |
- t.Fatal("error output expected 'Could not get container', but got %q instead; err: %v", out, err)
|
|
| 78 |
+ t.Fatalf("error output expected 'Could not get container', but got %q instead; err: %v", out, err)
|
|
| 79 | 79 |
} |
| 80 | 80 |
|
| 81 | 81 |
logDone("links - linking to non-existent container should not work")
|
| ... | ... |
@@ -22,7 +22,7 @@ func TestPause(t *testing.T) {
|
| 22 | 22 |
t.Fatalf("error thrown while checking if containers were paused: %v", err)
|
| 23 | 23 |
} |
| 24 | 24 |
if len(pausedContainers) != 1 {
|
| 25 |
- t.Fatalf("there should be one paused container and not", len(pausedContainers))
|
|
| 25 |
+ t.Fatalf("there should be one paused container and not %d", len(pausedContainers))
|
|
| 26 | 26 |
} |
| 27 | 27 |
|
| 28 | 28 |
dockerCmd(t, "unpause", name) |
| ... | ... |
@@ -1930,9 +1930,9 @@ func TestRunAttachWithDettach(t *testing.T) {
|
| 1930 | 1930 |
cmd := exec.Command(dockerBinary, "run", "-d", "--attach", "stdout", "busybox", "true") |
| 1931 | 1931 |
_, stderr, _, err := runCommandWithStdoutStderr(cmd) |
| 1932 | 1932 |
if err == nil {
|
| 1933 |
- t.Fatalf("Container should have exited with error code different than 0", err)
|
|
| 1933 |
+ t.Fatal("Container should have exited with error code different than 0")
|
|
| 1934 | 1934 |
} else if !strings.Contains(stderr, "Conflicting options: -a and -d") {
|
| 1935 |
- t.Fatalf("Should have been returned an error with conflicting options -a and -d")
|
|
| 1935 |
+ t.Fatal("Should have been returned an error with conflicting options -a and -d")
|
|
| 1936 | 1936 |
} |
| 1937 | 1937 |
|
| 1938 | 1938 |
logDone("run - Attach stdout with -d")
|
| ... | ... |
@@ -2655,7 +2655,7 @@ func TestRunCreateVolumeEtc(t *testing.T) {
|
| 2655 | 2655 |
cmd := exec.Command(dockerBinary, "run", "--dns=127.0.0.1", "-v", "/etc", "busybox", "cat", "/etc/resolv.conf") |
| 2656 | 2656 |
out, _, err := runCommandWithOutput(cmd) |
| 2657 | 2657 |
if err != nil {
|
| 2658 |
- t.Fatal("failed to run container: %v, output: %q", err, out)
|
|
| 2658 |
+ t.Fatalf("failed to run container: %v, output: %q", err, out)
|
|
| 2659 | 2659 |
} |
| 2660 | 2660 |
if !strings.Contains(out, "nameserver 127.0.0.1") {
|
| 2661 | 2661 |
t.Fatal("/etc volume mount hides /etc/resolv.conf")
|
| ... | ... |
@@ -2664,7 +2664,7 @@ func TestRunCreateVolumeEtc(t *testing.T) {
|
| 2664 | 2664 |
cmd = exec.Command(dockerBinary, "run", "-h=test123", "-v", "/etc", "busybox", "cat", "/etc/hostname") |
| 2665 | 2665 |
out, _, err = runCommandWithOutput(cmd) |
| 2666 | 2666 |
if err != nil {
|
| 2667 |
- t.Fatal("failed to run container: %v, output: %q", err, out)
|
|
| 2667 |
+ t.Fatalf("failed to run container: %v, output: %q", err, out)
|
|
| 2668 | 2668 |
} |
| 2669 | 2669 |
if !strings.Contains(out, "test123") {
|
| 2670 | 2670 |
t.Fatal("/etc volume mount hides /etc/hostname")
|
| ... | ... |
@@ -2673,7 +2673,7 @@ func TestRunCreateVolumeEtc(t *testing.T) {
|
| 2673 | 2673 |
cmd = exec.Command(dockerBinary, "run", "--add-host=test:192.168.0.1", "-v", "/etc", "busybox", "cat", "/etc/hosts") |
| 2674 | 2674 |
out, _, err = runCommandWithOutput(cmd) |
| 2675 | 2675 |
if err != nil {
|
| 2676 |
- t.Fatal("failed to run container: %v, output: %q", err, out)
|
|
| 2676 |
+ t.Fatalf("failed to run container: %v, output: %q", err, out)
|
|
| 2677 | 2677 |
} |
| 2678 | 2678 |
out = strings.Replace(out, "\n", " ", -1) |
| 2679 | 2679 |
if !strings.Contains(out, "192.168.0.1\ttest") || !strings.Contains(out, "127.0.0.1\tlocalhost") {
|
| ... | ... |
@@ -2857,14 +2857,16 @@ func TestRunAllowPortRangeThroughExpose(t *testing.T) {
|
| 2857 | 2857 |
t.Fatal(err) |
| 2858 | 2858 |
} |
| 2859 | 2859 |
var ports nat.PortMap |
| 2860 |
- err = unmarshalJSON([]byte(portstr), &ports) |
|
| 2860 |
+ if err = unmarshalJSON([]byte(portstr), &ports); err != nil {
|
|
| 2861 |
+ t.Fatal(err) |
|
| 2862 |
+ } |
|
| 2861 | 2863 |
for port, binding := range ports {
|
| 2862 | 2864 |
portnum, _ := strconv.Atoi(strings.Split(string(port), "/")[0]) |
| 2863 | 2865 |
if portnum < 3000 || portnum > 3003 {
|
| 2864 |
- t.Fatalf("Port is out of range ", portnum, binding, out)
|
|
| 2866 |
+ t.Fatalf("Port %d is out of range ", portnum)
|
|
| 2865 | 2867 |
} |
| 2866 | 2868 |
if binding == nil || len(binding) != 1 || len(binding[0].HostPort) == 0 {
|
| 2867 |
- t.Fatal("Port is not mapped for the port "+port, out)
|
|
| 2869 |
+ t.Fatalf("Port is not mapped for the port %d", port)
|
|
| 2868 | 2870 |
} |
| 2869 | 2871 |
} |
| 2870 | 2872 |
if err := deleteContainer(id); err != nil {
|
| ... | ... |
@@ -3220,7 +3222,7 @@ func TestRunAllowPortRangeThroughPublish(t *testing.T) {
|
| 3220 | 3220 |
for port, binding := range ports {
|
| 3221 | 3221 |
portnum, _ := strconv.Atoi(strings.Split(string(port), "/")[0]) |
| 3222 | 3222 |
if portnum < 3000 || portnum > 3003 {
|
| 3223 |
- t.Fatalf("Port is out of range ", portnum, binding, out)
|
|
| 3223 |
+ t.Fatalf("Port %d is out of range ", portnum)
|
|
| 3224 | 3224 |
} |
| 3225 | 3225 |
if binding == nil || len(binding) != 1 || len(binding[0].HostPort) == 0 {
|
| 3226 | 3226 |
t.Fatal("Port is not mapped for the port "+port, out)
|
| ... | ... |
@@ -1045,7 +1045,7 @@ func daemonTime(t *testing.T) time.Time {
|
| 1045 | 1045 |
|
| 1046 | 1046 |
body, err := sockRequest("GET", "/info", nil)
|
| 1047 | 1047 |
if err != nil {
|
| 1048 |
- t.Fatal("daemonTime: failed to get /info: %v", err)
|
|
| 1048 |
+ t.Fatalf("daemonTime: failed to get /info: %v", err)
|
|
| 1049 | 1049 |
} |
| 1050 | 1050 |
|
| 1051 | 1051 |
type infoJSON struct {
|