Signed-off-by: Alexandr Morozov <lk4d4@docker.com>
| 1 | 1 |
deleted file mode 100644 |
| ... | ... |
@@ -1,10 +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 mkdir /exists |
|
| 5 |
-RUN touch /exists/exists_file |
|
| 6 |
-RUN chown -R dockerio.dockerio /exists |
|
| 7 |
-COPY test_file /exists/ |
|
| 8 |
-RUN [ $(ls -l / | grep exists | awk '{print $3":"$4}') = 'dockerio:dockerio' ]
|
|
| 9 |
-RUN [ $(ls -l /exists/test_file | awk '{print $3":"$4}') = 'root:root' ]
|
|
| 10 |
-RUN [ $(ls -l /exists/exists_file | awk '{print $3":"$4}') = 'dockerio:dockerio' ]
|
| ... | ... |
@@ -687,13 +687,27 @@ COPY test_file .`, |
| 687 | 687 |
} |
| 688 | 688 |
|
| 689 | 689 |
func TestBuildCopySingleFileToExistDir(t *testing.T) {
|
| 690 |
- buildDirectory := filepath.Join(workingDirectory, "build_tests", "TestCopy") |
|
| 691 |
- if out, _, err := dockerCmdInDir(t, buildDirectory, "build", "-t", "testcopyimg", "SingleFileToExistDir"); err != nil {
|
|
| 692 |
- t.Fatalf("build failed to complete: %s, %v", out, err)
|
|
| 690 |
+ name := "testcopysinglefiletoexistdir" |
|
| 691 |
+ defer deleteImages(name) |
|
| 692 |
+ ctx, err := fakeContext(`FROM busybox |
|
| 693 |
+RUN echo 'dockerio:x:1001:1001::/bin:/bin/false' >> /etc/passwd |
|
| 694 |
+RUN echo 'dockerio:x:1001:' >> /etc/group |
|
| 695 |
+RUN mkdir /exists |
|
| 696 |
+RUN touch /exists/exists_file |
|
| 697 |
+RUN chown -R dockerio.dockerio /exists |
|
| 698 |
+COPY test_file /exists/ |
|
| 699 |
+RUN [ $(ls -l / | grep exists | awk '{print $3":"$4}') = 'dockerio:dockerio' ]
|
|
| 700 |
+RUN [ $(ls -l /exists/test_file | awk '{print $3":"$4}') = 'root:root' ]
|
|
| 701 |
+RUN [ $(ls -l /exists/exists_file | awk '{print $3":"$4}') = 'dockerio:dockerio' ]`,
|
|
| 702 |
+ map[string]string{
|
|
| 703 |
+ "test_file": "test1", |
|
| 704 |
+ }) |
|
| 705 |
+ if err != nil {
|
|
| 706 |
+ t.Fatal(err) |
|
| 707 |
+ } |
|
| 708 |
+ if _, err := buildImageFromContext(name, ctx, true); err != nil {
|
|
| 709 |
+ t.Fatal(err) |
|
| 693 | 710 |
} |
| 694 |
- |
|
| 695 |
- deleteImages("testcopyimg")
|
|
| 696 |
- |
|
| 697 | 711 |
logDone("build - copy single file to existing dir")
|
| 698 | 712 |
} |
| 699 | 713 |
|