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 |
-ADD 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' ]
|
| ... | ... |
@@ -113,16 +113,27 @@ ADD test_file .`, |
| 113 | 113 |
} |
| 114 | 114 |
|
| 115 | 115 |
func TestBuildAddSingleFileToExistDir(t *testing.T) {
|
| 116 |
- buildDirectory := filepath.Join(workingDirectory, "build_tests", "TestAdd") |
|
| 117 |
- out, exitCode, err := dockerCmdInDir(t, buildDirectory, "build", "-t", "testaddimg", "SingleFileToExistDir") |
|
| 118 |
- errorOut(err, t, fmt.Sprintf("build failed to complete: %v %v", out, err))
|
|
| 119 |
- |
|
| 120 |
- if err != nil || exitCode != 0 {
|
|
| 121 |
- t.Fatal("failed to build the image")
|
|
| 116 |
+ name := "testaddsinglefiletoexistdir" |
|
| 117 |
+ defer deleteImages(name) |
|
| 118 |
+ ctx, err := fakeContext(`FROM busybox |
|
| 119 |
+RUN echo 'dockerio:x:1001:1001::/bin:/bin/false' >> /etc/passwd |
|
| 120 |
+RUN echo 'dockerio:x:1001:' >> /etc/group |
|
| 121 |
+RUN mkdir /exists |
|
| 122 |
+RUN touch /exists/exists_file |
|
| 123 |
+RUN chown -R dockerio.dockerio /exists |
|
| 124 |
+ADD test_file /exists/ |
|
| 125 |
+RUN [ $(ls -l / | grep exists | awk '{print $3":"$4}') = 'dockerio:dockerio' ]
|
|
| 126 |
+RUN [ $(ls -l /exists/test_file | awk '{print $3":"$4}') = 'root:root' ]
|
|
| 127 |
+RUN [ $(ls -l /exists/exists_file | awk '{print $3":"$4}') = 'dockerio:dockerio' ]`,
|
|
| 128 |
+ map[string]string{
|
|
| 129 |
+ "test_file": "test1", |
|
| 130 |
+ }) |
|
| 131 |
+ if err != nil {
|
|
| 132 |
+ t.Fatal(err) |
|
| 133 |
+ } |
|
| 134 |
+ if _, err := buildImageFromContext(name, ctx, true); err != nil {
|
|
| 135 |
+ t.Fatal(err) |
|
| 122 | 136 |
} |
| 123 |
- |
|
| 124 |
- deleteImages("testaddimg")
|
|
| 125 |
- |
|
| 126 | 137 |
logDone("build - add single file to existing dir")
|
| 127 | 138 |
} |
| 128 | 139 |
|