mirror of
https://github.com/moby/moby.git
synced 2022-11-09 12:21:53 -05:00
Rewrite TestBuildCopySingleFileToExistDir to not use fixtures
Signed-off-by: Alexandr Morozov <lk4d4@docker.com>
This commit is contained in:
parent
d41cba6aed
commit
2248109ff8
3 changed files with 20 additions and 16 deletions
|
@ -1,10 +0,0 @@
|
||||||
FROM busybox
|
|
||||||
RUN echo 'dockerio:x:1001:1001::/bin:/bin/false' >> /etc/passwd
|
|
||||||
RUN echo 'dockerio:x:1001:' >> /etc/group
|
|
||||||
RUN mkdir /exists
|
|
||||||
RUN touch /exists/exists_file
|
|
||||||
RUN chown -R dockerio.dockerio /exists
|
|
||||||
COPY test_file /exists/
|
|
||||||
RUN [ $(ls -l / | grep exists | awk '{print $3":"$4}') = 'dockerio:dockerio' ]
|
|
||||||
RUN [ $(ls -l /exists/test_file | awk '{print $3":"$4}') = 'root:root' ]
|
|
||||||
RUN [ $(ls -l /exists/exists_file | awk '{print $3":"$4}') = 'dockerio:dockerio' ]
|
|
|
@ -687,13 +687,27 @@ COPY test_file .`,
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestBuildCopySingleFileToExistDir(t *testing.T) {
|
func TestBuildCopySingleFileToExistDir(t *testing.T) {
|
||||||
buildDirectory := filepath.Join(workingDirectory, "build_tests", "TestCopy")
|
name := "testcopysinglefiletoexistdir"
|
||||||
if out, _, err := dockerCmdInDir(t, buildDirectory, "build", "-t", "testcopyimg", "SingleFileToExistDir"); err != nil {
|
defer deleteImages(name)
|
||||||
t.Fatalf("build failed to complete: %s, %v", out, err)
|
ctx, err := fakeContext(`FROM busybox
|
||||||
|
RUN echo 'dockerio:x:1001:1001::/bin:/bin/false' >> /etc/passwd
|
||||||
|
RUN echo 'dockerio:x:1001:' >> /etc/group
|
||||||
|
RUN mkdir /exists
|
||||||
|
RUN touch /exists/exists_file
|
||||||
|
RUN chown -R dockerio.dockerio /exists
|
||||||
|
COPY test_file /exists/
|
||||||
|
RUN [ $(ls -l / | grep exists | awk '{print $3":"$4}') = 'dockerio:dockerio' ]
|
||||||
|
RUN [ $(ls -l /exists/test_file | awk '{print $3":"$4}') = 'root:root' ]
|
||||||
|
RUN [ $(ls -l /exists/exists_file | awk '{print $3":"$4}') = 'dockerio:dockerio' ]`,
|
||||||
|
map[string]string{
|
||||||
|
"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 single file to existing dir")
|
logDone("build - copy single file to existing dir")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue