Signed-off-by: Alexandr Morozov <lk4d4@docker.com>
| 1 | 1 |
deleted file mode 100644 |
| ... | ... |
@@ -1,8 +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 |
-ADD test_dir / |
|
| 7 |
-RUN [ $(ls -l /test_file | awk '{print $3":"$4}') = 'root:root' ]
|
|
| 8 |
-RUN [ $(ls -l /exists | awk '{print $3":"$4}') = 'dockerio:dockerio' ]
|
| ... | ... |
@@ -221,16 +221,25 @@ RUN [ $(ls -l /exists | awk '{print $3":"$4}') = 'dockerio:dockerio' ]`,
|
| 221 | 221 |
} |
| 222 | 222 |
|
| 223 | 223 |
func TestBuildAddDirContentToRoot(t *testing.T) {
|
| 224 |
- buildDirectory := filepath.Join(workingDirectory, "build_tests", "TestAdd") |
|
| 225 |
- out, exitCode, err := dockerCmdInDir(t, buildDirectory, "build", "-t", "testaddimg", "DirContentToRoot") |
|
| 226 |
- errorOut(err, t, fmt.Sprintf("build failed to complete: %v %v", out, err))
|
|
| 227 |
- |
|
| 228 |
- if err != nil || exitCode != 0 {
|
|
| 229 |
- t.Fatal("failed to build the image")
|
|
| 224 |
+ name := "testadddircontenttoroot" |
|
| 225 |
+ defer deleteImages(name) |
|
| 226 |
+ ctx, err := fakeContext(`FROM busybox |
|
| 227 |
+RUN echo 'dockerio:x:1001:1001::/bin:/bin/false' >> /etc/passwd |
|
| 228 |
+RUN echo 'dockerio:x:1001:' >> /etc/group |
|
| 229 |
+RUN touch /exists |
|
| 230 |
+RUN chown dockerio.dockerio exists |
|
| 231 |
+ADD test_dir / |
|
| 232 |
+RUN [ $(ls -l /test_file | awk '{print $3":"$4}') = 'root:root' ]
|
|
| 233 |
+RUN [ $(ls -l /exists | awk '{print $3":"$4}') = 'dockerio:dockerio' ]`,
|
|
| 234 |
+ map[string]string{
|
|
| 235 |
+ "test_dir/test_file": "test1", |
|
| 236 |
+ }) |
|
| 237 |
+ if err != nil {
|
|
| 238 |
+ t.Fatal(err) |
|
| 239 |
+ } |
|
| 240 |
+ if _, err := buildImageFromContext(name, ctx, true); err != nil {
|
|
| 241 |
+ t.Fatal(err) |
|
| 230 | 242 |
} |
| 231 |
- |
|
| 232 |
- deleteImages("testaddimg")
|
|
| 233 |
- |
|
| 234 | 243 |
logDone("build - add directory contents to root")
|
| 235 | 244 |
} |
| 236 | 245 |
|