Docker-DCO-1.1-Signed-off-by: Jessica Frazelle <jess@docker.com> (github: jfrazelle)
| ... | ... |
@@ -20,7 +20,9 @@ func TestBuildOnBuildForbiddenMaintainerInSourceImage(t *testing.T) {
|
| 20 | 20 |
defer deleteImages(name) |
| 21 | 21 |
createCmd := exec.Command(dockerBinary, "create", "busybox", "true") |
| 22 | 22 |
out, _, _, err := runCommandWithStdoutStderr(createCmd) |
| 23 |
- errorOut(err, t, out) |
|
| 23 |
+ if err != nil {
|
|
| 24 |
+ t.Fatal(out, err) |
|
| 25 |
+ } |
|
| 24 | 26 |
|
| 25 | 27 |
cleanedContainerID := stripTrailingCharacters(out) |
| 26 | 28 |
|
| ... | ... |
@@ -49,7 +51,9 @@ func TestBuildOnBuildForbiddenFromInSourceImage(t *testing.T) {
|
| 49 | 49 |
defer deleteImages(name) |
| 50 | 50 |
createCmd := exec.Command(dockerBinary, "create", "busybox", "true") |
| 51 | 51 |
out, _, _, err := runCommandWithStdoutStderr(createCmd) |
| 52 |
- errorOut(err, t, out) |
|
| 52 |
+ if err != nil {
|
|
| 53 |
+ t.Fatal(out, err) |
|
| 54 |
+ } |
|
| 53 | 55 |
|
| 54 | 56 |
cleanedContainerID := stripTrailingCharacters(out) |
| 55 | 57 |
|
| ... | ... |
@@ -78,7 +82,9 @@ func TestBuildOnBuildForbiddenChainedInSourceImage(t *testing.T) {
|
| 78 | 78 |
defer deleteImages(name) |
| 79 | 79 |
createCmd := exec.Command(dockerBinary, "create", "busybox", "true") |
| 80 | 80 |
out, _, _, err := runCommandWithStdoutStderr(createCmd) |
| 81 |
- errorOut(err, t, out) |
|
| 81 |
+ if err != nil {
|
|
| 82 |
+ t.Fatal(out, err) |
|
| 83 |
+ } |
|
| 82 | 84 |
|
| 83 | 85 |
cleanedContainerID := stripTrailingCharacters(out) |
| 84 | 86 |
|
| ... | ... |
@@ -299,11 +305,8 @@ RUN [ $(ls -l /exists/exists_file | awk '{print $3":"$4}') = 'dockerio:dockerio'
|
| 299 | 299 |
|
| 300 | 300 |
func TestBuildCopyAddMultipleFiles(t *testing.T) {
|
| 301 | 301 |
buildDirectory := filepath.Join(workingDirectory, "build_tests", "TestCopy") |
| 302 |
- out, exitCode, err := dockerCmdInDir(t, buildDirectory, "build", "-t", "testaddimg", "MultipleFiles") |
|
| 303 |
- errorOut(err, t, fmt.Sprintf("build failed to complete: %v %v", out, err))
|
|
| 304 |
- |
|
| 305 |
- if err != nil || exitCode != 0 {
|
|
| 306 |
- t.Fatal("failed to build the image")
|
|
| 302 |
+ if out, _, err := dockerCmdInDir(t, buildDirectory, "build", "-t", "testaddimg", "MultipleFiles"); err != nil {
|
|
| 303 |
+ t.Fatalf("build failed to complete: %s, %v", out, err)
|
|
| 307 | 304 |
} |
| 308 | 305 |
|
| 309 | 306 |
deleteImages("testaddimg")
|
| ... | ... |
@@ -620,11 +623,8 @@ func TestBuildCopySingleFileToRoot(t *testing.T) {
|
| 620 | 620 |
t.Fatal(err) |
| 621 | 621 |
} |
| 622 | 622 |
f.Close() |
| 623 |
- out, exitCode, err := dockerCmdInDir(t, buildDirectory, "build", "-t", "testcopyimg", ".") |
|
| 624 |
- errorOut(err, t, fmt.Sprintf("build failed to complete: %v %v", out, err))
|
|
| 625 |
- |
|
| 626 |
- if err != nil || exitCode != 0 {
|
|
| 627 |
- t.Fatal("failed to build the image")
|
|
| 623 |
+ if out, _, err := dockerCmdInDir(t, buildDirectory, "build", "-t", "testcopyimg", "."); err != nil {
|
|
| 624 |
+ t.Fatalf("build failed to complete: %s, %v", out, err)
|
|
| 628 | 625 |
} |
| 629 | 626 |
|
| 630 | 627 |
deleteImages("testcopyimg")
|
| ... | ... |
@@ -650,9 +650,8 @@ func TestBuildCopySingleFileToWorkdir(t *testing.T) {
|
| 650 | 650 |
t.Fatal(err) |
| 651 | 651 |
} |
| 652 | 652 |
f.Close() |
| 653 |
- _, exitCode, err := dockerCmdInDirWithTimeout(5*time.Second, buildDirectory, "build", "-t", "testcopyimg", ".") |
|
| 654 |
- if err != nil || exitCode != 0 {
|
|
| 655 |
- t.Fatalf("build failed: %s", err)
|
|
| 653 |
+ if out, _, err := dockerCmdInDirWithTimeout(5*time.Second, buildDirectory, "build", "-t", "testcopyimg", "."); err != nil {
|
|
| 654 |
+ t.Fatalf("build failed to complete: %s, %v", out, err)
|
|
| 656 | 655 |
} |
| 657 | 656 |
|
| 658 | 657 |
deleteImages("testcopyimg")
|
| ... | ... |
@@ -662,11 +661,8 @@ func TestBuildCopySingleFileToWorkdir(t *testing.T) {
|
| 662 | 662 |
|
| 663 | 663 |
func TestBuildCopySingleFileToExistDir(t *testing.T) {
|
| 664 | 664 |
buildDirectory := filepath.Join(workingDirectory, "build_tests", "TestCopy") |
| 665 |
- out, exitCode, err := dockerCmdInDir(t, buildDirectory, "build", "-t", "testcopyimg", "SingleFileToExistDir") |
|
| 666 |
- errorOut(err, t, fmt.Sprintf("build failed to complete: %v %v", out, err))
|
|
| 667 |
- |
|
| 668 |
- if err != nil || exitCode != 0 {
|
|
| 669 |
- t.Fatal("failed to build the image")
|
|
| 665 |
+ if out, _, err := dockerCmdInDir(t, buildDirectory, "build", "-t", "testcopyimg", "SingleFileToExistDir"); err != nil {
|
|
| 666 |
+ t.Fatalf("build failed to complete: %s, %v", out, err)
|
|
| 670 | 667 |
} |
| 671 | 668 |
|
| 672 | 669 |
deleteImages("testcopyimg")
|
| ... | ... |
@@ -676,11 +672,8 @@ func TestBuildCopySingleFileToExistDir(t *testing.T) {
|
| 676 | 676 |
|
| 677 | 677 |
func TestBuildCopySingleFileToNonExistDir(t *testing.T) {
|
| 678 | 678 |
buildDirectory := filepath.Join(workingDirectory, "build_tests", "TestCopy") |
| 679 |
- out, exitCode, err := dockerCmdInDir(t, buildDirectory, "build", "-t", "testcopyimg", "SingleFileToNonExistDir") |
|
| 680 |
- errorOut(err, t, fmt.Sprintf("build failed to complete: %v %v", out, err))
|
|
| 681 |
- |
|
| 682 |
- if err != nil || exitCode != 0 {
|
|
| 683 |
- t.Fatal("failed to build the image")
|
|
| 679 |
+ if out, _, err := dockerCmdInDir(t, buildDirectory, "build", "-t", "testcopyimg", "SingleFileToNonExistDir"); err != nil {
|
|
| 680 |
+ t.Fatalf("build failed to complete: %s, %v", out, err)
|
|
| 684 | 681 |
} |
| 685 | 682 |
|
| 686 | 683 |
deleteImages("testcopyimg")
|
| ... | ... |
@@ -690,11 +683,8 @@ func TestBuildCopySingleFileToNonExistDir(t *testing.T) {
|
| 690 | 690 |
|
| 691 | 691 |
func TestBuildCopyDirContentToRoot(t *testing.T) {
|
| 692 | 692 |
buildDirectory := filepath.Join(workingDirectory, "build_tests", "TestCopy") |
| 693 |
- out, exitCode, err := dockerCmdInDir(t, buildDirectory, "build", "-t", "testcopyimg", "DirContentToRoot") |
|
| 694 |
- errorOut(err, t, fmt.Sprintf("build failed to complete: %v %v", out, err))
|
|
| 695 |
- |
|
| 696 |
- if err != nil || exitCode != 0 {
|
|
| 697 |
- t.Fatal("failed to build the image")
|
|
| 693 |
+ if out, _, err := dockerCmdInDir(t, buildDirectory, "build", "-t", "testcopyimg", "DirContentToRoot"); err != nil {
|
|
| 694 |
+ t.Fatalf("build failed to complete: %s, %v", out, err)
|
|
| 698 | 695 |
} |
| 699 | 696 |
|
| 700 | 697 |
deleteImages("testcopyimg")
|
| ... | ... |
@@ -704,11 +694,8 @@ func TestBuildCopyDirContentToRoot(t *testing.T) {
|
| 704 | 704 |
|
| 705 | 705 |
func TestBuildCopyDirContentToExistDir(t *testing.T) {
|
| 706 | 706 |
buildDirectory := filepath.Join(workingDirectory, "build_tests", "TestCopy") |
| 707 |
- out, exitCode, err := dockerCmdInDir(t, buildDirectory, "build", "-t", "testcopyimg", "DirContentToExistDir") |
|
| 708 |
- errorOut(err, t, fmt.Sprintf("build failed to complete: %v %v", out, err))
|
|
| 709 |
- |
|
| 710 |
- if err != nil || exitCode != 0 {
|
|
| 711 |
- t.Fatal("failed to build the image")
|
|
| 707 |
+ if out, _, err := dockerCmdInDir(t, buildDirectory, "build", "-t", "testcopyimg", "DirContentToExistDir"); err != nil {
|
|
| 708 |
+ t.Fatalf("build failed to complete: %s, %v", out, err)
|
|
| 712 | 709 |
} |
| 713 | 710 |
|
| 714 | 711 |
deleteImages("testcopyimg")
|
| ... | ... |
@@ -737,11 +724,8 @@ func TestBuildCopyWholeDirToRoot(t *testing.T) {
|
| 737 | 737 |
t.Fatal(err) |
| 738 | 738 |
} |
| 739 | 739 |
f.Close() |
| 740 |
- out, exitCode, err := dockerCmdInDir(t, buildDirectory, "build", "-t", "testcopyimg", ".") |
|
| 741 |
- errorOut(err, t, fmt.Sprintf("build failed to complete: %v %v", out, err))
|
|
| 742 |
- |
|
| 743 |
- if err != nil || exitCode != 0 {
|
|
| 744 |
- t.Fatal("failed to build the image")
|
|
| 740 |
+ if out, _, err := dockerCmdInDir(t, buildDirectory, "build", "-t", "testcopyimg", "."); err != nil {
|
|
| 741 |
+ t.Fatalf("build failed to complete: %s, %v", out, err)
|
|
| 745 | 742 |
} |
| 746 | 743 |
|
| 747 | 744 |
deleteImages("testcopyimg")
|
| ... | ... |
@@ -751,11 +735,8 @@ func TestBuildCopyWholeDirToRoot(t *testing.T) {
|
| 751 | 751 |
|
| 752 | 752 |
func TestBuildCopyEtcToRoot(t *testing.T) {
|
| 753 | 753 |
buildDirectory := filepath.Join(workingDirectory, "build_tests", "TestCopy") |
| 754 |
- out, exitCode, err := dockerCmdInDir(t, buildDirectory, "build", "-t", "testcopyimg", "EtcToRoot") |
|
| 755 |
- errorOut(err, t, fmt.Sprintf("build failed to complete: %v %v", out, err))
|
|
| 756 |
- |
|
| 757 |
- if err != nil || exitCode != 0 {
|
|
| 758 |
- t.Fatal("failed to build the image")
|
|
| 754 |
+ if out, _, err := dockerCmdInDir(t, buildDirectory, "build", "-t", "testcopyimg", "EtcToRoot"); err != nil {
|
|
| 755 |
+ t.Fatalf("build failed to complete: %s, %v", out, err)
|
|
| 759 | 756 |
} |
| 760 | 757 |
|
| 761 | 758 |
deleteImages("testcopyimg")
|
| ... | ... |
@@ -766,9 +747,7 @@ func TestBuildCopyDisallowRemote(t *testing.T) {
|
| 766 | 766 |
buildDirectory := filepath.Join(workingDirectory, "build_tests", "TestCopy") |
| 767 | 767 |
buildCmd := exec.Command(dockerBinary, "build", "-t", "testcopyimg", "DisallowRemote") |
| 768 | 768 |
buildCmd.Dir = buildDirectory |
| 769 |
- out, exitCode, err := runCommandWithOutput(buildCmd) |
|
| 770 |
- |
|
| 771 |
- if err == nil || exitCode == 0 {
|
|
| 769 |
+ if out, _, err := runCommandWithOutput(buildCmd); err == nil {
|
|
| 772 | 770 |
t.Fatalf("building the image should've failed; output: %s", out)
|
| 773 | 771 |
} |
| 774 | 772 |
|
| ... | ... |
@@ -790,14 +769,16 @@ func TestBuildWithInaccessibleFilesInContext(t *testing.T) {
|
| 790 | 790 |
// This is used to ensure we detect inaccessible files early during build in the cli client |
| 791 | 791 |
pathToFileWithoutReadAccess := filepath.Join(ctx.Dir, "fileWithoutReadAccess") |
| 792 | 792 |
|
| 793 |
- err = os.Chown(pathToFileWithoutReadAccess, 0, 0) |
|
| 794 |
- errorOut(err, t, fmt.Sprintf("failed to chown file to root: %s", err))
|
|
| 795 |
- err = os.Chmod(pathToFileWithoutReadAccess, 0700) |
|
| 796 |
- errorOut(err, t, fmt.Sprintf("failed to chmod file to 700: %s", err))
|
|
| 793 |
+ if err = os.Chown(pathToFileWithoutReadAccess, 0, 0); err != nil {
|
|
| 794 |
+ t.Fatalf("failed to chown file to root: %s", err)
|
|
| 795 |
+ } |
|
| 796 |
+ if err = os.Chmod(pathToFileWithoutReadAccess, 0700); err != nil {
|
|
| 797 |
+ t.Fatalf("failed to chmod file to 700: %s", err)
|
|
| 798 |
+ } |
|
| 797 | 799 |
buildCmd := exec.Command("su", "unprivilegeduser", "-c", fmt.Sprintf("%s build -t %s .", dockerBinary, name))
|
| 798 | 800 |
buildCmd.Dir = ctx.Dir |
| 799 |
- out, exitCode, err := runCommandWithOutput(buildCmd) |
|
| 800 |
- if err == nil || exitCode == 0 {
|
|
| 801 |
+ out, _, err := runCommandWithOutput(buildCmd) |
|
| 802 |
+ if err == nil {
|
|
| 801 | 803 |
t.Fatalf("build should have failed: %s %s", err, out)
|
| 802 | 804 |
} |
| 803 | 805 |
|
| ... | ... |
@@ -822,17 +803,20 @@ func TestBuildWithInaccessibleFilesInContext(t *testing.T) {
|
| 822 | 822 |
pathToDirectoryWithoutReadAccess := filepath.Join(ctx.Dir, "directoryWeCantStat") |
| 823 | 823 |
pathToFileInDirectoryWithoutReadAccess := filepath.Join(pathToDirectoryWithoutReadAccess, "bar") |
| 824 | 824 |
|
| 825 |
- err = os.Chown(pathToDirectoryWithoutReadAccess, 0, 0) |
|
| 826 |
- errorOut(err, t, fmt.Sprintf("failed to chown directory to root: %s", err))
|
|
| 827 |
- err = os.Chmod(pathToDirectoryWithoutReadAccess, 0444) |
|
| 828 |
- errorOut(err, t, fmt.Sprintf("failed to chmod directory to 755: %s", err))
|
|
| 829 |
- err = os.Chmod(pathToFileInDirectoryWithoutReadAccess, 0700) |
|
| 830 |
- errorOut(err, t, fmt.Sprintf("failed to chmod file to 444: %s", err))
|
|
| 825 |
+ if err = os.Chown(pathToDirectoryWithoutReadAccess, 0, 0); err != nil {
|
|
| 826 |
+ t.Fatalf("failed to chown directory to root: %s", err)
|
|
| 827 |
+ } |
|
| 828 |
+ if err = os.Chmod(pathToDirectoryWithoutReadAccess, 0444); err != nil {
|
|
| 829 |
+ t.Fatalf("failed to chmod directory to 755: %s", err)
|
|
| 830 |
+ } |
|
| 831 |
+ if err = os.Chmod(pathToFileInDirectoryWithoutReadAccess, 0700); err != nil {
|
|
| 832 |
+ t.Fatalf("failed to chmod file to 444: %s", err)
|
|
| 833 |
+ } |
|
| 831 | 834 |
|
| 832 | 835 |
buildCmd := exec.Command("su", "unprivilegeduser", "-c", fmt.Sprintf("%s build -t %s .", dockerBinary, name))
|
| 833 | 836 |
buildCmd.Dir = ctx.Dir |
| 834 |
- out, exitCode, err := runCommandWithOutput(buildCmd) |
|
| 835 |
- if err == nil || exitCode == 0 {
|
|
| 837 |
+ out, _, err := runCommandWithOutput(buildCmd) |
|
| 838 |
+ if err == nil {
|
|
| 836 | 839 |
t.Fatalf("build should have failed: %s %s", err, out)
|
| 837 | 840 |
} |
| 838 | 841 |
|
| ... | ... |
@@ -878,17 +862,19 @@ func TestBuildWithInaccessibleFilesInContext(t *testing.T) {
|
| 878 | 878 |
// This is used to ensure we don't try to add inaccessible files when they are ignored by a .dockerignore pattern |
| 879 | 879 |
pathToDirectoryWithoutReadAccess := filepath.Join(ctx.Dir, "directoryWeCantStat") |
| 880 | 880 |
pathToFileInDirectoryWithoutReadAccess := filepath.Join(pathToDirectoryWithoutReadAccess, "bar") |
| 881 |
- err = os.Chown(pathToDirectoryWithoutReadAccess, 0, 0) |
|
| 882 |
- errorOut(err, t, fmt.Sprintf("failed to chown directory to root: %s", err))
|
|
| 883 |
- err = os.Chmod(pathToDirectoryWithoutReadAccess, 0444) |
|
| 884 |
- errorOut(err, t, fmt.Sprintf("failed to chmod directory to 755: %s", err))
|
|
| 885 |
- err = os.Chmod(pathToFileInDirectoryWithoutReadAccess, 0700) |
|
| 886 |
- errorOut(err, t, fmt.Sprintf("failed to chmod file to 444: %s", err))
|
|
| 881 |
+ if err = os.Chown(pathToDirectoryWithoutReadAccess, 0, 0); err != nil {
|
|
| 882 |
+ t.Fatalf("failed to chown directory to root: %s", err)
|
|
| 883 |
+ } |
|
| 884 |
+ if err = os.Chmod(pathToDirectoryWithoutReadAccess, 0444); err != nil {
|
|
| 885 |
+ t.Fatalf("failed to chmod directory to 755: %s", err)
|
|
| 886 |
+ } |
|
| 887 |
+ if err = os.Chmod(pathToFileInDirectoryWithoutReadAccess, 0700); err != nil {
|
|
| 888 |
+ t.Fatalf("failed to chmod file to 444: %s", err)
|
|
| 889 |
+ } |
|
| 887 | 890 |
|
| 888 | 891 |
buildCmd := exec.Command("su", "unprivilegeduser", "-c", fmt.Sprintf("%s build -t %s .", dockerBinary, name))
|
| 889 | 892 |
buildCmd.Dir = ctx.Dir |
| 890 |
- out, exitCode, err := runCommandWithOutput(buildCmd) |
|
| 891 |
- if err != nil || exitCode != 0 {
|
|
| 893 |
+ if out, _, err := runCommandWithOutput(buildCmd); err != nil {
|
|
| 892 | 894 |
t.Fatalf("build should have worked: %s %s", err, out)
|
| 893 | 895 |
} |
| 894 | 896 |
|
| ... | ... |
@@ -913,10 +899,8 @@ func TestBuildForceRm(t *testing.T) {
|
| 913 | 913 |
|
| 914 | 914 |
buildCmd := exec.Command(dockerBinary, "build", "-t", name, "--force-rm", ".") |
| 915 | 915 |
buildCmd.Dir = ctx.Dir |
| 916 |
- _, exitCode, err := runCommandWithOutput(buildCmd) |
|
| 917 |
- |
|
| 918 |
- if err == nil || exitCode == 0 {
|
|
| 919 |
- t.Fatal("failed to build the image")
|
|
| 916 |
+ if out, _, err := runCommandWithOutput(buildCmd); err == nil {
|
|
| 917 |
+ t.Fatal("failed to build the image: %s, %v", out, err)
|
|
| 920 | 918 |
} |
| 921 | 919 |
|
| 922 | 920 |
containerCountAfter, err := getContainerCount() |
| ... | ... |
@@ -945,9 +929,9 @@ func TestBuildRm(t *testing.T) {
|
| 945 | 945 |
t.Fatalf("failed to get the container count: %s", err)
|
| 946 | 946 |
} |
| 947 | 947 |
|
| 948 |
- out, exitCode, err := dockerCmdInDir(t, ctx.Dir, "build", "--rm", "-t", name, ".") |
|
| 948 |
+ out, _, err := dockerCmdInDir(t, ctx.Dir, "build", "--rm", "-t", name, ".") |
|
| 949 | 949 |
|
| 950 |
- if err != nil || exitCode != 0 {
|
|
| 950 |
+ if err != nil {
|
|
| 951 | 951 |
t.Fatal("failed to build the image", out)
|
| 952 | 952 |
} |
| 953 | 953 |
|
| ... | ... |
@@ -968,9 +952,9 @@ func TestBuildRm(t *testing.T) {
|
| 968 | 968 |
t.Fatalf("failed to get the container count: %s", err)
|
| 969 | 969 |
} |
| 970 | 970 |
|
| 971 |
- out, exitCode, err := dockerCmdInDir(t, ctx.Dir, "build", "-t", name, ".") |
|
| 971 |
+ out, _, err := dockerCmdInDir(t, ctx.Dir, "build", "-t", name, ".") |
|
| 972 | 972 |
|
| 973 |
- if err != nil || exitCode != 0 {
|
|
| 973 |
+ if err != nil {
|
|
| 974 | 974 |
t.Fatal("failed to build the image", out)
|
| 975 | 975 |
} |
| 976 | 976 |
|
| ... | ... |
@@ -991,9 +975,9 @@ func TestBuildRm(t *testing.T) {
|
| 991 | 991 |
t.Fatalf("failed to get the container count: %s", err)
|
| 992 | 992 |
} |
| 993 | 993 |
|
| 994 |
- out, exitCode, err := dockerCmdInDir(t, ctx.Dir, "build", "--rm=false", "-t", name, ".") |
|
| 994 |
+ out, _, err := dockerCmdInDir(t, ctx.Dir, "build", "--rm=false", "-t", name, ".") |
|
| 995 | 995 |
|
| 996 |
- if err != nil || exitCode != 0 {
|
|
| 996 |
+ if err != nil {
|
|
| 997 | 997 |
t.Fatal("failed to build the image", out)
|
| 998 | 998 |
} |
| 999 | 999 |
|
| ... | ... |
@@ -1335,7 +1319,9 @@ func TestBuildOnBuildLimitedInheritence(t *testing.T) {
|
| 1335 | 1335 |
} |
| 1336 | 1336 |
|
| 1337 | 1337 |
out1, _, err := dockerCmdInDir(t, ctx.Dir, "build", "-t", name1, ".") |
| 1338 |
- errorOut(err, t, fmt.Sprintf("build failed to complete: %v %v", out1, err))
|
|
| 1338 |
+ if err != nil {
|
|
| 1339 |
+ t.Fatalf("build failed to complete: %s, %v", out1, err)
|
|
| 1340 |
+ } |
|
| 1339 | 1341 |
defer deleteImages(name1) |
| 1340 | 1342 |
} |
| 1341 | 1343 |
{
|
| ... | ... |
@@ -1349,7 +1335,9 @@ func TestBuildOnBuildLimitedInheritence(t *testing.T) {
|
| 1349 | 1349 |
} |
| 1350 | 1350 |
|
| 1351 | 1351 |
out2, _, err = dockerCmdInDir(t, ctx.Dir, "build", "-t", name2, ".") |
| 1352 |
- errorOut(err, t, fmt.Sprintf("build failed to complete: %v %v", out2, err))
|
|
| 1352 |
+ if err != nil {
|
|
| 1353 |
+ t.Fatalf("build failed to complete: %s, %v", out2, err)
|
|
| 1354 |
+ } |
|
| 1353 | 1355 |
defer deleteImages(name2) |
| 1354 | 1356 |
} |
| 1355 | 1357 |
{
|
| ... | ... |
@@ -1363,7 +1351,10 @@ func TestBuildOnBuildLimitedInheritence(t *testing.T) {
|
| 1363 | 1363 |
} |
| 1364 | 1364 |
|
| 1365 | 1365 |
out3, _, err = dockerCmdInDir(t, ctx.Dir, "build", "-t", name3, ".") |
| 1366 |
- errorOut(err, t, fmt.Sprintf("build failed to complete: %v %v", out3, err))
|
|
| 1366 |
+ if err != nil {
|
|
| 1367 |
+ t.Fatalf("build failed to complete: %s, %v", out3, err)
|
|
| 1368 |
+ } |
|
| 1369 |
+ |
|
| 1367 | 1370 |
defer deleteImages(name3) |
| 1368 | 1371 |
} |
| 1369 | 1372 |
|
| ... | ... |
@@ -1763,8 +1754,7 @@ CMD ["cat", "/foo"]`, |
| 1763 | 1763 |
defer deleteImages(name) |
| 1764 | 1764 |
buildCmd.Stdin = context |
| 1765 | 1765 |
|
| 1766 |
- out, exitCode, err := runCommandWithOutput(buildCmd) |
|
| 1767 |
- if err != nil || exitCode != 0 {
|
|
| 1766 |
+ if out, _, err := runCommandWithOutput(buildCmd); err != nil {
|
|
| 1768 | 1767 |
t.Fatalf("build failed to complete: %v %v", out, err)
|
| 1769 | 1768 |
} |
| 1770 | 1769 |
logDone(fmt.Sprintf("build - build an image with a context tar, compression: %v", compression))
|
| ... | ... |
@@ -1782,13 +1772,11 @@ func TestBuildNoContext(t *testing.T) {
|
| 1782 | 1782 |
buildCmd := exec.Command(dockerBinary, "build", "-t", "nocontext", "-") |
| 1783 | 1783 |
buildCmd.Stdin = strings.NewReader("FROM busybox\nCMD echo ok\n")
|
| 1784 | 1784 |
|
| 1785 |
- out, exitCode, err := runCommandWithOutput(buildCmd) |
|
| 1786 |
- if err != nil || exitCode != 0 {
|
|
| 1785 |
+ if out, _, err := runCommandWithOutput(buildCmd); err != nil {
|
|
| 1787 | 1786 |
t.Fatalf("build failed to complete: %v %v", out, err)
|
| 1788 | 1787 |
} |
| 1789 | 1788 |
|
| 1790 |
- out, exitCode, err = cmd(t, "run", "nocontext") |
|
| 1791 |
- if out != "ok\n" {
|
|
| 1789 |
+ if out, _, err := cmd(t, "run", "nocontext"); out != "ok\n" || err != nil {
|
|
| 1792 | 1790 |
t.Fatalf("run produced invalid output: %q, expected %q", out, "ok")
|
| 1793 | 1791 |
} |
| 1794 | 1792 |
|
| ... | ... |
@@ -2717,7 +2705,7 @@ func TestBuildExoticShellInterpolation(t *testing.T) {
|
| 2717 | 2717 |
|
| 2718 | 2718 |
_, err := buildImage(name, ` |
| 2719 | 2719 |
FROM busybox |
| 2720 |
- |
|
| 2720 |
+ |
|
| 2721 | 2721 |
ENV SOME_VAR a.b.c |
| 2722 | 2722 |
|
| 2723 | 2723 |
RUN [ "$SOME_VAR" = 'a.b.c' ] |