Rewrite TestBuildCopyDirContentToRoot to not use fixtures
Signed-off-by: Alexandr Morozov <lk4d4@docker.com>
This commit is contained in:
parent
24d83afd52
commit
832618afc6
3 changed files with 18 additions and 14 deletions
|
@ -1,8 +0,0 @@
|
|||
FROM busybox
|
||||
RUN echo 'dockerio:x:1001:1001::/bin:/bin/false' >> /etc/passwd
|
||||
RUN echo 'dockerio:x:1001:' >> /etc/group
|
||||
RUN touch /exists
|
||||
RUN chown dockerio.dockerio exists
|
||||
COPY test_dir /
|
||||
RUN [ $(ls -l /test_file | awk '{print $3":"$4}') = 'root:root' ]
|
||||
RUN [ $(ls -l /exists | awk '{print $3":"$4}') = 'dockerio:dockerio' ]
|
|
@ -736,13 +736,25 @@ RUN [ $(ls -l /exists | awk '{print $3":"$4}') = 'dockerio:dockerio' ]`,
|
|||
}
|
||||
|
||||
func TestBuildCopyDirContentToRoot(t *testing.T) {
|
||||
buildDirectory := filepath.Join(workingDirectory, "build_tests", "TestCopy")
|
||||
if out, _, err := dockerCmdInDir(t, buildDirectory, "build", "-t", "testcopyimg", "DirContentToRoot"); err != nil {
|
||||
t.Fatalf("build failed to complete: %s, %v", out, err)
|
||||
name := "testcopydircontenttoroot"
|
||||
defer deleteImages(name)
|
||||
ctx, err := fakeContext(`FROM busybox
|
||||
RUN echo 'dockerio:x:1001:1001::/bin:/bin/false' >> /etc/passwd
|
||||
RUN echo 'dockerio:x:1001:' >> /etc/group
|
||||
RUN touch /exists
|
||||
RUN chown dockerio.dockerio exists
|
||||
COPY test_dir /
|
||||
RUN [ $(ls -l /test_file | awk '{print $3":"$4}') = 'root:root' ]
|
||||
RUN [ $(ls -l /exists | awk '{print $3":"$4}') = 'dockerio:dockerio' ]`,
|
||||
map[string]string{
|
||||
"test_dir/test_file": "test1",
|
||||
})
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
if _, err := buildImageFromContext(name, ctx, true); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
|
||||
deleteImages("testcopyimg")
|
||||
|
||||
logDone("build - copy directory contents to root")
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue