mirror of
https://github.com/moby/moby.git
synced 2025-08-01 05:47:11 +03:00
@ -109,7 +109,7 @@ func main() {
|
|||||||
if err := cli.Cmd(flag.Args()...); err != nil {
|
if err := cli.Cmd(flag.Args()...); err != nil {
|
||||||
if sterr, ok := err.(*utils.StatusError); ok {
|
if sterr, ok := err.(*utils.StatusError); ok {
|
||||||
if sterr.Status != "" {
|
if sterr.Status != "" {
|
||||||
log.Println("%s", sterr.Status)
|
log.Println(sterr.Status)
|
||||||
}
|
}
|
||||||
os.Exit(sterr.StatusCode)
|
os.Exit(sterr.StatusCode)
|
||||||
}
|
}
|
||||||
|
@ -218,7 +218,7 @@ func TestBuildEnvironmentReplacementEnv(t *testing.T) {
|
|||||||
if parts[0] == "bar" {
|
if parts[0] == "bar" {
|
||||||
found = true
|
found = true
|
||||||
if parts[1] != "foo" {
|
if parts[1] != "foo" {
|
||||||
t.Fatal("Could not find replaced var for env `bar`: got %q instead of `foo`", parts[1])
|
t.Fatalf("Could not find replaced var for env `bar`: got %q instead of `foo`", parts[1])
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1224,7 +1224,7 @@ func TestBuildCopyDisallowRemote(t *testing.T) {
|
|||||||
COPY https://index.docker.io/robots.txt /`,
|
COPY https://index.docker.io/robots.txt /`,
|
||||||
true)
|
true)
|
||||||
if err == nil || !strings.Contains(out, "Source can't be a URL for COPY") {
|
if err == nil || !strings.Contains(out, "Source can't be a URL for COPY") {
|
||||||
t.Fatal("Error should be about disallowed remote source, got err: %s, out: %q", err, out)
|
t.Fatalf("Error should be about disallowed remote source, got err: %s, out: %q", err, out)
|
||||||
}
|
}
|
||||||
logDone("build - copy - disallow copy from remote")
|
logDone("build - copy - disallow copy from remote")
|
||||||
}
|
}
|
||||||
@ -1374,7 +1374,7 @@ func TestBuildForceRm(t *testing.T) {
|
|||||||
buildCmd := exec.Command(dockerBinary, "build", "-t", name, "--force-rm", ".")
|
buildCmd := exec.Command(dockerBinary, "build", "-t", name, "--force-rm", ".")
|
||||||
buildCmd.Dir = ctx.Dir
|
buildCmd.Dir = ctx.Dir
|
||||||
if out, _, err := runCommandWithOutput(buildCmd); err == nil {
|
if out, _, err := runCommandWithOutput(buildCmd); err == nil {
|
||||||
t.Fatal("failed to build the image: %s, %v", out, err)
|
t.Fatalf("failed to build the image: %s, %v", out, err)
|
||||||
}
|
}
|
||||||
|
|
||||||
containerCountAfter, err := getContainerCount()
|
containerCountAfter, err := getContainerCount()
|
||||||
@ -3181,7 +3181,7 @@ func TestBuildEntrypointInheritance(t *testing.T) {
|
|||||||
status, _ = runCommand(exec.Command(dockerBinary, "run", "child"))
|
status, _ = runCommand(exec.Command(dockerBinary, "run", "child"))
|
||||||
|
|
||||||
if status != 5 {
|
if status != 5 {
|
||||||
t.Fatal("expected exit code 5 but received %d", status)
|
t.Fatalf("expected exit code 5 but received %d", status)
|
||||||
}
|
}
|
||||||
|
|
||||||
logDone("build - clear entrypoint")
|
logDone("build - clear entrypoint")
|
||||||
|
@ -47,7 +47,7 @@ RUN echo "Z"`,
|
|||||||
|
|
||||||
out, exitCode, err := runCommandWithOutput(exec.Command(dockerBinary, "history", "testbuildhistory"))
|
out, exitCode, err := runCommandWithOutput(exec.Command(dockerBinary, "history", "testbuildhistory"))
|
||||||
if err != nil || exitCode != 0 {
|
if err != nil || exitCode != 0 {
|
||||||
t.Fatal("failed to get image history: %s, %v", out, err)
|
t.Fatalf("failed to get image history: %s, %v", out, err)
|
||||||
}
|
}
|
||||||
|
|
||||||
actualValues := strings.Split(out, "\n")[1:27]
|
actualValues := strings.Split(out, "\n")[1:27]
|
||||||
|
@ -11,7 +11,7 @@ func TestInfoEnsureSucceeds(t *testing.T) {
|
|||||||
versionCmd := exec.Command(dockerBinary, "info")
|
versionCmd := exec.Command(dockerBinary, "info")
|
||||||
out, exitCode, err := runCommandWithOutput(versionCmd)
|
out, exitCode, err := runCommandWithOutput(versionCmd)
|
||||||
if err != nil || exitCode != 0 {
|
if err != nil || exitCode != 0 {
|
||||||
t.Fatal("failed to execute docker info: %s, %v", out, err)
|
t.Fatalf("failed to execute docker info: %s, %v", out, err)
|
||||||
}
|
}
|
||||||
|
|
||||||
stringsToCheck := []string{"Containers:", "Execution Driver:", "Kernel Version:"}
|
stringsToCheck := []string{"Containers:", "Execution Driver:", "Kernel Version:"}
|
||||||
|
@ -11,7 +11,7 @@ import (
|
|||||||
func TestPullImageFromCentralRegistry(t *testing.T) {
|
func TestPullImageFromCentralRegistry(t *testing.T) {
|
||||||
pullCmd := exec.Command(dockerBinary, "pull", "scratch")
|
pullCmd := exec.Command(dockerBinary, "pull", "scratch")
|
||||||
if out, _, err := runCommandWithOutput(pullCmd); err != nil {
|
if out, _, err := runCommandWithOutput(pullCmd); err != nil {
|
||||||
t.Fatal("pulling the scratch image from the registry has failed: %s, %v", out, err)
|
t.Fatalf("pulling the scratch image from the registry has failed: %s, %v", out, err)
|
||||||
}
|
}
|
||||||
logDone("pull - pull scratch")
|
logDone("pull - pull scratch")
|
||||||
}
|
}
|
||||||
@ -20,7 +20,7 @@ func TestPullImageFromCentralRegistry(t *testing.T) {
|
|||||||
func TestPullNonExistingImage(t *testing.T) {
|
func TestPullNonExistingImage(t *testing.T) {
|
||||||
pullCmd := exec.Command(dockerBinary, "pull", "fooblahblah1234")
|
pullCmd := exec.Command(dockerBinary, "pull", "fooblahblah1234")
|
||||||
if out, _, err := runCommandWithOutput(pullCmd); err == nil {
|
if out, _, err := runCommandWithOutput(pullCmd); err == nil {
|
||||||
t.Fatal("expected non-zero exit status when pulling non-existing image: %s", out)
|
t.Fatalf("expected non-zero exit status when pulling non-existing image: %s", out)
|
||||||
}
|
}
|
||||||
logDone("pull - pull fooblahblah1234 (non-existing image)")
|
logDone("pull - pull fooblahblah1234 (non-existing image)")
|
||||||
}
|
}
|
||||||
|
@ -16,12 +16,12 @@ func TestPushBusyboxImage(t *testing.T) {
|
|||||||
repoName := fmt.Sprintf("%v/busybox", privateRegistryURL)
|
repoName := fmt.Sprintf("%v/busybox", privateRegistryURL)
|
||||||
tagCmd := exec.Command(dockerBinary, "tag", "busybox", repoName)
|
tagCmd := exec.Command(dockerBinary, "tag", "busybox", repoName)
|
||||||
if out, _, err := runCommandWithOutput(tagCmd); err != nil {
|
if out, _, err := runCommandWithOutput(tagCmd); err != nil {
|
||||||
t.Fatal("image tagging failed: %s, %v", out, err)
|
t.Fatalf("image tagging failed: %s, %v", out, err)
|
||||||
}
|
}
|
||||||
|
|
||||||
pushCmd := exec.Command(dockerBinary, "push", repoName)
|
pushCmd := exec.Command(dockerBinary, "push", repoName)
|
||||||
if out, _, err := runCommandWithOutput(pushCmd); err != nil {
|
if out, _, err := runCommandWithOutput(pushCmd); err != nil {
|
||||||
t.Fatal("pushing the image to the private registry has failed: %s, %v", out, err)
|
t.Fatalf("pushing the image to the private registry has failed: %s, %v", out, err)
|
||||||
}
|
}
|
||||||
|
|
||||||
deleteImages(repoName)
|
deleteImages(repoName)
|
||||||
@ -35,7 +35,7 @@ func TestPushUnprefixedRepo(t *testing.T) {
|
|||||||
t.Skip()
|
t.Skip()
|
||||||
pushCmd := exec.Command(dockerBinary, "push", "busybox")
|
pushCmd := exec.Command(dockerBinary, "push", "busybox")
|
||||||
if out, _, err := runCommandWithOutput(pushCmd); err == nil {
|
if out, _, err := runCommandWithOutput(pushCmd); err == nil {
|
||||||
t.Fatal("pushing an unprefixed repo didn't result in a non-zero exit status: %s", out)
|
t.Fatalf("pushing an unprefixed repo didn't result in a non-zero exit status: %s", out)
|
||||||
}
|
}
|
||||||
logDone("push - push unprefixed busybox repo --> must fail")
|
logDone("push - push unprefixed busybox repo --> must fail")
|
||||||
}
|
}
|
||||||
|
@ -114,7 +114,7 @@ func TestRmInvalidContainer(t *testing.T) {
|
|||||||
if out, _, err := runCommandWithOutput(exec.Command(dockerBinary, "rm", "unknown")); err == nil {
|
if out, _, err := runCommandWithOutput(exec.Command(dockerBinary, "rm", "unknown")); err == nil {
|
||||||
t.Fatal("Expected error on rm unknown container, got none")
|
t.Fatal("Expected error on rm unknown container, got none")
|
||||||
} else if !strings.Contains(out, "failed to remove one or more containers") {
|
} else if !strings.Contains(out, "failed to remove one or more containers") {
|
||||||
t.Fatal("Expected output to contain 'failed to remove one or more containers', got %q", out)
|
t.Fatalf("Expected output to contain 'failed to remove one or more containers', got %q", out)
|
||||||
}
|
}
|
||||||
|
|
||||||
logDone("rm - delete unknown container")
|
logDone("rm - delete unknown container")
|
||||||
|
@ -11,7 +11,7 @@ func TestSearchOnCentralRegistry(t *testing.T) {
|
|||||||
searchCmd := exec.Command(dockerBinary, "search", "busybox")
|
searchCmd := exec.Command(dockerBinary, "search", "busybox")
|
||||||
out, exitCode, err := runCommandWithOutput(searchCmd)
|
out, exitCode, err := runCommandWithOutput(searchCmd)
|
||||||
if err != nil || exitCode != 0 {
|
if err != nil || exitCode != 0 {
|
||||||
t.Fatal("failed to search on the central registry: %s, %v", out, err)
|
t.Fatalf("failed to search on the central registry: %s, %v", out, err)
|
||||||
}
|
}
|
||||||
|
|
||||||
if !strings.Contains(out, "Busybox base image.") {
|
if !strings.Contains(out, "Busybox base image.") {
|
||||||
|
@ -11,7 +11,7 @@ func TestVersionEnsureSucceeds(t *testing.T) {
|
|||||||
versionCmd := exec.Command(dockerBinary, "version")
|
versionCmd := exec.Command(dockerBinary, "version")
|
||||||
out, _, err := runCommandWithOutput(versionCmd)
|
out, _, err := runCommandWithOutput(versionCmd)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatal("failed to execute docker version: %s, %v", out, err)
|
t.Fatalf("failed to execute docker version: %s, %v", out, err)
|
||||||
}
|
}
|
||||||
|
|
||||||
stringsToCheck := []string{
|
stringsToCheck := []string{
|
||||||
|
Reference in New Issue
Block a user