|
@@ -690,15 +690,15 @@ func TestBuildSixtySteps(t *testing.T) {
|
|
|
func TestBuildAddSingleFileToRoot(t *testing.T) {
|
|
|
name := "testaddimg"
|
|
|
defer deleteImages(name)
|
|
|
- ctx, err := fakeContext(`FROM busybox
|
|
|
+ ctx, err := fakeContext(fmt.Sprintf(`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 /
|
|
|
RUN [ $(ls -l /test_file | awk '{print $3":"$4}') = 'root:root' ]
|
|
|
-RUN [ $(ls -l /test_file | awk '{print $1}') = '-rw-r--r--' ]
|
|
|
-RUN [ $(ls -l /exists | awk '{print $3":"$4}') = 'dockerio:dockerio' ]`,
|
|
|
+RUN [ $(ls -l /test_file | awk '{print $1}') = '%s' ]
|
|
|
+RUN [ $(ls -l /exists | awk '{print $3":"$4}') = 'dockerio:dockerio' ]`, expectedFileChmod),
|
|
|
map[string]string{
|
|
|
"test_file": "test1",
|
|
|
})
|
|
@@ -1263,7 +1263,7 @@ RUN [ $(ls -l /exists/test_file | awk '{print $3":"$4}') = 'root:root' ]`,
|
|
|
func TestBuildAddWholeDirToRoot(t *testing.T) {
|
|
|
name := "testaddwholedirtoroot"
|
|
|
defer deleteImages(name)
|
|
|
- ctx, err := fakeContext(`FROM busybox
|
|
|
+ ctx, err := fakeContext(fmt.Sprintf(`FROM busybox
|
|
|
RUN echo 'dockerio:x:1001:1001::/bin:/bin/false' >> /etc/passwd
|
|
|
RUN echo 'dockerio:x:1001:' >> /etc/group
|
|
|
RUN touch /exists
|
|
@@ -1272,8 +1272,8 @@ ADD test_dir /test_dir
|
|
|
RUN [ $(ls -l / | grep test_dir | awk '{print $3":"$4}') = 'root:root' ]
|
|
|
RUN [ $(ls -l / | grep test_dir | awk '{print $1}') = 'drwxr-xr-x' ]
|
|
|
RUN [ $(ls -l /test_dir/test_file | awk '{print $3":"$4}') = 'root:root' ]
|
|
|
-RUN [ $(ls -l /test_dir/test_file | awk '{print $1}') = '-rw-r--r--' ]
|
|
|
-RUN [ $(ls -l /exists | awk '{print $3":"$4}') = 'dockerio:dockerio' ]`,
|
|
|
+RUN [ $(ls -l /test_dir/test_file | awk '{print $1}') = '%s' ]
|
|
|
+RUN [ $(ls -l /exists | awk '{print $3":"$4}') = 'dockerio:dockerio' ]`, expectedFileChmod),
|
|
|
map[string]string{
|
|
|
"test_dir/test_file": "test1",
|
|
|
})
|
|
@@ -1336,15 +1336,15 @@ RUN [ $(ls -l /usr/bin/suidbin | awk '{print $1}') = '-rwsr-xr-x' ]`,
|
|
|
func TestBuildCopySingleFileToRoot(t *testing.T) {
|
|
|
name := "testcopysinglefiletoroot"
|
|
|
defer deleteImages(name)
|
|
|
- ctx, err := fakeContext(`FROM busybox
|
|
|
+ ctx, err := fakeContext(fmt.Sprintf(`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_file /
|
|
|
RUN [ $(ls -l /test_file | awk '{print $3":"$4}') = 'root:root' ]
|
|
|
-RUN [ $(ls -l /test_file | awk '{print $1}') = '-rw-r--r--' ]
|
|
|
-RUN [ $(ls -l /exists | awk '{print $3":"$4}') = 'dockerio:dockerio' ]`,
|
|
|
+RUN [ $(ls -l /test_file | awk '{print $1}') = '%s' ]
|
|
|
+RUN [ $(ls -l /exists | awk '{print $3":"$4}') = 'dockerio:dockerio' ]`, expectedFileChmod),
|
|
|
map[string]string{
|
|
|
"test_file": "test1",
|
|
|
})
|
|
@@ -1496,7 +1496,7 @@ RUN [ $(ls -l /exists/test_file | awk '{print $3":"$4}') = 'root:root' ]`,
|
|
|
func TestBuildCopyWholeDirToRoot(t *testing.T) {
|
|
|
name := "testcopywholedirtoroot"
|
|
|
defer deleteImages(name)
|
|
|
- ctx, err := fakeContext(`FROM busybox
|
|
|
+ ctx, err := fakeContext(fmt.Sprintf(`FROM busybox
|
|
|
RUN echo 'dockerio:x:1001:1001::/bin:/bin/false' >> /etc/passwd
|
|
|
RUN echo 'dockerio:x:1001:' >> /etc/group
|
|
|
RUN touch /exists
|
|
@@ -1505,8 +1505,8 @@ COPY test_dir /test_dir
|
|
|
RUN [ $(ls -l / | grep test_dir | awk '{print $3":"$4}') = 'root:root' ]
|
|
|
RUN [ $(ls -l / | grep test_dir | awk '{print $1}') = 'drwxr-xr-x' ]
|
|
|
RUN [ $(ls -l /test_dir/test_file | awk '{print $3":"$4}') = 'root:root' ]
|
|
|
-RUN [ $(ls -l /test_dir/test_file | awk '{print $1}') = '-rw-r--r--' ]
|
|
|
-RUN [ $(ls -l /exists | awk '{print $3":"$4}') = 'dockerio:dockerio' ]`,
|
|
|
+RUN [ $(ls -l /test_dir/test_file | awk '{print $1}') = '%s' ]
|
|
|
+RUN [ $(ls -l /exists | awk '{print $3":"$4}') = 'dockerio:dockerio' ]`, expectedFileChmod),
|
|
|
map[string]string{
|
|
|
"test_dir/test_file": "test1",
|
|
|
})
|