Signed-off-by: Alexandr Morozov <lk4d4@docker.com>
Alexandr Morozov authored on 2014/10/03 03:33:121 | 1 |
deleted file mode 100644 |
... | ... |
@@ -1,17 +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_file1 test_file2 /exists/ |
|
8 |
-ADD test_file3 test_file4 https://docker.com/robots.txt /exists/ |
|
9 |
-RUN [ $(ls -l / | grep exists | awk '{print $3":"$4}') = 'dockerio:dockerio' ] |
|
10 |
-RUN [ $(ls -l /exists/test_file1 | awk '{print $3":"$4}') = 'root:root' ] |
|
11 |
-RUN [ $(ls -l /exists/test_file2 | awk '{print $3":"$4}') = 'root:root' ] |
|
12 |
- |
|
13 |
-RUN [ $(ls -l /exists/test_file3 | awk '{print $3":"$4}') = 'root:root' ] |
|
14 |
-RUN [ $(ls -l /exists/test_file4 | awk '{print $3":"$4}') = 'root:root' ] |
|
15 |
-RUN [ $(ls -l /exists/robots.txt | awk '{print $3":"$4}') = 'root:root' ] |
|
16 |
- |
|
17 |
-RUN [ $(ls -l /exists/exists_file | awk '{print $3":"$4}') = 'dockerio:dockerio' ] |
... | ... |
@@ -304,13 +304,40 @@ RUN [ $(ls -l /exists/exists_file | awk '{print $3":"$4}') = 'dockerio:dockerio' |
304 | 304 |
} |
305 | 305 |
|
306 | 306 |
func TestBuildCopyAddMultipleFiles(t *testing.T) { |
307 |
- buildDirectory := filepath.Join(workingDirectory, "build_tests", "TestCopy") |
|
308 |
- if out, _, err := dockerCmdInDir(t, buildDirectory, "build", "-t", "testaddimg", "MultipleFiles"); err != nil { |
|
309 |
- t.Fatalf("build failed to complete: %s, %v", out, err) |
|
310 |
- } |
|
307 |
+ name := "testcopymultiplefilestofile" |
|
308 |
+ defer deleteImages(name) |
|
309 |
+ ctx, err := fakeContext(`FROM busybox |
|
310 |
+RUN echo 'dockerio:x:1001:1001::/bin:/bin/false' >> /etc/passwd |
|
311 |
+RUN echo 'dockerio:x:1001:' >> /etc/group |
|
312 |
+RUN mkdir /exists |
|
313 |
+RUN touch /exists/exists_file |
|
314 |
+RUN chown -R dockerio.dockerio /exists |
|
315 |
+COPY test_file1 test_file2 /exists/ |
|
316 |
+ADD test_file3 test_file4 https://docker.com/robots.txt /exists/ |
|
317 |
+RUN [ $(ls -l / | grep exists | awk '{print $3":"$4}') = 'dockerio:dockerio' ] |
|
318 |
+RUN [ $(ls -l /exists/test_file1 | awk '{print $3":"$4}') = 'root:root' ] |
|
319 |
+RUN [ $(ls -l /exists/test_file2 | awk '{print $3":"$4}') = 'root:root' ] |
|
311 | 320 |
|
312 |
- deleteImages("testaddimg") |
|
321 |
+RUN [ $(ls -l /exists/test_file3 | awk '{print $3":"$4}') = 'root:root' ] |
|
322 |
+RUN [ $(ls -l /exists/test_file4 | awk '{print $3":"$4}') = 'root:root' ] |
|
323 |
+RUN [ $(ls -l /exists/robots.txt | awk '{print $3":"$4}') = 'root:root' ] |
|
313 | 324 |
|
325 |
+RUN [ $(ls -l /exists/exists_file | awk '{print $3":"$4}') = 'dockerio:dockerio' ] |
|
326 |
+`, |
|
327 |
+ map[string]string{ |
|
328 |
+ "test_file1": "test1", |
|
329 |
+ "test_file2": "test2", |
|
330 |
+ "test_file3": "test3", |
|
331 |
+ "test_file4": "test4", |
|
332 |
+ }) |
|
333 |
+ defer ctx.Close() |
|
334 |
+ if err != nil { |
|
335 |
+ t.Fatal(err) |
|
336 |
+ } |
|
337 |
+ |
|
338 |
+ if _, err := buildImageFromContext(name, ctx, true); err != nil { |
|
339 |
+ t.Fatal(err) |
|
340 |
+ } |
|
314 | 341 |
logDone("build - mulitple file copy/add tests") |
315 | 342 |
} |
316 | 343 |
|