From 9632b0f1e8b7591f17f5129a4067695111f7df90 Mon Sep 17 00:00:00 2001 From: fate-grand-order Date: Tue, 21 Feb 2017 16:53:29 +0800 Subject: [PATCH] use t.Fatal() to output the err message where the values used for formatting text does not appear to contain a placeholder Signed-off-by: Helen Xie Upstream-commit: 2a8d6368d4a930203b93f75914173ab65bf3b0bc Component: engine --- components/engine/api/common_test.go | 2 +- .../engine/api/server/httputils/form_test.go | 2 +- .../api/server/middleware/version_test.go | 4 +-- .../engine/api/types/filters/parse_test.go | 34 +++++++++---------- .../engine/builder/dockerfile/bflag_test.go | 2 +- .../builder/dockerfile/dispatchers_unix.go | 5 +-- .../builder/dockerfile/dispatchers_windows.go | 5 +-- .../builder/dockerfile/parser/line_parsers.go | 2 +- .../builder/dockerfile/parser/parser_test.go | 4 +-- .../builder/dockerignore/dockerignore_test.go | 8 ++--- components/engine/builder/remote_test.go | 6 ++-- components/engine/builder/tarsum_test.go | 10 +++--- .../engine/cli/command/container/opts_test.go | 18 +++++----- components/engine/daemon/daemon_linux_test.go | 6 ++-- components/engine/daemon/daemon_unix_test.go | 2 +- .../engine/daemon/discovery/discovery_test.go | 12 +++---- components/engine/daemon/events_test.go | 2 +- .../daemon/graphdriver/aufs/aufs_test.go | 12 +++---- .../graphdriver/devmapper/devmapper_test.go | 6 ++-- components/engine/daemon/links/links_test.go | 2 +- .../engine/daemon/logger/copier_test.go | 2 +- components/engine/daemon/reload_test.go | 2 +- 22 files changed, 75 insertions(+), 73 deletions(-) diff --git a/components/engine/api/common_test.go b/components/engine/api/common_test.go index 31d6f58253..4d67206ffa 100644 --- a/components/engine/api/common_test.go +++ b/components/engine/api/common_test.go @@ -286,7 +286,7 @@ func TestLoadOrCreateTrustKeyInvalidKeyFile(t *testing.T) { } if _, err := LoadOrCreateTrustKey(tmpKeyFile.Name()); err == nil { - t.Fatalf("expected an error, got nothing.") + t.Fatal("expected an error, got nothing.") } } diff --git a/components/engine/api/server/httputils/form_test.go b/components/engine/api/server/httputils/form_test.go index c56f7c15e3..bc790e99c3 100644 --- a/components/engine/api/server/httputils/form_test.go +++ b/components/engine/api/server/httputils/form_test.go @@ -100,6 +100,6 @@ func TestInt64ValueOrDefaultWithError(t *testing.T) { _, err := Int64ValueOrDefault(r, "test", -1) if err == nil { - t.Fatalf("Expected an error.") + t.Fatal("Expected an error.") } } diff --git a/components/engine/api/server/middleware/version_test.go b/components/engine/api/server/middleware/version_test.go index 9e72efd78d..29787bf4d8 100644 --- a/components/engine/api/server/middleware/version_test.go +++ b/components/engine/api/server/middleware/version_test.go @@ -13,7 +13,7 @@ import ( func TestVersionMiddleware(t *testing.T) { handler := func(ctx context.Context, w http.ResponseWriter, r *http.Request, vars map[string]string) error { if httputils.VersionFromContext(ctx) == "" { - t.Fatalf("Expected version, got empty string") + t.Fatal("Expected version, got empty string") } return nil } @@ -34,7 +34,7 @@ func TestVersionMiddleware(t *testing.T) { func TestVersionMiddlewareWithErrors(t *testing.T) { handler := func(ctx context.Context, w http.ResponseWriter, r *http.Request, vars map[string]string) error { if httputils.VersionFromContext(ctx) == "" { - t.Fatalf("Expected version, got empty string") + t.Fatal("Expected version, got empty string") } return nil } diff --git a/components/engine/api/types/filters/parse_test.go b/components/engine/api/types/filters/parse_test.go index fbd9e8a2e2..8198f89d7e 100644 --- a/components/engine/api/types/filters/parse_test.go +++ b/components/engine/api/types/filters/parse_test.go @@ -1,7 +1,7 @@ package filters import ( - "fmt" + "errors" "testing" ) @@ -284,18 +284,18 @@ func TestDel(t *testing.T) { f.Del("status", "running") v := f.fields["status"] if v["running"] { - t.Fatalf("Expected to not include a running status filter, got true") + t.Fatal("Expected to not include a running status filter, got true") } } func TestLen(t *testing.T) { f := NewArgs() if f.Len() != 0 { - t.Fatalf("Expected to not include any field") + t.Fatal("Expected to not include any field") } f.Add("status", "running") if f.Len() != 1 { - t.Fatalf("Expected to include one field") + t.Fatal("Expected to include one field") } } @@ -303,18 +303,18 @@ func TestExactMatch(t *testing.T) { f := NewArgs() if !f.ExactMatch("status", "running") { - t.Fatalf("Expected to match `running` when there are no filters, got false") + t.Fatal("Expected to match `running` when there are no filters, got false") } f.Add("status", "running") f.Add("status", "pause*") if !f.ExactMatch("status", "running") { - t.Fatalf("Expected to match `running` with one of the filters, got false") + t.Fatal("Expected to match `running` with one of the filters, got false") } if f.ExactMatch("status", "paused") { - t.Fatalf("Expected to not match `paused` with one of the filters, got true") + t.Fatal("Expected to not match `paused` with one of the filters, got true") } } @@ -322,33 +322,33 @@ func TestOnlyOneExactMatch(t *testing.T) { f := NewArgs() if !f.UniqueExactMatch("status", "running") { - t.Fatalf("Expected to match `running` when there are no filters, got false") + t.Fatal("Expected to match `running` when there are no filters, got false") } f.Add("status", "running") if !f.UniqueExactMatch("status", "running") { - t.Fatalf("Expected to match `running` with one of the filters, got false") + t.Fatal("Expected to match `running` with one of the filters, got false") } if f.UniqueExactMatch("status", "paused") { - t.Fatalf("Expected to not match `paused` with one of the filters, got true") + t.Fatal("Expected to not match `paused` with one of the filters, got true") } f.Add("status", "pause") if f.UniqueExactMatch("status", "running") { - t.Fatalf("Expected to not match only `running` with two filters, got true") + t.Fatal("Expected to not match only `running` with two filters, got true") } } func TestInclude(t *testing.T) { f := NewArgs() if f.Include("status") { - t.Fatalf("Expected to not include a status key, got true") + t.Fatal("Expected to not include a status key, got true") } f.Add("status", "running") if !f.Include("status") { - t.Fatalf("Expected to include a status key, got false") + t.Fatal("Expected to include a status key, got false") } } @@ -367,7 +367,7 @@ func TestValidate(t *testing.T) { f.Add("bogus", "running") if err := f.Validate(valid); err == nil { - t.Fatalf("Expected to return an error, got nil") + t.Fatal("Expected to return an error, got nil") } } @@ -384,14 +384,14 @@ func TestWalkValues(t *testing.T) { }) err := f.WalkValues("status", func(value string) error { - return fmt.Errorf("return") + return errors.New("return") }) if err == nil { - t.Fatalf("Expected to get an error, got nil") + t.Fatal("Expected to get an error, got nil") } err = f.WalkValues("foo", func(value string) error { - return fmt.Errorf("return") + return errors.New("return") }) if err != nil { t.Fatalf("Expected to not iterate when the field doesn't exist, got %v", err) diff --git a/components/engine/builder/dockerfile/bflag_test.go b/components/engine/builder/dockerfile/bflag_test.go index 78bae80faa..ac07e48c14 100644 --- a/components/engine/builder/dockerfile/bflag_test.go +++ b/components/engine/builder/dockerfile/bflag_test.go @@ -130,7 +130,7 @@ func TestBuilderFlags(t *testing.T) { } if !flBool1.IsTrue() { - t.Fatalf("Test-b2 Bool1 was supposed to be true") + t.Fatal("Test-b2 Bool1 was supposed to be true") } // --- diff --git a/components/engine/builder/dockerfile/dispatchers_unix.go b/components/engine/builder/dockerfile/dispatchers_unix.go index 8b0dfc3911..29eb2fb008 100644 --- a/components/engine/builder/dockerfile/dispatchers_unix.go +++ b/components/engine/builder/dockerfile/dispatchers_unix.go @@ -3,16 +3,17 @@ package dockerfile import ( + "errors" "fmt" "os" "path/filepath" ) // normaliseWorkdir normalises a user requested working directory in a -// platform sematically consistent way. +// platform semantically consistent way. func normaliseWorkdir(current string, requested string) (string, error) { if requested == "" { - return "", fmt.Errorf("cannot normalise nothing") + return "", errors.New("cannot normalise nothing") } current = filepath.FromSlash(current) requested = filepath.FromSlash(requested) diff --git a/components/engine/builder/dockerfile/dispatchers_windows.go b/components/engine/builder/dockerfile/dispatchers_windows.go index e890c3ae18..471232f3c7 100644 --- a/components/engine/builder/dockerfile/dispatchers_windows.go +++ b/components/engine/builder/dockerfile/dispatchers_windows.go @@ -1,6 +1,7 @@ package dockerfile import ( + "errors" "fmt" "os" "path/filepath" @@ -13,10 +14,10 @@ import ( var pattern = regexp.MustCompile(`^[a-zA-Z]:\.$`) // normaliseWorkdir normalises a user requested working directory in a -// platform sematically consistent way. +// platform semantically consistent way. func normaliseWorkdir(current string, requested string) (string, error) { if requested == "" { - return "", fmt.Errorf("cannot normalise nothing") + return "", errors.New("cannot normalise nothing") } // `filepath.Clean` will replace "" with "." so skip in that case diff --git a/components/engine/builder/dockerfile/parser/line_parsers.go b/components/engine/builder/dockerfile/parser/line_parsers.go index d2bf2b01b1..9b4a4c59f9 100644 --- a/components/engine/builder/dockerfile/parser/line_parsers.go +++ b/components/engine/builder/dockerfile/parser/line_parsers.go @@ -252,7 +252,7 @@ func parseStringsWhitespaceDelimited(rest string, d *Directive) (*Node, map[stri return rootnode, nil, nil } -// parsestring just wraps the string in quotes and returns a working node. +// parseString just wraps the string in quotes and returns a working node. func parseString(rest string, d *Directive) (*Node, map[string]bool, error) { if rest == "" { return nil, nil, nil diff --git a/components/engine/builder/dockerfile/parser/parser_test.go b/components/engine/builder/dockerfile/parser/parser_test.go index e8e26961de..ee9461c823 100644 --- a/components/engine/builder/dockerfile/parser/parser_test.go +++ b/components/engine/builder/dockerfile/parser/parser_test.go @@ -152,7 +152,7 @@ func TestLineInformation(t *testing.T) { if ast.StartLine != 5 || ast.EndLine != 31 { fmt.Fprintf(os.Stderr, "Wrong root line information: expected(%d-%d), actual(%d-%d)\n", 5, 31, ast.StartLine, ast.EndLine) - t.Fatalf("Root line information doesn't match result.") + t.Fatal("Root line information doesn't match result.") } if len(ast.Children) != 3 { fmt.Fprintf(os.Stderr, "Wrong number of child: expected(%d), actual(%d)\n", 3, len(ast.Children)) @@ -167,7 +167,7 @@ func TestLineInformation(t *testing.T) { if child.StartLine != expected[i][0] || child.EndLine != expected[i][1] { t.Logf("Wrong line information for child %d: expected(%d-%d), actual(%d-%d)\n", i, expected[i][0], expected[i][1], child.StartLine, child.EndLine) - t.Fatalf("Root line information doesn't match result.") + t.Fatal("Root line information doesn't match result.") } } } diff --git a/components/engine/builder/dockerignore/dockerignore_test.go b/components/engine/builder/dockerignore/dockerignore_test.go index 612a1399cd..948f9d886b 100644 --- a/components/engine/builder/dockerignore/dockerignore_test.go +++ b/components/engine/builder/dockerignore/dockerignore_test.go @@ -43,15 +43,15 @@ func TestReadAll(t *testing.T) { } if di[0] != "test1" { - t.Fatalf("First element is not test1") + t.Fatal("First element is not test1") } if di[1] != "/test2" { - t.Fatalf("Second element is not /test2") + t.Fatal("Second element is not /test2") } if di[2] != "/a/file/here" { - t.Fatalf("Third element is not /a/file/here") + t.Fatal("Third element is not /a/file/here") } if di[3] != "lastfile" { - t.Fatalf("Fourth element is not lastfile") + t.Fatal("Fourth element is not lastfile") } } diff --git a/components/engine/builder/remote_test.go b/components/engine/builder/remote_test.go index 588eb85015..b44b59fbe5 100644 --- a/components/engine/builder/remote_test.go +++ b/components/engine/builder/remote_test.go @@ -53,7 +53,7 @@ func TestInspectEmptyResponse(t *testing.T) { br := ioutil.NopCloser(bytes.NewReader([]byte(""))) contentType, bReader, err := inspectResponse(ct, br, 0) if err == nil { - t.Fatalf("Should have generated an error for an empty response") + t.Fatal("Should have generated an error for an empty response") } if contentType != "application/octet-stream" { t.Fatalf("Content type should be 'application/octet-stream' but is %q", contentType) @@ -206,13 +206,13 @@ func TestMakeRemoteContext(t *testing.T) { } if remoteContext == nil { - t.Fatalf("Remote context should not be nil") + t.Fatal("Remote context should not be nil") } tarSumCtx, ok := remoteContext.(*tarSumContext) if !ok { - t.Fatalf("Cast error, remote context should be casted to tarSumContext") + t.Fatal("Cast error, remote context should be casted to tarSumContext") } fileInfoSums := tarSumCtx.sums diff --git a/components/engine/builder/tarsum_test.go b/components/engine/builder/tarsum_test.go index 278e5830de..b3a0876b34 100644 --- a/components/engine/builder/tarsum_test.go +++ b/components/engine/builder/tarsum_test.go @@ -39,7 +39,7 @@ func TestCloseRootDirectory(t *testing.T) { _, err = os.Stat(contextDir) if !os.IsNotExist(err) { - t.Fatalf("Directory should not exist at this point") + t.Fatal("Directory should not exist at this point") defer os.RemoveAll(contextDir) } } @@ -157,7 +157,7 @@ func TestStatNotExisting(t *testing.T) { } if fileInfo != nil { - t.Fatalf("File info should be nil") + t.Fatal("File info should be nil") } if !os.IsNotExist(err) { @@ -188,7 +188,7 @@ func TestRemoveDirectory(t *testing.T) { _, err = os.Stat(contextSubdir) if !os.IsNotExist(err) { - t.Fatalf("Directory should not exist at this point") + t.Fatal("Directory should not exist at this point") } } @@ -213,7 +213,7 @@ func TestMakeTarSumContext(t *testing.T) { } if tarSum == nil { - t.Fatalf("Tar sum context should not be nil") + t.Fatal("Tar sum context should not be nil") } } @@ -260,6 +260,6 @@ func TestWalkWithError(t *testing.T) { err := tarSum.Walk(contextSubdir, walkFun) if err == nil { - t.Fatalf("Error should not be nil") + t.Fatal("Error should not be nil") } } diff --git a/components/engine/cli/command/container/opts_test.go b/components/engine/cli/command/container/opts_test.go index d0655069e9..725c9beb42 100644 --- a/components/engine/cli/command/container/opts_test.go +++ b/components/engine/cli/command/container/opts_test.go @@ -28,7 +28,7 @@ func TestValidateAttach(t *testing.T) { "STDERR", } if _, err := validateAttach("invalid"); err == nil { - t.Fatalf("Expected error with [valid streams are STDIN, STDOUT and STDERR], got nothing") + t.Fatal("Expected error with [valid streams are STDIN, STDOUT and STDERR], got nothing") } for _, attach := range valid { @@ -96,28 +96,28 @@ func TestParseRunAttach(t *testing.T) { } if _, _, err := parsetest(t, "-a"); err == nil { - t.Fatalf("Error parsing attach flags, `-a` should be an error but is not") + t.Fatal("Error parsing attach flags, `-a` should be an error but is not") } if _, _, err := parsetest(t, "-a invalid"); err == nil { - t.Fatalf("Error parsing attach flags, `-a invalid` should be an error but is not") + t.Fatal("Error parsing attach flags, `-a invalid` should be an error but is not") } if _, _, err := parsetest(t, "-a invalid -a stdout"); err == nil { - t.Fatalf("Error parsing attach flags, `-a stdout -a invalid` should be an error but is not") + t.Fatal("Error parsing attach flags, `-a stdout -a invalid` should be an error but is not") } if _, _, err := parsetest(t, "-a stdout -a stderr -d"); err == nil { - t.Fatalf("Error parsing attach flags, `-a stdout -a stderr -d` should be an error but is not") + t.Fatal("Error parsing attach flags, `-a stdout -a stderr -d` should be an error but is not") } if _, _, err := parsetest(t, "-a stdin -d"); err == nil { - t.Fatalf("Error parsing attach flags, `-a stdin -d` should be an error but is not") + t.Fatal("Error parsing attach flags, `-a stdin -d` should be an error but is not") } if _, _, err := parsetest(t, "-a stdout -d"); err == nil { - t.Fatalf("Error parsing attach flags, `-a stdout -d` should be an error but is not") + t.Fatal("Error parsing attach flags, `-a stdout -d` should be an error but is not") } if _, _, err := parsetest(t, "-a stderr -d"); err == nil { - t.Fatalf("Error parsing attach flags, `-a stderr -d` should be an error but is not") + t.Fatal("Error parsing attach flags, `-a stderr -d` should be an error but is not") } if _, _, err := parsetest(t, "-d --rm"); err == nil { - t.Fatalf("Error parsing attach flags, `-d --rm` should be an error but is not") + t.Fatal("Error parsing attach flags, `-d --rm` should be an error but is not") } } diff --git a/components/engine/daemon/daemon_linux_test.go b/components/engine/daemon/daemon_linux_test.go index c40b13ba4c..c7d5117195 100644 --- a/components/engine/daemon/daemon_linux_test.go +++ b/components/engine/daemon/daemon_linux_test.go @@ -62,7 +62,7 @@ func TestCleanupMounts(t *testing.T) { d.cleanupMountsFromReaderByID(strings.NewReader(mountsFixture), "", unmount) if unmounted != 1 { - t.Fatalf("Expected to unmount the shm (and the shm only)") + t.Fatal("Expected to unmount the shm (and the shm only)") } } @@ -83,7 +83,7 @@ func TestCleanupMountsByID(t *testing.T) { d.cleanupMountsFromReaderByID(strings.NewReader(mountsFixture), "03ca4b49e71f1e49a41108829f4d5c70ac95934526e2af8984a1f65f1de0715d", unmount) if unmounted != 1 { - t.Fatalf("Expected to unmount the auf root (and that only)") + t.Fatal("Expected to unmount the auf root (and that only)") } } @@ -99,6 +99,6 @@ func TestNotCleanupMounts(t *testing.T) { mountInfo := `234 232 0:59 / /dev/shm rw,nosuid,nodev,noexec,relatime - tmpfs shm rw,size=65536k` d.cleanupMountsFromReaderByID(strings.NewReader(mountInfo), "", unmount) if unmounted { - t.Fatalf("Expected not to clean up /dev/shm") + t.Fatal("Expected not to clean up /dev/shm") } } diff --git a/components/engine/daemon/daemon_unix_test.go b/components/engine/daemon/daemon_unix_test.go index ebb0a0186a..e8afe629e0 100644 --- a/components/engine/daemon/daemon_unix_test.go +++ b/components/engine/daemon/daemon_unix_test.go @@ -229,7 +229,7 @@ func TestNetworkOptions(t *testing.T) { } if _, err := daemon.networkOptions(dconfigWrong, nil, nil); err == nil { - t.Fatalf("Expected networkOptions error, got nil") + t.Fatal("Expected networkOptions error, got nil") } } diff --git a/components/engine/daemon/discovery/discovery_test.go b/components/engine/daemon/discovery/discovery_test.go index ae409c7fd1..7b5942f491 100644 --- a/components/engine/daemon/discovery/discovery_test.go +++ b/components/engine/daemon/discovery/discovery_test.go @@ -9,37 +9,37 @@ func TestDiscoveryOpts(t *testing.T) { clusterOpts := map[string]string{"discovery.heartbeat": "10", "discovery.ttl": "5"} heartbeat, ttl, err := discoveryOpts(clusterOpts) if err == nil { - t.Fatalf("discovery.ttl < discovery.heartbeat must fail") + t.Fatal("discovery.ttl < discovery.heartbeat must fail") } clusterOpts = map[string]string{"discovery.heartbeat": "10", "discovery.ttl": "10"} heartbeat, ttl, err = discoveryOpts(clusterOpts) if err == nil { - t.Fatalf("discovery.ttl == discovery.heartbeat must fail") + t.Fatal("discovery.ttl == discovery.heartbeat must fail") } clusterOpts = map[string]string{"discovery.heartbeat": "-10", "discovery.ttl": "10"} heartbeat, ttl, err = discoveryOpts(clusterOpts) if err == nil { - t.Fatalf("negative discovery.heartbeat must fail") + t.Fatal("negative discovery.heartbeat must fail") } clusterOpts = map[string]string{"discovery.heartbeat": "10", "discovery.ttl": "-10"} heartbeat, ttl, err = discoveryOpts(clusterOpts) if err == nil { - t.Fatalf("negative discovery.ttl must fail") + t.Fatal("negative discovery.ttl must fail") } clusterOpts = map[string]string{"discovery.heartbeat": "invalid"} heartbeat, ttl, err = discoveryOpts(clusterOpts) if err == nil { - t.Fatalf("invalid discovery.heartbeat must fail") + t.Fatal("invalid discovery.heartbeat must fail") } clusterOpts = map[string]string{"discovery.ttl": "invalid"} heartbeat, ttl, err = discoveryOpts(clusterOpts) if err == nil { - t.Fatalf("invalid discovery.ttl must fail") + t.Fatal("invalid discovery.ttl must fail") } clusterOpts = map[string]string{"discovery.heartbeat": "10", "discovery.ttl": "20"} diff --git a/components/engine/daemon/events_test.go b/components/engine/daemon/events_test.go index 2dbcc27dfc..aa78664b23 100644 --- a/components/engine/daemon/events_test.go +++ b/components/engine/daemon/events_test.go @@ -89,6 +89,6 @@ func validateTestAttributes(t *testing.T, l chan interface{}, expectedAttributes } } case <-time.After(10 * time.Second): - t.Fatalf("LogEvent test timed out") + t.Fatal("LogEvent test timed out") } } diff --git a/components/engine/daemon/graphdriver/aufs/aufs_test.go b/components/engine/daemon/graphdriver/aufs/aufs_test.go index e8b2be8c56..baf0fd89f2 100644 --- a/components/engine/daemon/graphdriver/aufs/aufs_test.go +++ b/components/engine/daemon/graphdriver/aufs/aufs_test.go @@ -56,7 +56,7 @@ func TestNewDriver(t *testing.T) { d := testInit(tmp, t) defer os.RemoveAll(tmp) if d == nil { - t.Fatalf("Driver should not be nil") + t.Fatal("Driver should not be nil") } } @@ -206,7 +206,7 @@ func TestMountedFalseResponse(t *testing.T) { } if response != false { - t.Fatalf("Response if dir id 1 is mounted should be false") + t.Fatal("Response if dir id 1 is mounted should be false") } } @@ -233,7 +233,7 @@ func TestMountedTrueResponse(t *testing.T) { } if response != true { - t.Fatalf("Response if dir id 2 is mounted should be true") + t.Fatal("Response if dir id 2 is mounted should be true") } } @@ -299,7 +299,7 @@ func TestRemoveMountedDir(t *testing.T) { } if !mounted { - t.Fatalf("Dir id 2 should be mounted") + t.Fatal("Dir id 2 should be mounted") } if err := d.Remove("2"); err != nil { @@ -312,7 +312,7 @@ func TestCreateWithInvalidParent(t *testing.T) { defer os.RemoveAll(tmp) if err := d.Create("1", "docker", nil); err == nil { - t.Fatalf("Error should not be nil with parent does not exist") + t.Fatal("Error should not be nil with parent does not exist") } } @@ -346,7 +346,7 @@ func TestGetDiff(t *testing.T) { t.Fatal(err) } if a == nil { - t.Fatalf("Archive should not be nil") + t.Fatal("Archive should not be nil") } } diff --git a/components/engine/daemon/graphdriver/devmapper/devmapper_test.go b/components/engine/daemon/graphdriver/devmapper/devmapper_test.go index 006450adcc..c5be97ae3f 100644 --- a/components/engine/daemon/graphdriver/devmapper/devmapper_test.go +++ b/components/engine/daemon/graphdriver/devmapper/devmapper_test.go @@ -59,7 +59,7 @@ func testChangeLoopBackSize(t *testing.T, delta, expectDataSize, expectMetaDataS defer graphtest.PutDriver(t) // make sure data or metadata loopback size are the default size if s := driver.DeviceSet.Status(); s.Data.Total != uint64(defaultDataLoopbackSize) || s.Metadata.Total != uint64(defaultMetaDataLoopbackSize) { - t.Fatalf("data or metadata loop back size is incorrect") + t.Fatal("data or metadata loop back size is incorrect") } if err := driver.Cleanup(); err != nil { t.Fatal(err) @@ -74,7 +74,7 @@ func testChangeLoopBackSize(t *testing.T, delta, expectDataSize, expectMetaDataS } driver = d.(*graphdriver.NaiveDiffDriver).ProtoDriver.(*Driver) if s := driver.DeviceSet.Status(); s.Data.Total != uint64(expectDataSize) || s.Metadata.Total != uint64(expectMetaDataSize) { - t.Fatalf("data or metadata loop back size is incorrect") + t.Fatal("data or metadata loop back size is incorrect") } if err := driver.Cleanup(); err != nil { t.Fatal(err) @@ -104,7 +104,7 @@ func TestDevmapperLockReleasedDeviceDeletion(t *testing.T) { // function return and we are deadlocked. Release lock // here so that cleanup could succeed and fail the test. driver.DeviceSet.Unlock() - t.Fatalf("Could not acquire devices lock after call to cleanupDeletedDevices()") + t.Fatal("Could not acquire devices lock after call to cleanupDeletedDevices()") case <-doneChan: } } diff --git a/components/engine/daemon/links/links_test.go b/components/engine/daemon/links/links_test.go index 52c34ec7ba..b852c44435 100644 --- a/components/engine/daemon/links/links_test.go +++ b/components/engine/daemon/links/links_test.go @@ -33,7 +33,7 @@ func TestLinkNaming(t *testing.T) { value, ok := env["DOCKER_1_PORT"] if !ok { - t.Fatalf("DOCKER_1_PORT not found in env") + t.Fatal("DOCKER_1_PORT not found in env") } if value != "tcp://172.0.17.2:6379" { diff --git a/components/engine/daemon/logger/copier_test.go b/components/engine/daemon/logger/copier_test.go index e6975e2d84..4210022dcd 100644 --- a/components/engine/daemon/logger/copier_test.go +++ b/components/engine/daemon/logger/copier_test.go @@ -200,7 +200,7 @@ func TestCopierSlow(t *testing.T) { c.Close() select { case <-time.After(200 * time.Millisecond): - t.Fatalf("failed to exit in time after the copier is closed") + t.Fatal("failed to exit in time after the copier is closed") case <-wait: } } diff --git a/components/engine/daemon/reload_test.go b/components/engine/daemon/reload_test.go index f338c1c8fc..ba1fd02471 100644 --- a/components/engine/daemon/reload_test.go +++ b/components/engine/daemon/reload_test.go @@ -247,7 +247,7 @@ func TestDaemonReloadNotAffectOthers(t *testing.T) { } debug := daemon.configStore.Debug if !debug { - t.Fatalf("Expected debug 'enabled', got 'disabled'") + t.Fatal("Expected debug 'enabled', got 'disabled'") } }