Signed-off-by: Alexandr Morozov <lk4d4@docker.com>
| 1 | 1 |
deleted file mode 100644 |
| ... | ... |
@@ -1,9 +0,0 @@ |
| 1 |
-FROM busybox |
|
| 2 |
-RUN echo 'dockerio:x:1001:1001::/bin:/bin/false' >> /etc/passwd |
|
| 3 |
-RUN echo 'dockerio:x:1001:' >> /etc/group |
|
| 4 |
-RUN touch /exists |
|
| 5 |
-RUN chown dockerio.dockerio /exists |
|
| 6 |
-COPY test_file /test_dir/ |
|
| 7 |
-RUN [ $(ls -l / | grep test_dir | awk '{print $3":"$4}') = 'root:root' ]
|
|
| 8 |
-RUN [ $(ls -l /test_dir/test_file | awk '{print $3":"$4}') = 'root:root' ]
|
|
| 9 |
-RUN [ $(ls -l /exists | awk '{print $3":"$4}') = 'dockerio:dockerio' ]
|
| ... | ... |
@@ -712,13 +712,26 @@ RUN [ $(ls -l /exists/exists_file | awk '{print $3":"$4}') = 'dockerio:dockerio'
|
| 712 | 712 |
} |
| 713 | 713 |
|
| 714 | 714 |
func TestBuildCopySingleFileToNonExistDir(t *testing.T) {
|
| 715 |
- buildDirectory := filepath.Join(workingDirectory, "build_tests", "TestCopy") |
|
| 716 |
- if out, _, err := dockerCmdInDir(t, buildDirectory, "build", "-t", "testcopyimg", "SingleFileToNonExistDir"); err != nil {
|
|
| 717 |
- t.Fatalf("build failed to complete: %s, %v", out, err)
|
|
| 715 |
+ name := "testcopysinglefiletononexistdir" |
|
| 716 |
+ defer deleteImages(name) |
|
| 717 |
+ ctx, err := fakeContext(`FROM busybox |
|
| 718 |
+RUN echo 'dockerio:x:1001:1001::/bin:/bin/false' >> /etc/passwd |
|
| 719 |
+RUN echo 'dockerio:x:1001:' >> /etc/group |
|
| 720 |
+RUN touch /exists |
|
| 721 |
+RUN chown dockerio.dockerio /exists |
|
| 722 |
+COPY test_file /test_dir/ |
|
| 723 |
+RUN [ $(ls -l / | grep test_dir | awk '{print $3":"$4}') = 'root:root' ]
|
|
| 724 |
+RUN [ $(ls -l /test_dir/test_file | awk '{print $3":"$4}') = 'root:root' ]
|
|
| 725 |
+RUN [ $(ls -l /exists | awk '{print $3":"$4}') = 'dockerio:dockerio' ]`,
|
|
| 726 |
+ map[string]string{
|
|
| 727 |
+ "test_file": "test1", |
|
| 728 |
+ }) |
|
| 729 |
+ if err != nil {
|
|
| 730 |
+ t.Fatal(err) |
|
| 731 |
+ } |
|
| 732 |
+ if _, err := buildImageFromContext(name, ctx, true); err != nil {
|
|
| 733 |
+ t.Fatal(err) |
|
| 718 | 734 |
} |
| 719 |
- |
|
| 720 |
- deleteImages("testcopyimg")
|
|
| 721 |
- |
|
| 722 | 735 |
logDone("build - copy single file to non-existing dir")
|
| 723 | 736 |
} |
| 724 | 737 |
|