Fix tests that fail with true read only

Mounting a directory inside a read only container requires that to be
created in advance, but `runc` worked around that if the rootfs was not
originally read only.

You cannot even bind mount a file that does not exist into a
read only container.

The containerd test is given a disk, as running on an overlay does
not work; however it is also disabled as one of the parts of the test
is failing, needs investigation.

Signed-off-by: Justin Cormack <justin.cormack@docker.com>
This commit is contained in:
Justin Cormack 2017-07-28 15:51:43 +01:00
parent eacce1d52e
commit b3378652e3
20 changed files with 11 additions and 20 deletions

View File

@ -9,7 +9,6 @@ onboot:
image: linuxkit/binfmt:257b5174a8e33bc62d5448cc026d72cae3713628
- name: test
image: alpine:3.6
readonly: true
binds:
- /check.sh:/check.sh
- /proc/sys/fs/binfmt_misc:/binfmt_misc

View File

@ -8,7 +8,6 @@ init:
onboot:
- name: test
image: alpine:3.6
readonly: true
binds:
- /check.sh:/check.sh
- /etc:/host-etc

View File

@ -12,8 +12,13 @@ onboot:
command: ["/sbin/dhcpcd", "--nobackground", "-f", "/dhcpcd.conf", "-1"]
- name: sysctl
image: linuxkit/sysctl:3f7a3f6f9e7e1d3f245c766fcf5c2b9e97382cfb
- name: format
image: linuxkit/format:efafddf9bc6165b5efaf09c532c15a1100a10e61
- name: mount
image: linuxkit/mount:54990a6a69cb3ead4da8a9c1f0b651e27aea8d3f
command: ["/usr/bin/mountie", "/var"]
- name: test
image: linuxkit/test-containerd:dd3f2ba599c70994ba875e7c86c04df2967e3144
image: linuxkit/test-containerd:325508d66a3a0afebe2fa0fd1a0325ae0c4d4613
- name: poweroff
image: linuxkit/poweroff:3845c4d64d47a1ea367806be5547e44594b0fa91
trust:

View File

@ -1,6 +1,6 @@
#!/bin/sh
# SUMMARY: Run containerd test
# LABELS:
# LABELS: skip
# REPEAT:
set -e
@ -16,7 +16,7 @@ trap clean_up EXIT
# Test code goes here
moby build test-containerd.yml
RESULT="$(linuxkit run -mem 2048 test-containerd)"
RESULT="$(linuxkit run -mem 2048 -disk size=2G test-containerd)"
echo "${RESULT}" | grep -q "suite PASSED"
exit 0

View File

@ -10,7 +10,6 @@ onboot:
command: ["/sbin/dhcpcd", "--nobackground", "-f", "/dhcpcd.conf", "-1"]
- name: test
image: alpine:3.6
readonly: true
net: host
binds:
- /check.sh:/check.sh

View File

@ -13,7 +13,6 @@ onboot:
command: ["/usr/bin/mountie", "/var/lib/docker"]
- name: test
image: alpine:3.6
readonly: true
binds:
- /var/lib/docker:/var/lib/docker
- /check.sh:/check.sh

View File

@ -13,7 +13,6 @@ onboot:
command: ["/usr/bin/mountie", "-label", "docker", "/var/lib/docker"]
- name: test
image: alpine:3.6
readonly: true
binds:
- /var/lib/docker:/var/lib/docker
- /check.sh:/check.sh

View File

@ -13,7 +13,6 @@ onboot:
command: ["/usr/bin/mountie", "-device", "@DEVICE@1", "/var/lib/docker"]
- name: test
image: alpine:3.6
readonly: true
binds:
- /var/lib/docker:/var/lib/docker
- /check.sh:/check.sh

View File

@ -20,7 +20,6 @@ onboot:
command: ["/usr/bin/mountie", "/var/lib/docker"]
- name: test
image: alpine:3.6
readonly: true
binds:
- /var/lib/docker:/var/lib/docker
- /check.sh:/check.sh

View File

@ -13,7 +13,6 @@ onboot:
command: ["/usr/bin/mountie", "/var/lib/docker"]
- name: test
image: alpine:3.6
readonly: true
binds:
- /var/lib/docker:/var/lib/docker
- /check.sh:/check.sh

View File

@ -19,7 +19,6 @@ onboot:
command: ["/usr/bin/mountie", "-label", "foo", "/var/foo"]
- name: test
image: alpine:3.6
readonly: true
binds:
- /var/lib/docker:/var/lib/docker
- /var/foo:/var/foo

View File

@ -12,7 +12,6 @@ onboot:
command: ["/usr/bin/mountie", "/var/lib/docker"]
- name: test
image: alpine:3.6
readonly: true
binds:
- /var/lib/docker:/var/lib/docker
command: ["touch", "/var/lib/docker/bar"]

View File

@ -12,7 +12,6 @@ onboot:
command: ["/usr/bin/mountie", "/var/lib/docker"]
- name: test
image: alpine:3.6
readonly: true
binds:
- /var/lib/docker:/var/lib/docker
- /check.sh:/check.sh

View File

@ -20,7 +20,6 @@ onboot:
command: ["/usr/bin/mountie", "/var/lib/docker"]
- name: test
image: alpine:3.6
readonly: true
binds:
- /var/lib/docker:/var/lib/docker
command: ["touch", "/var/lib/docker/bar"]

View File

@ -20,7 +20,6 @@ onboot:
command: ["/usr/bin/mountie", "/var/lib/docker"]
- name: test
image: alpine:3.6
readonly: true
binds:
- /var/lib/docker:/var/lib/docker
- /check.sh:/check.sh

View File

@ -13,7 +13,6 @@ onboot:
command: ["/usr/bin/mountie", "/var/lib/docker"]
- name: test
image: alpine:3.6
readonly: true
binds:
- /var/lib/docker:/var/lib/docker
command: ["touch", "/var/lib/docker/bar"]

View File

@ -13,7 +13,6 @@ onboot:
command: ["/usr/bin/mountie", "/var/lib/docker"]
- name: test
image: alpine:3.6
readonly: true
binds:
- /var/lib/docker:/var/lib/docker
- /check.sh:/check.sh

View File

@ -12,7 +12,6 @@ onboot:
net: host
pid: host
ipc: host
readonly: true
binds:
- /check.sh:/check.sh
command: ["sh", "./check.sh"]

View File

@ -31,4 +31,4 @@ RUN git checkout $CONTAINERD_COMMIT
ADD run.sh ./run.sh
ENTRYPOINT ["/bin/sh", "run.sh"]
LABEL org.mobyproject.config='{"net": "host", "capabilities": ["all"], "tmpfs": ["/tmp:exec"], "binds": ["/dev:/dev", "/etc/resolv.conf:/etc/resolv.conf", "/usr/bin/runc:/usr/bin/runc", "/usr/bin/containerd:/usr/bin/containerd", "/usr/bin/containerd-shim:/usr/bin/containerd-shim"], "mounts": [{"type": "cgroup", "options": ["rw","nosuid","noexec","nodev","relatime"]}],}'
LABEL org.mobyproject.config='{"net": "host", "capabilities": ["all"], "tmpfs": ["/tmp:exec"], "binds": ["/dev:/dev", "/var:/var", "/etc/resolv.conf:/etc/resolv.conf", "/usr/bin/runc:/usr/bin/runc", "/usr/bin/containerd:/usr/bin/containerd", "/usr/bin/containerd-shim:/usr/bin/containerd-shim"], "mounts": [{"type": "cgroup", "options": ["rw","nosuid","noexec","nodev","relatime"]}],}'

View File

@ -7,6 +7,8 @@ ENV DOCKER_CHECK_CONFIG_COMMIT=72cda6a6c2f25854bea2d69168082684f2c9feca
ADD https://raw.githubusercontent.com/docker/docker/${DOCKER_CHECK_CONFIG_COMMIT}/contrib/check-config.sh /out/check-config.sh
ADD . ./out
RUN mkdir -p /out/lib/modules
FROM scratch
COPY --from=mirror /out /
ENTRYPOINT ["/bin/sh", "/check.sh"]