mirror of https://github.com/docker/docs.git
Merge pull request #8566 from jfrazelle/Cleanup-fmt-%q
Cleanup: integration-cli ('%s' with %q)
This commit is contained in:
commit
b3cda9fc7e
|
|
@ -107,7 +107,7 @@ func TestCreateEchoStdout(t *testing.T) {
|
||||||
errorOut(err, t, out)
|
errorOut(err, t, out)
|
||||||
|
|
||||||
if out != "test123\n" {
|
if out != "test123\n" {
|
||||||
t.Errorf("container should've printed 'test123', got '%s'", out)
|
t.Errorf("container should've printed 'test123', got %q", out)
|
||||||
}
|
}
|
||||||
|
|
||||||
deleteAllContainers()
|
deleteAllContainers()
|
||||||
|
|
|
||||||
|
|
@ -85,7 +85,7 @@ func TestDiffEnsureOnlyKmsgAndPtmx(t *testing.T) {
|
||||||
|
|
||||||
for _, line := range strings.Split(out, "\n") {
|
for _, line := range strings.Split(out, "\n") {
|
||||||
if line != "" && !expected[line] {
|
if line != "" && !expected[line] {
|
||||||
t.Errorf("'%s' is shown in the diff but shouldn't", line)
|
t.Errorf("%q is shown in the diff but shouldn't", line)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -102,7 +102,7 @@ func TestRmContainerOrphaning(t *testing.T) {
|
||||||
t.Fatalf("%v: %s", err, out)
|
t.Fatalf("%v: %s", err, out)
|
||||||
}
|
}
|
||||||
if !strings.Contains(out, img1) {
|
if !strings.Contains(out, img1) {
|
||||||
t.Fatalf("Orphaned container (could not find '%s' in docker images): %s", img1, out)
|
t.Fatalf("Orphaned container (could not find %q in docker images): %s", img1, out)
|
||||||
}
|
}
|
||||||
|
|
||||||
deleteAllContainers()
|
deleteAllContainers()
|
||||||
|
|
|
||||||
|
|
@ -1182,7 +1182,7 @@ func TestRunModeHostname(t *testing.T) {
|
||||||
t.Fatal(err)
|
t.Fatal(err)
|
||||||
}
|
}
|
||||||
if actual := strings.Trim(out, "\r\n"); actual != hostname {
|
if actual := strings.Trim(out, "\r\n"); actual != hostname {
|
||||||
t.Fatalf("expected %q, but says: '%s'", hostname, actual)
|
t.Fatalf("expected %q, but says: %q", hostname, actual)
|
||||||
}
|
}
|
||||||
|
|
||||||
deleteAllContainers()
|
deleteAllContainers()
|
||||||
|
|
@ -1357,11 +1357,11 @@ func TestRunDnsOptionsBasedOnHostResolvConf(t *testing.T) {
|
||||||
|
|
||||||
actualSearch := resolvconf.GetSearchDomains([]byte(out))
|
actualSearch := resolvconf.GetSearchDomains([]byte(out))
|
||||||
if len(actualSearch) != len(hostSearch) {
|
if len(actualSearch) != len(hostSearch) {
|
||||||
t.Fatalf("expected %q search domain(s), but it has: '%s'", len(hostSearch), len(actualSearch))
|
t.Fatalf("expected %q search domain(s), but it has: %q", len(hostSearch), len(actualSearch))
|
||||||
}
|
}
|
||||||
for i := range actualSearch {
|
for i := range actualSearch {
|
||||||
if actualSearch[i] != hostSearch[i] {
|
if actualSearch[i] != hostSearch[i] {
|
||||||
t.Fatalf("expected %q domain, but says: '%s'", actualSearch[i], hostSearch[i])
|
t.Fatalf("expected %q domain, but says: %q", actualSearch[i], hostSearch[i])
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1373,11 +1373,11 @@ func TestRunDnsOptionsBasedOnHostResolvConf(t *testing.T) {
|
||||||
|
|
||||||
actualNameservers := resolvconf.GetNameservers([]byte(out))
|
actualNameservers := resolvconf.GetNameservers([]byte(out))
|
||||||
if len(actualNameservers) != len(hostNamservers) {
|
if len(actualNameservers) != len(hostNamservers) {
|
||||||
t.Fatalf("expected %q nameserver(s), but it has: '%s'", len(hostNamservers), len(actualNameservers))
|
t.Fatalf("expected %q nameserver(s), but it has: %q", len(hostNamservers), len(actualNameservers))
|
||||||
}
|
}
|
||||||
for i := range actualNameservers {
|
for i := range actualNameservers {
|
||||||
if actualNameservers[i] != hostNamservers[i] {
|
if actualNameservers[i] != hostNamservers[i] {
|
||||||
t.Fatalf("expected %q nameserver, but says: '%s'", actualNameservers[i], hostNamservers[i])
|
t.Fatalf("expected %q nameserver, but says: %q", actualNameservers[i], hostNamservers[i])
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1421,7 +1421,7 @@ func TestRunDnsOptionsBasedOnHostResolvConf(t *testing.T) {
|
||||||
}
|
}
|
||||||
for i := range actualSearch {
|
for i := range actualSearch {
|
||||||
if actualSearch[i] != hostSearch[i] {
|
if actualSearch[i] != hostSearch[i] {
|
||||||
t.Fatalf("expected %q domain, but says: '%s'", actualSearch[i], hostSearch[i])
|
t.Fatalf("expected %q domain, but says: %q", actualSearch[i], hostSearch[i])
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -44,7 +44,7 @@ func NewDaemon(t *testing.T) *Daemon {
|
||||||
dir := filepath.Join(dest, fmt.Sprintf("daemon%d", time.Now().Unix()))
|
dir := filepath.Join(dest, fmt.Sprintf("daemon%d", time.Now().Unix()))
|
||||||
daemonFolder, err := filepath.Abs(dir)
|
daemonFolder, err := filepath.Abs(dir)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatalf("Could not make '%s' an absolute path: %v", dir, err)
|
t.Fatalf("Could not make %q an absolute path: %v", dir, err)
|
||||||
}
|
}
|
||||||
|
|
||||||
if err := os.MkdirAll(filepath.Join(daemonFolder, "graph"), 0600); err != nil {
|
if err := os.MkdirAll(filepath.Join(daemonFolder, "graph"), 0600); err != nil {
|
||||||
|
|
@ -317,7 +317,7 @@ func imageExists(image string) error {
|
||||||
inspectCmd := exec.Command(dockerBinary, "inspect", image)
|
inspectCmd := exec.Command(dockerBinary, "inspect", image)
|
||||||
exitCode, err := runCommand(inspectCmd)
|
exitCode, err := runCommand(inspectCmd)
|
||||||
if exitCode != 0 && err == nil {
|
if exitCode != 0 && err == nil {
|
||||||
err = fmt.Errorf("couldn't find image '%s'", image)
|
err = fmt.Errorf("couldn't find image %q", image)
|
||||||
}
|
}
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
@ -328,7 +328,7 @@ func pullImageIfNotExist(image string) (err error) {
|
||||||
_, exitCode, err := runCommandWithOutput(pullCmd)
|
_, exitCode, err := runCommandWithOutput(pullCmd)
|
||||||
|
|
||||||
if err != nil || exitCode != 0 {
|
if err != nil || exitCode != 0 {
|
||||||
err = fmt.Errorf("image '%s' wasn't found locally and it couldn't be pulled: %s", image, err)
|
err = fmt.Errorf("image %q wasn't found locally and it couldn't be pulled: %s", image, err)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return
|
return
|
||||||
|
|
@ -341,7 +341,7 @@ func cmd(t *testing.T, args ...string) (string, int, error) {
|
||||||
|
|
||||||
func dockerCmd(t *testing.T, args ...string) (string, int, error) {
|
func dockerCmd(t *testing.T, args ...string) (string, int, error) {
|
||||||
out, status, err := runCommandWithOutput(exec.Command(dockerBinary, args...))
|
out, status, err := runCommandWithOutput(exec.Command(dockerBinary, args...))
|
||||||
errorOut(err, t, fmt.Sprintf("'%s' failed with errors: %v (%v)", strings.Join(args, " "), err, out))
|
errorOut(err, t, fmt.Sprintf("%q failed with errors: %v (%v)", strings.Join(args, " "), err, out))
|
||||||
return out, status, err
|
return out, status, err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -349,7 +349,7 @@ func dockerCmd(t *testing.T, args ...string) (string, int, error) {
|
||||||
func dockerCmdWithTimeout(timeout time.Duration, args ...string) (string, int, error) {
|
func dockerCmdWithTimeout(timeout time.Duration, args ...string) (string, int, error) {
|
||||||
out, status, err := runCommandWithOutputAndTimeout(exec.Command(dockerBinary, args...), timeout)
|
out, status, err := runCommandWithOutputAndTimeout(exec.Command(dockerBinary, args...), timeout)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return out, status, fmt.Errorf("'%s' failed with errors: %v : %q)", strings.Join(args, " "), err, out)
|
return out, status, fmt.Errorf("%q failed with errors: %v : %q)", strings.Join(args, " "), err, out)
|
||||||
}
|
}
|
||||||
return out, status, err
|
return out, status, err
|
||||||
}
|
}
|
||||||
|
|
@ -360,7 +360,7 @@ func dockerCmdInDir(t *testing.T, path string, args ...string) (string, int, err
|
||||||
dockerCommand.Dir = path
|
dockerCommand.Dir = path
|
||||||
out, status, err := runCommandWithOutput(dockerCommand)
|
out, status, err := runCommandWithOutput(dockerCommand)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return out, status, fmt.Errorf("'%s' failed with errors: %v : %q)", strings.Join(args, " "), err, out)
|
return out, status, fmt.Errorf("%q failed with errors: %v : %q)", strings.Join(args, " "), err, out)
|
||||||
}
|
}
|
||||||
return out, status, err
|
return out, status, err
|
||||||
}
|
}
|
||||||
|
|
@ -371,7 +371,7 @@ func dockerCmdInDirWithTimeout(timeout time.Duration, path string, args ...strin
|
||||||
dockerCommand.Dir = path
|
dockerCommand.Dir = path
|
||||||
out, status, err := runCommandWithOutputAndTimeout(dockerCommand, timeout)
|
out, status, err := runCommandWithOutputAndTimeout(dockerCommand, timeout)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return out, status, fmt.Errorf("'%s' failed with errors: %v : %q)", strings.Join(args, " "), err, out)
|
return out, status, fmt.Errorf("%q failed with errors: %v : %q)", strings.Join(args, " "), err, out)
|
||||||
}
|
}
|
||||||
return out, status, err
|
return out, status, err
|
||||||
}
|
}
|
||||||
|
|
@ -521,7 +521,7 @@ func getContainerState(t *testing.T, id string) (int, bool, error) {
|
||||||
)
|
)
|
||||||
out, exitCode, err := dockerCmd(t, "inspect", "--format={{.State.Running}} {{.State.ExitCode}}", id)
|
out, exitCode, err := dockerCmd(t, "inspect", "--format={{.State.Running}} {{.State.ExitCode}}", id)
|
||||||
if err != nil || exitCode != 0 {
|
if err != nil || exitCode != 0 {
|
||||||
return 0, false, fmt.Errorf("'%s' doesn't exist: %s", id, err)
|
return 0, false, fmt.Errorf("%q doesn't exist: %s", id, err)
|
||||||
}
|
}
|
||||||
|
|
||||||
out = strings.Trim(out, "\n")
|
out = strings.Trim(out, "\n")
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue