mirror of
https://github.com/moby/moby.git
synced 2022-11-09 12:21:53 -05:00
Rewrite TestAddSingleFileToExistDir to not use fixtures
Signed-off-by: Alexandr Morozov <lk4d4@docker.com>
This commit is contained in:
parent
5e2ea69606
commit
6bb44b6d74
3 changed files with 20 additions and 19 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
|
|
||||||
ADD 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' ]
|
|
|
@ -113,16 +113,27 @@ ADD test_file .`,
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestBuildAddSingleFileToExistDir(t *testing.T) {
|
func TestBuildAddSingleFileToExistDir(t *testing.T) {
|
||||||
buildDirectory := filepath.Join(workingDirectory, "build_tests", "TestAdd")
|
name := "testaddsinglefiletoexistdir"
|
||||||
out, exitCode, err := dockerCmdInDir(t, buildDirectory, "build", "-t", "testaddimg", "SingleFileToExistDir")
|
defer deleteImages(name)
|
||||||
errorOut(err, t, fmt.Sprintf("build failed to complete: %v %v", out, err))
|
ctx, err := fakeContext(`FROM busybox
|
||||||
|
RUN echo 'dockerio:x:1001:1001::/bin:/bin/false' >> /etc/passwd
|
||||||
if err != nil || exitCode != 0 {
|
RUN echo 'dockerio:x:1001:' >> /etc/group
|
||||||
t.Fatal("failed to build the image")
|
RUN mkdir /exists
|
||||||
|
RUN touch /exists/exists_file
|
||||||
|
RUN chown -R dockerio.dockerio /exists
|
||||||
|
ADD 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("testaddimg")
|
|
||||||
|
|
||||||
logDone("build - add single file to existing dir")
|
logDone("build - add single file to existing dir")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue