Browse code

Replace '%s' in test utils

Docker-DCO-1.1-Signed-off-by: Jessica Frazelle <jess@docker.com> (github: jfrazelle)

Jessica Frazelle authored on 2014/10/15 02:59:38
Showing 1 changed files
... ...
@@ -44,7 +44,7 @@ func NewDaemon(t *testing.T) *Daemon {
44 44
 	dir := filepath.Join(dest, fmt.Sprintf("daemon%d", time.Now().Unix()))
45 45
 	daemonFolder, err := filepath.Abs(dir)
46 46
 	if err != nil {
47
-		t.Fatalf("Could not make '%s' an absolute path: %v", dir, err)
47
+		t.Fatalf("Could not make %q an absolute path: %v", dir, err)
48 48
 	}
49 49
 
50 50
 	if err := os.MkdirAll(filepath.Join(daemonFolder, "graph"), 0600); err != nil {
... ...
@@ -317,7 +317,7 @@ func imageExists(image string) error {
317 317
 	inspectCmd := exec.Command(dockerBinary, "inspect", image)
318 318
 	exitCode, err := runCommand(inspectCmd)
319 319
 	if exitCode != 0 && err == nil {
320
-		err = fmt.Errorf("couldn't find image '%s'", image)
320
+		err = fmt.Errorf("couldn't find image %q", image)
321 321
 	}
322 322
 	return err
323 323
 }
... ...
@@ -328,7 +328,7 @@ func pullImageIfNotExist(image string) (err error) {
328 328
 		_, exitCode, err := runCommandWithOutput(pullCmd)
329 329
 
330 330
 		if err != nil || exitCode != 0 {
331
-			err = fmt.Errorf("image '%s' wasn't found locally and it couldn't be pulled: %s", image, err)
331
+			err = fmt.Errorf("image %q wasn't found locally and it couldn't be pulled: %s", image, err)
332 332
 		}
333 333
 	}
334 334
 	return
... ...
@@ -341,7 +341,7 @@ func cmd(t *testing.T, args ...string) (string, int, error) {
341 341
 
342 342
 func dockerCmd(t *testing.T, args ...string) (string, int, error) {
343 343
 	out, status, err := runCommandWithOutput(exec.Command(dockerBinary, args...))
344
-	errorOut(err, t, fmt.Sprintf("'%s' failed with errors: %v (%v)", strings.Join(args, " "), err, out))
344
+	errorOut(err, t, fmt.Sprintf("%q failed with errors: %v (%v)", strings.Join(args, " "), err, out))
345 345
 	return out, status, err
346 346
 }
347 347
 
... ...
@@ -349,7 +349,7 @@ func dockerCmd(t *testing.T, args ...string) (string, int, error) {
349 349
 func dockerCmdWithTimeout(timeout time.Duration, args ...string) (string, int, error) {
350 350
 	out, status, err := runCommandWithOutputAndTimeout(exec.Command(dockerBinary, args...), timeout)
351 351
 	if err != nil {
352
-		return out, status, fmt.Errorf("'%s' failed with errors: %v : %q)", strings.Join(args, " "), err, out)
352
+		return out, status, fmt.Errorf("%q failed with errors: %v : %q)", strings.Join(args, " "), err, out)
353 353
 	}
354 354
 	return out, status, err
355 355
 }
... ...
@@ -360,7 +360,7 @@ func dockerCmdInDir(t *testing.T, path string, args ...string) (string, int, err
360 360
 	dockerCommand.Dir = path
361 361
 	out, status, err := runCommandWithOutput(dockerCommand)
362 362
 	if err != nil {
363
-		return out, status, fmt.Errorf("'%s' failed with errors: %v : %q)", strings.Join(args, " "), err, out)
363
+		return out, status, fmt.Errorf("%q failed with errors: %v : %q)", strings.Join(args, " "), err, out)
364 364
 	}
365 365
 	return out, status, err
366 366
 }
... ...
@@ -371,7 +371,7 @@ func dockerCmdInDirWithTimeout(timeout time.Duration, path string, args ...strin
371 371
 	dockerCommand.Dir = path
372 372
 	out, status, err := runCommandWithOutputAndTimeout(dockerCommand, timeout)
373 373
 	if err != nil {
374
-		return out, status, fmt.Errorf("'%s' failed with errors: %v : %q)", strings.Join(args, " "), err, out)
374
+		return out, status, fmt.Errorf("%q failed with errors: %v : %q)", strings.Join(args, " "), err, out)
375 375
 	}
376 376
 	return out, status, err
377 377
 }
... ...
@@ -521,7 +521,7 @@ func getContainerState(t *testing.T, id string) (int, bool, error) {
521 521
 	)
522 522
 	out, exitCode, err := dockerCmd(t, "inspect", "--format={{.State.Running}} {{.State.ExitCode}}", id)
523 523
 	if err != nil || exitCode != 0 {
524
-		return 0, false, fmt.Errorf("'%s' doesn't exist: %s", id, err)
524
+		return 0, false, fmt.Errorf("%q doesn't exist: %s", id, err)
525 525
 	}
526 526
 
527 527
 	out = strings.Trim(out, "\n")