Signed-off-by: Helen Xie <chenjg@harmonycloud.cn>
| ... | ... |
@@ -286,7 +286,7 @@ func TestLoadOrCreateTrustKeyInvalidKeyFile(t *testing.T) {
|
| 286 | 286 |
} |
| 287 | 287 |
|
| 288 | 288 |
if _, err := LoadOrCreateTrustKey(tmpKeyFile.Name()); err == nil {
|
| 289 |
- t.Fatalf("expected an error, got nothing.")
|
|
| 289 |
+ t.Fatal("expected an error, got nothing.")
|
|
| 290 | 290 |
} |
| 291 | 291 |
|
| 292 | 292 |
} |
| ... | ... |
@@ -13,7 +13,7 @@ import ( |
| 13 | 13 |
func TestVersionMiddleware(t *testing.T) {
|
| 14 | 14 |
handler := func(ctx context.Context, w http.ResponseWriter, r *http.Request, vars map[string]string) error {
|
| 15 | 15 |
if httputils.VersionFromContext(ctx) == "" {
|
| 16 |
- t.Fatalf("Expected version, got empty string")
|
|
| 16 |
+ t.Fatal("Expected version, got empty string")
|
|
| 17 | 17 |
} |
| 18 | 18 |
return nil |
| 19 | 19 |
} |
| ... | ... |
@@ -34,7 +34,7 @@ func TestVersionMiddleware(t *testing.T) {
|
| 34 | 34 |
func TestVersionMiddlewareWithErrors(t *testing.T) {
|
| 35 | 35 |
handler := func(ctx context.Context, w http.ResponseWriter, r *http.Request, vars map[string]string) error {
|
| 36 | 36 |
if httputils.VersionFromContext(ctx) == "" {
|
| 37 |
- t.Fatalf("Expected version, got empty string")
|
|
| 37 |
+ t.Fatal("Expected version, got empty string")
|
|
| 38 | 38 |
} |
| 39 | 39 |
return nil |
| 40 | 40 |
} |
| ... | ... |
@@ -1,7 +1,7 @@ |
| 1 | 1 |
package filters |
| 2 | 2 |
|
| 3 | 3 |
import ( |
| 4 |
- "fmt" |
|
| 4 |
+ "errors" |
|
| 5 | 5 |
"testing" |
| 6 | 6 |
) |
| 7 | 7 |
|
| ... | ... |
@@ -284,18 +284,18 @@ func TestDel(t *testing.T) {
|
| 284 | 284 |
f.Del("status", "running")
|
| 285 | 285 |
v := f.fields["status"] |
| 286 | 286 |
if v["running"] {
|
| 287 |
- t.Fatalf("Expected to not include a running status filter, got true")
|
|
| 287 |
+ t.Fatal("Expected to not include a running status filter, got true")
|
|
| 288 | 288 |
} |
| 289 | 289 |
} |
| 290 | 290 |
|
| 291 | 291 |
func TestLen(t *testing.T) {
|
| 292 | 292 |
f := NewArgs() |
| 293 | 293 |
if f.Len() != 0 {
|
| 294 |
- t.Fatalf("Expected to not include any field")
|
|
| 294 |
+ t.Fatal("Expected to not include any field")
|
|
| 295 | 295 |
} |
| 296 | 296 |
f.Add("status", "running")
|
| 297 | 297 |
if f.Len() != 1 {
|
| 298 |
- t.Fatalf("Expected to include one field")
|
|
| 298 |
+ t.Fatal("Expected to include one field")
|
|
| 299 | 299 |
} |
| 300 | 300 |
} |
| 301 | 301 |
|
| ... | ... |
@@ -303,18 +303,18 @@ func TestExactMatch(t *testing.T) {
|
| 303 | 303 |
f := NewArgs() |
| 304 | 304 |
|
| 305 | 305 |
if !f.ExactMatch("status", "running") {
|
| 306 |
- t.Fatalf("Expected to match `running` when there are no filters, got false")
|
|
| 306 |
+ t.Fatal("Expected to match `running` when there are no filters, got false")
|
|
| 307 | 307 |
} |
| 308 | 308 |
|
| 309 | 309 |
f.Add("status", "running")
|
| 310 | 310 |
f.Add("status", "pause*")
|
| 311 | 311 |
|
| 312 | 312 |
if !f.ExactMatch("status", "running") {
|
| 313 |
- t.Fatalf("Expected to match `running` with one of the filters, got false")
|
|
| 313 |
+ t.Fatal("Expected to match `running` with one of the filters, got false")
|
|
| 314 | 314 |
} |
| 315 | 315 |
|
| 316 | 316 |
if f.ExactMatch("status", "paused") {
|
| 317 |
- t.Fatalf("Expected to not match `paused` with one of the filters, got true")
|
|
| 317 |
+ t.Fatal("Expected to not match `paused` with one of the filters, got true")
|
|
| 318 | 318 |
} |
| 319 | 319 |
} |
| 320 | 320 |
|
| ... | ... |
@@ -322,33 +322,33 @@ func TestOnlyOneExactMatch(t *testing.T) {
|
| 322 | 322 |
f := NewArgs() |
| 323 | 323 |
|
| 324 | 324 |
if !f.UniqueExactMatch("status", "running") {
|
| 325 |
- t.Fatalf("Expected to match `running` when there are no filters, got false")
|
|
| 325 |
+ t.Fatal("Expected to match `running` when there are no filters, got false")
|
|
| 326 | 326 |
} |
| 327 | 327 |
|
| 328 | 328 |
f.Add("status", "running")
|
| 329 | 329 |
|
| 330 | 330 |
if !f.UniqueExactMatch("status", "running") {
|
| 331 |
- t.Fatalf("Expected to match `running` with one of the filters, got false")
|
|
| 331 |
+ t.Fatal("Expected to match `running` with one of the filters, got false")
|
|
| 332 | 332 |
} |
| 333 | 333 |
|
| 334 | 334 |
if f.UniqueExactMatch("status", "paused") {
|
| 335 |
- t.Fatalf("Expected to not match `paused` with one of the filters, got true")
|
|
| 335 |
+ t.Fatal("Expected to not match `paused` with one of the filters, got true")
|
|
| 336 | 336 |
} |
| 337 | 337 |
|
| 338 | 338 |
f.Add("status", "pause")
|
| 339 | 339 |
if f.UniqueExactMatch("status", "running") {
|
| 340 |
- t.Fatalf("Expected to not match only `running` with two filters, got true")
|
|
| 340 |
+ t.Fatal("Expected to not match only `running` with two filters, got true")
|
|
| 341 | 341 |
} |
| 342 | 342 |
} |
| 343 | 343 |
|
| 344 | 344 |
func TestInclude(t *testing.T) {
|
| 345 | 345 |
f := NewArgs() |
| 346 | 346 |
if f.Include("status") {
|
| 347 |
- t.Fatalf("Expected to not include a status key, got true")
|
|
| 347 |
+ t.Fatal("Expected to not include a status key, got true")
|
|
| 348 | 348 |
} |
| 349 | 349 |
f.Add("status", "running")
|
| 350 | 350 |
if !f.Include("status") {
|
| 351 |
- t.Fatalf("Expected to include a status key, got false")
|
|
| 351 |
+ t.Fatal("Expected to include a status key, got false")
|
|
| 352 | 352 |
} |
| 353 | 353 |
} |
| 354 | 354 |
|
| ... | ... |
@@ -367,7 +367,7 @@ func TestValidate(t *testing.T) {
|
| 367 | 367 |
|
| 368 | 368 |
f.Add("bogus", "running")
|
| 369 | 369 |
if err := f.Validate(valid); err == nil {
|
| 370 |
- t.Fatalf("Expected to return an error, got nil")
|
|
| 370 |
+ t.Fatal("Expected to return an error, got nil")
|
|
| 371 | 371 |
} |
| 372 | 372 |
} |
| 373 | 373 |
|
| ... | ... |
@@ -384,14 +384,14 @@ func TestWalkValues(t *testing.T) {
|
| 384 | 384 |
}) |
| 385 | 385 |
|
| 386 | 386 |
err := f.WalkValues("status", func(value string) error {
|
| 387 |
- return fmt.Errorf("return")
|
|
| 387 |
+ return errors.New("return")
|
|
| 388 | 388 |
}) |
| 389 | 389 |
if err == nil {
|
| 390 |
- t.Fatalf("Expected to get an error, got nil")
|
|
| 390 |
+ t.Fatal("Expected to get an error, got nil")
|
|
| 391 | 391 |
} |
| 392 | 392 |
|
| 393 | 393 |
err = f.WalkValues("foo", func(value string) error {
|
| 394 |
- return fmt.Errorf("return")
|
|
| 394 |
+ return errors.New("return")
|
|
| 395 | 395 |
}) |
| 396 | 396 |
if err != nil {
|
| 397 | 397 |
t.Fatalf("Expected to not iterate when the field doesn't exist, got %v", err)
|
| ... | ... |
@@ -3,16 +3,17 @@ |
| 3 | 3 |
package dockerfile |
| 4 | 4 |
|
| 5 | 5 |
import ( |
| 6 |
+ "errors" |
|
| 6 | 7 |
"fmt" |
| 7 | 8 |
"os" |
| 8 | 9 |
"path/filepath" |
| 9 | 10 |
) |
| 10 | 11 |
|
| 11 | 12 |
// normaliseWorkdir normalises a user requested working directory in a |
| 12 |
-// platform sematically consistent way. |
|
| 13 |
+// platform semantically consistent way. |
|
| 13 | 14 |
func normaliseWorkdir(current string, requested string) (string, error) {
|
| 14 | 15 |
if requested == "" {
|
| 15 |
- return "", fmt.Errorf("cannot normalise nothing")
|
|
| 16 |
+ return "", errors.New("cannot normalise nothing")
|
|
| 16 | 17 |
} |
| 17 | 18 |
current = filepath.FromSlash(current) |
| 18 | 19 |
requested = filepath.FromSlash(requested) |
| ... | ... |
@@ -1,6 +1,7 @@ |
| 1 | 1 |
package dockerfile |
| 2 | 2 |
|
| 3 | 3 |
import ( |
| 4 |
+ "errors" |
|
| 4 | 5 |
"fmt" |
| 5 | 6 |
"os" |
| 6 | 7 |
"path/filepath" |
| ... | ... |
@@ -13,10 +14,10 @@ import ( |
| 13 | 13 |
var pattern = regexp.MustCompile(`^[a-zA-Z]:\.$`) |
| 14 | 14 |
|
| 15 | 15 |
// normaliseWorkdir normalises a user requested working directory in a |
| 16 |
-// platform sematically consistent way. |
|
| 16 |
+// platform semantically consistent way. |
|
| 17 | 17 |
func normaliseWorkdir(current string, requested string) (string, error) {
|
| 18 | 18 |
if requested == "" {
|
| 19 |
- return "", fmt.Errorf("cannot normalise nothing")
|
|
| 19 |
+ return "", errors.New("cannot normalise nothing")
|
|
| 20 | 20 |
} |
| 21 | 21 |
|
| 22 | 22 |
// `filepath.Clean` will replace "" with "." so skip in that case |
| ... | ... |
@@ -252,7 +252,7 @@ func parseStringsWhitespaceDelimited(rest string, d *Directive) (*Node, map[stri |
| 252 | 252 |
return rootnode, nil, nil |
| 253 | 253 |
} |
| 254 | 254 |
|
| 255 |
-// parsestring just wraps the string in quotes and returns a working node. |
|
| 255 |
+// parseString just wraps the string in quotes and returns a working node. |
|
| 256 | 256 |
func parseString(rest string, d *Directive) (*Node, map[string]bool, error) {
|
| 257 | 257 |
if rest == "" {
|
| 258 | 258 |
return nil, nil, nil |
| ... | ... |
@@ -152,7 +152,7 @@ func TestLineInformation(t *testing.T) {
|
| 152 | 152 |
|
| 153 | 153 |
if ast.StartLine != 5 || ast.EndLine != 31 {
|
| 154 | 154 |
fmt.Fprintf(os.Stderr, "Wrong root line information: expected(%d-%d), actual(%d-%d)\n", 5, 31, ast.StartLine, ast.EndLine) |
| 155 |
- t.Fatalf("Root line information doesn't match result.")
|
|
| 155 |
+ t.Fatal("Root line information doesn't match result.")
|
|
| 156 | 156 |
} |
| 157 | 157 |
if len(ast.Children) != 3 {
|
| 158 | 158 |
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) {
|
| 167 | 167 |
if child.StartLine != expected[i][0] || child.EndLine != expected[i][1] {
|
| 168 | 168 |
t.Logf("Wrong line information for child %d: expected(%d-%d), actual(%d-%d)\n",
|
| 169 | 169 |
i, expected[i][0], expected[i][1], child.StartLine, child.EndLine) |
| 170 |
- t.Fatalf("Root line information doesn't match result.")
|
|
| 170 |
+ t.Fatal("Root line information doesn't match result.")
|
|
| 171 | 171 |
} |
| 172 | 172 |
} |
| 173 | 173 |
} |
| ... | ... |
@@ -43,15 +43,15 @@ func TestReadAll(t *testing.T) {
|
| 43 | 43 |
} |
| 44 | 44 |
|
| 45 | 45 |
if di[0] != "test1" {
|
| 46 |
- t.Fatalf("First element is not test1")
|
|
| 46 |
+ t.Fatal("First element is not test1")
|
|
| 47 | 47 |
} |
| 48 | 48 |
if di[1] != "/test2" {
|
| 49 |
- t.Fatalf("Second element is not /test2")
|
|
| 49 |
+ t.Fatal("Second element is not /test2")
|
|
| 50 | 50 |
} |
| 51 | 51 |
if di[2] != "/a/file/here" {
|
| 52 |
- t.Fatalf("Third element is not /a/file/here")
|
|
| 52 |
+ t.Fatal("Third element is not /a/file/here")
|
|
| 53 | 53 |
} |
| 54 | 54 |
if di[3] != "lastfile" {
|
| 55 |
- t.Fatalf("Fourth element is not lastfile")
|
|
| 55 |
+ t.Fatal("Fourth element is not lastfile")
|
|
| 56 | 56 |
} |
| 57 | 57 |
} |
| ... | ... |
@@ -53,7 +53,7 @@ func TestInspectEmptyResponse(t *testing.T) {
|
| 53 | 53 |
br := ioutil.NopCloser(bytes.NewReader([]byte("")))
|
| 54 | 54 |
contentType, bReader, err := inspectResponse(ct, br, 0) |
| 55 | 55 |
if err == nil {
|
| 56 |
- t.Fatalf("Should have generated an error for an empty response")
|
|
| 56 |
+ t.Fatal("Should have generated an error for an empty response")
|
|
| 57 | 57 |
} |
| 58 | 58 |
if contentType != "application/octet-stream" {
|
| 59 | 59 |
t.Fatalf("Content type should be 'application/octet-stream' but is %q", contentType)
|
| ... | ... |
@@ -206,13 +206,13 @@ func TestMakeRemoteContext(t *testing.T) {
|
| 206 | 206 |
} |
| 207 | 207 |
|
| 208 | 208 |
if remoteContext == nil {
|
| 209 |
- t.Fatalf("Remote context should not be nil")
|
|
| 209 |
+ t.Fatal("Remote context should not be nil")
|
|
| 210 | 210 |
} |
| 211 | 211 |
|
| 212 | 212 |
tarSumCtx, ok := remoteContext.(*tarSumContext) |
| 213 | 213 |
|
| 214 | 214 |
if !ok {
|
| 215 |
- t.Fatalf("Cast error, remote context should be casted to tarSumContext")
|
|
| 215 |
+ t.Fatal("Cast error, remote context should be casted to tarSumContext")
|
|
| 216 | 216 |
} |
| 217 | 217 |
|
| 218 | 218 |
fileInfoSums := tarSumCtx.sums |
| ... | ... |
@@ -39,7 +39,7 @@ func TestCloseRootDirectory(t *testing.T) {
|
| 39 | 39 |
_, err = os.Stat(contextDir) |
| 40 | 40 |
|
| 41 | 41 |
if !os.IsNotExist(err) {
|
| 42 |
- t.Fatalf("Directory should not exist at this point")
|
|
| 42 |
+ t.Fatal("Directory should not exist at this point")
|
|
| 43 | 43 |
defer os.RemoveAll(contextDir) |
| 44 | 44 |
} |
| 45 | 45 |
} |
| ... | ... |
@@ -157,7 +157,7 @@ func TestStatNotExisting(t *testing.T) {
|
| 157 | 157 |
} |
| 158 | 158 |
|
| 159 | 159 |
if fileInfo != nil {
|
| 160 |
- t.Fatalf("File info should be nil")
|
|
| 160 |
+ t.Fatal("File info should be nil")
|
|
| 161 | 161 |
} |
| 162 | 162 |
|
| 163 | 163 |
if !os.IsNotExist(err) {
|
| ... | ... |
@@ -188,7 +188,7 @@ func TestRemoveDirectory(t *testing.T) {
|
| 188 | 188 |
_, err = os.Stat(contextSubdir) |
| 189 | 189 |
|
| 190 | 190 |
if !os.IsNotExist(err) {
|
| 191 |
- t.Fatalf("Directory should not exist at this point")
|
|
| 191 |
+ t.Fatal("Directory should not exist at this point")
|
|
| 192 | 192 |
} |
| 193 | 193 |
} |
| 194 | 194 |
|
| ... | ... |
@@ -213,7 +213,7 @@ func TestMakeTarSumContext(t *testing.T) {
|
| 213 | 213 |
} |
| 214 | 214 |
|
| 215 | 215 |
if tarSum == nil {
|
| 216 |
- t.Fatalf("Tar sum context should not be nil")
|
|
| 216 |
+ t.Fatal("Tar sum context should not be nil")
|
|
| 217 | 217 |
} |
| 218 | 218 |
} |
| 219 | 219 |
|
| ... | ... |
@@ -260,6 +260,6 @@ func TestWalkWithError(t *testing.T) {
|
| 260 | 260 |
err := tarSum.Walk(contextSubdir, walkFun) |
| 261 | 261 |
|
| 262 | 262 |
if err == nil {
|
| 263 |
- t.Fatalf("Error should not be nil")
|
|
| 263 |
+ t.Fatal("Error should not be nil")
|
|
| 264 | 264 |
} |
| 265 | 265 |
} |
| ... | ... |
@@ -28,7 +28,7 @@ func TestValidateAttach(t *testing.T) {
|
| 28 | 28 |
"STDERR", |
| 29 | 29 |
} |
| 30 | 30 |
if _, err := validateAttach("invalid"); err == nil {
|
| 31 |
- t.Fatalf("Expected error with [valid streams are STDIN, STDOUT and STDERR], got nothing")
|
|
| 31 |
+ t.Fatal("Expected error with [valid streams are STDIN, STDOUT and STDERR], got nothing")
|
|
| 32 | 32 |
} |
| 33 | 33 |
|
| 34 | 34 |
for _, attach := range valid {
|
| ... | ... |
@@ -96,28 +96,28 @@ func TestParseRunAttach(t *testing.T) {
|
| 96 | 96 |
} |
| 97 | 97 |
|
| 98 | 98 |
if _, _, err := parsetest(t, "-a"); err == nil {
|
| 99 |
- t.Fatalf("Error parsing attach flags, `-a` should be an error but is not")
|
|
| 99 |
+ t.Fatal("Error parsing attach flags, `-a` should be an error but is not")
|
|
| 100 | 100 |
} |
| 101 | 101 |
if _, _, err := parsetest(t, "-a invalid"); err == nil {
|
| 102 |
- t.Fatalf("Error parsing attach flags, `-a invalid` should be an error but is not")
|
|
| 102 |
+ t.Fatal("Error parsing attach flags, `-a invalid` should be an error but is not")
|
|
| 103 | 103 |
} |
| 104 | 104 |
if _, _, err := parsetest(t, "-a invalid -a stdout"); err == nil {
|
| 105 |
- t.Fatalf("Error parsing attach flags, `-a stdout -a invalid` should be an error but is not")
|
|
| 105 |
+ t.Fatal("Error parsing attach flags, `-a stdout -a invalid` should be an error but is not")
|
|
| 106 | 106 |
} |
| 107 | 107 |
if _, _, err := parsetest(t, "-a stdout -a stderr -d"); err == nil {
|
| 108 |
- t.Fatalf("Error parsing attach flags, `-a stdout -a stderr -d` should be an error but is not")
|
|
| 108 |
+ t.Fatal("Error parsing attach flags, `-a stdout -a stderr -d` should be an error but is not")
|
|
| 109 | 109 |
} |
| 110 | 110 |
if _, _, err := parsetest(t, "-a stdin -d"); err == nil {
|
| 111 |
- t.Fatalf("Error parsing attach flags, `-a stdin -d` should be an error but is not")
|
|
| 111 |
+ t.Fatal("Error parsing attach flags, `-a stdin -d` should be an error but is not")
|
|
| 112 | 112 |
} |
| 113 | 113 |
if _, _, err := parsetest(t, "-a stdout -d"); err == nil {
|
| 114 |
- t.Fatalf("Error parsing attach flags, `-a stdout -d` should be an error but is not")
|
|
| 114 |
+ t.Fatal("Error parsing attach flags, `-a stdout -d` should be an error but is not")
|
|
| 115 | 115 |
} |
| 116 | 116 |
if _, _, err := parsetest(t, "-a stderr -d"); err == nil {
|
| 117 |
- t.Fatalf("Error parsing attach flags, `-a stderr -d` should be an error but is not")
|
|
| 117 |
+ t.Fatal("Error parsing attach flags, `-a stderr -d` should be an error but is not")
|
|
| 118 | 118 |
} |
| 119 | 119 |
if _, _, err := parsetest(t, "-d --rm"); err == nil {
|
| 120 |
- t.Fatalf("Error parsing attach flags, `-d --rm` should be an error but is not")
|
|
| 120 |
+ t.Fatal("Error parsing attach flags, `-d --rm` should be an error but is not")
|
|
| 121 | 121 |
} |
| 122 | 122 |
} |
| 123 | 123 |
|
| ... | ... |
@@ -62,7 +62,7 @@ func TestCleanupMounts(t *testing.T) {
|
| 62 | 62 |
d.cleanupMountsFromReaderByID(strings.NewReader(mountsFixture), "", unmount) |
| 63 | 63 |
|
| 64 | 64 |
if unmounted != 1 {
|
| 65 |
- t.Fatalf("Expected to unmount the shm (and the shm only)")
|
|
| 65 |
+ t.Fatal("Expected to unmount the shm (and the shm only)")
|
|
| 66 | 66 |
} |
| 67 | 67 |
} |
| 68 | 68 |
|
| ... | ... |
@@ -83,7 +83,7 @@ func TestCleanupMountsByID(t *testing.T) {
|
| 83 | 83 |
d.cleanupMountsFromReaderByID(strings.NewReader(mountsFixture), "03ca4b49e71f1e49a41108829f4d5c70ac95934526e2af8984a1f65f1de0715d", unmount) |
| 84 | 84 |
|
| 85 | 85 |
if unmounted != 1 {
|
| 86 |
- t.Fatalf("Expected to unmount the auf root (and that only)")
|
|
| 86 |
+ t.Fatal("Expected to unmount the auf root (and that only)")
|
|
| 87 | 87 |
} |
| 88 | 88 |
} |
| 89 | 89 |
|
| ... | ... |
@@ -99,6 +99,6 @@ func TestNotCleanupMounts(t *testing.T) {
|
| 99 | 99 |
mountInfo := `234 232 0:59 / /dev/shm rw,nosuid,nodev,noexec,relatime - tmpfs shm rw,size=65536k` |
| 100 | 100 |
d.cleanupMountsFromReaderByID(strings.NewReader(mountInfo), "", unmount) |
| 101 | 101 |
if unmounted {
|
| 102 |
- t.Fatalf("Expected not to clean up /dev/shm")
|
|
| 102 |
+ t.Fatal("Expected not to clean up /dev/shm")
|
|
| 103 | 103 |
} |
| 104 | 104 |
} |
| ... | ... |
@@ -229,7 +229,7 @@ func TestNetworkOptions(t *testing.T) {
|
| 229 | 229 |
} |
| 230 | 230 |
|
| 231 | 231 |
if _, err := daemon.networkOptions(dconfigWrong, nil, nil); err == nil {
|
| 232 |
- t.Fatalf("Expected networkOptions error, got nil")
|
|
| 232 |
+ t.Fatal("Expected networkOptions error, got nil")
|
|
| 233 | 233 |
} |
| 234 | 234 |
} |
| 235 | 235 |
|
| ... | ... |
@@ -9,37 +9,37 @@ func TestDiscoveryOpts(t *testing.T) {
|
| 9 | 9 |
clusterOpts := map[string]string{"discovery.heartbeat": "10", "discovery.ttl": "5"}
|
| 10 | 10 |
heartbeat, ttl, err := discoveryOpts(clusterOpts) |
| 11 | 11 |
if err == nil {
|
| 12 |
- t.Fatalf("discovery.ttl < discovery.heartbeat must fail")
|
|
| 12 |
+ t.Fatal("discovery.ttl < discovery.heartbeat must fail")
|
|
| 13 | 13 |
} |
| 14 | 14 |
|
| 15 | 15 |
clusterOpts = map[string]string{"discovery.heartbeat": "10", "discovery.ttl": "10"}
|
| 16 | 16 |
heartbeat, ttl, err = discoveryOpts(clusterOpts) |
| 17 | 17 |
if err == nil {
|
| 18 |
- t.Fatalf("discovery.ttl == discovery.heartbeat must fail")
|
|
| 18 |
+ t.Fatal("discovery.ttl == discovery.heartbeat must fail")
|
|
| 19 | 19 |
} |
| 20 | 20 |
|
| 21 | 21 |
clusterOpts = map[string]string{"discovery.heartbeat": "-10", "discovery.ttl": "10"}
|
| 22 | 22 |
heartbeat, ttl, err = discoveryOpts(clusterOpts) |
| 23 | 23 |
if err == nil {
|
| 24 |
- t.Fatalf("negative discovery.heartbeat must fail")
|
|
| 24 |
+ t.Fatal("negative discovery.heartbeat must fail")
|
|
| 25 | 25 |
} |
| 26 | 26 |
|
| 27 | 27 |
clusterOpts = map[string]string{"discovery.heartbeat": "10", "discovery.ttl": "-10"}
|
| 28 | 28 |
heartbeat, ttl, err = discoveryOpts(clusterOpts) |
| 29 | 29 |
if err == nil {
|
| 30 |
- t.Fatalf("negative discovery.ttl must fail")
|
|
| 30 |
+ t.Fatal("negative discovery.ttl must fail")
|
|
| 31 | 31 |
} |
| 32 | 32 |
|
| 33 | 33 |
clusterOpts = map[string]string{"discovery.heartbeat": "invalid"}
|
| 34 | 34 |
heartbeat, ttl, err = discoveryOpts(clusterOpts) |
| 35 | 35 |
if err == nil {
|
| 36 |
- t.Fatalf("invalid discovery.heartbeat must fail")
|
|
| 36 |
+ t.Fatal("invalid discovery.heartbeat must fail")
|
|
| 37 | 37 |
} |
| 38 | 38 |
|
| 39 | 39 |
clusterOpts = map[string]string{"discovery.ttl": "invalid"}
|
| 40 | 40 |
heartbeat, ttl, err = discoveryOpts(clusterOpts) |
| 41 | 41 |
if err == nil {
|
| 42 |
- t.Fatalf("invalid discovery.ttl must fail")
|
|
| 42 |
+ t.Fatal("invalid discovery.ttl must fail")
|
|
| 43 | 43 |
} |
| 44 | 44 |
|
| 45 | 45 |
clusterOpts = map[string]string{"discovery.heartbeat": "10", "discovery.ttl": "20"}
|
| ... | ... |
@@ -56,7 +56,7 @@ func TestNewDriver(t *testing.T) {
|
| 56 | 56 |
d := testInit(tmp, t) |
| 57 | 57 |
defer os.RemoveAll(tmp) |
| 58 | 58 |
if d == nil {
|
| 59 |
- t.Fatalf("Driver should not be nil")
|
|
| 59 |
+ t.Fatal("Driver should not be nil")
|
|
| 60 | 60 |
} |
| 61 | 61 |
} |
| 62 | 62 |
|
| ... | ... |
@@ -206,7 +206,7 @@ func TestMountedFalseResponse(t *testing.T) {
|
| 206 | 206 |
} |
| 207 | 207 |
|
| 208 | 208 |
if response != false {
|
| 209 |
- t.Fatalf("Response if dir id 1 is mounted should be false")
|
|
| 209 |
+ t.Fatal("Response if dir id 1 is mounted should be false")
|
|
| 210 | 210 |
} |
| 211 | 211 |
} |
| 212 | 212 |
|
| ... | ... |
@@ -233,7 +233,7 @@ func TestMountedTrueResponse(t *testing.T) {
|
| 233 | 233 |
} |
| 234 | 234 |
|
| 235 | 235 |
if response != true {
|
| 236 |
- t.Fatalf("Response if dir id 2 is mounted should be true")
|
|
| 236 |
+ t.Fatal("Response if dir id 2 is mounted should be true")
|
|
| 237 | 237 |
} |
| 238 | 238 |
} |
| 239 | 239 |
|
| ... | ... |
@@ -299,7 +299,7 @@ func TestRemoveMountedDir(t *testing.T) {
|
| 299 | 299 |
} |
| 300 | 300 |
|
| 301 | 301 |
if !mounted {
|
| 302 |
- t.Fatalf("Dir id 2 should be mounted")
|
|
| 302 |
+ t.Fatal("Dir id 2 should be mounted")
|
|
| 303 | 303 |
} |
| 304 | 304 |
|
| 305 | 305 |
if err := d.Remove("2"); err != nil {
|
| ... | ... |
@@ -312,7 +312,7 @@ func TestCreateWithInvalidParent(t *testing.T) {
|
| 312 | 312 |
defer os.RemoveAll(tmp) |
| 313 | 313 |
|
| 314 | 314 |
if err := d.Create("1", "docker", nil); err == nil {
|
| 315 |
- t.Fatalf("Error should not be nil with parent does not exist")
|
|
| 315 |
+ t.Fatal("Error should not be nil with parent does not exist")
|
|
| 316 | 316 |
} |
| 317 | 317 |
} |
| 318 | 318 |
|
| ... | ... |
@@ -346,7 +346,7 @@ func TestGetDiff(t *testing.T) {
|
| 346 | 346 |
t.Fatal(err) |
| 347 | 347 |
} |
| 348 | 348 |
if a == nil {
|
| 349 |
- t.Fatalf("Archive should not be nil")
|
|
| 349 |
+ t.Fatal("Archive should not be nil")
|
|
| 350 | 350 |
} |
| 351 | 351 |
} |
| 352 | 352 |
|
| ... | ... |
@@ -59,7 +59,7 @@ func testChangeLoopBackSize(t *testing.T, delta, expectDataSize, expectMetaDataS |
| 59 | 59 |
defer graphtest.PutDriver(t) |
| 60 | 60 |
// make sure data or metadata loopback size are the default size |
| 61 | 61 |
if s := driver.DeviceSet.Status(); s.Data.Total != uint64(defaultDataLoopbackSize) || s.Metadata.Total != uint64(defaultMetaDataLoopbackSize) {
|
| 62 |
- t.Fatalf("data or metadata loop back size is incorrect")
|
|
| 62 |
+ t.Fatal("data or metadata loop back size is incorrect")
|
|
| 63 | 63 |
} |
| 64 | 64 |
if err := driver.Cleanup(); err != nil {
|
| 65 | 65 |
t.Fatal(err) |
| ... | ... |
@@ -74,7 +74,7 @@ func testChangeLoopBackSize(t *testing.T, delta, expectDataSize, expectMetaDataS |
| 74 | 74 |
} |
| 75 | 75 |
driver = d.(*graphdriver.NaiveDiffDriver).ProtoDriver.(*Driver) |
| 76 | 76 |
if s := driver.DeviceSet.Status(); s.Data.Total != uint64(expectDataSize) || s.Metadata.Total != uint64(expectMetaDataSize) {
|
| 77 |
- t.Fatalf("data or metadata loop back size is incorrect")
|
|
| 77 |
+ t.Fatal("data or metadata loop back size is incorrect")
|
|
| 78 | 78 |
} |
| 79 | 79 |
if err := driver.Cleanup(); err != nil {
|
| 80 | 80 |
t.Fatal(err) |
| ... | ... |
@@ -104,7 +104,7 @@ func TestDevmapperLockReleasedDeviceDeletion(t *testing.T) {
|
| 104 | 104 |
// function return and we are deadlocked. Release lock |
| 105 | 105 |
// here so that cleanup could succeed and fail the test. |
| 106 | 106 |
driver.DeviceSet.Unlock() |
| 107 |
- t.Fatalf("Could not acquire devices lock after call to cleanupDeletedDevices()")
|
|
| 107 |
+ t.Fatal("Could not acquire devices lock after call to cleanupDeletedDevices()")
|
|
| 108 | 108 |
case <-doneChan: |
| 109 | 109 |
} |
| 110 | 110 |
} |
| ... | ... |
@@ -200,7 +200,7 @@ func TestCopierSlow(t *testing.T) {
|
| 200 | 200 |
c.Close() |
| 201 | 201 |
select {
|
| 202 | 202 |
case <-time.After(200 * time.Millisecond): |
| 203 |
- t.Fatalf("failed to exit in time after the copier is closed")
|
|
| 203 |
+ t.Fatal("failed to exit in time after the copier is closed")
|
|
| 204 | 204 |
case <-wait: |
| 205 | 205 |
} |
| 206 | 206 |
} |