Rewrite TestAddSingleFileToNonExistDir to not use fixtures
Signed-off-by: Alexandr Morozov <lk4d4@docker.com>
This commit is contained in:
parent
6bb44b6d74
commit
139b6ed3aa
3 changed files with 19 additions and 19 deletions
|
@ -1,9 +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
|
||||
ADD test_file /test_dir/
|
||||
RUN [ $(ls -l / | grep test_dir | awk '{print $3":"$4}') = 'root:root' ]
|
||||
RUN [ $(ls -l /test_dir/test_file | awk '{print $3":"$4}') = 'root:root' ]
|
||||
RUN [ $(ls -l /exists | awk '{print $3":"$4}') = 'dockerio:dockerio' ]
|
|
@ -198,17 +198,26 @@ func TestBuildCopyMultipleFilesToFile(t *testing.T) {
|
|||
}
|
||||
|
||||
func TestBuildAddSingleFileToNonExistDir(t *testing.T) {
|
||||
buildDirectory := filepath.Join(workingDirectory, "build_tests", "TestAdd")
|
||||
out, exitCode, err := dockerCmdInDir(t, buildDirectory, "build", "-t", "testaddimg", "SingleFileToNonExistDir")
|
||||
errorOut(err, t, fmt.Sprintf("build failed to complete: %v %v", out, err))
|
||||
|
||||
if err != nil || exitCode != 0 {
|
||||
t.Fatal("failed to build the image")
|
||||
name := "testaddsinglefiletononexistdir"
|
||||
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
|
||||
ADD test_file /test_dir/
|
||||
RUN [ $(ls -l / | grep test_dir | awk '{print $3":"$4}') = 'root:root' ]
|
||||
RUN [ $(ls -l /test_dir/test_file | awk '{print $3":"$4}') = 'root:root' ]
|
||||
RUN [ $(ls -l /exists | 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 non-existing dir")
|
||||
}
|
||||
|
||||
func TestBuildAddDirContentToRoot(t *testing.T) {
|
||||
|
|
Loading…
Add table
Reference in a new issue