tests: Simplify sysctl test

Don't rely on systctl test package. Instead, add the check shell
script to the image and execute it with a standard Alpine image.

While at it, make the test more verbose.

Signed-off-by: Rolf Neugebauer <rolf.neugebauer@docker.com>
This commit is contained in:
Rolf Neugebauer 2017-05-27 14:53:22 +01:00
parent 4aa4129acf
commit 15a05d6260
3 changed files with 27 additions and 1 deletions

View File

@ -0,0 +1,11 @@
#!/bin/sh
function failed {
printf "sysctl test suite FAILED\n" >&1
exit 1
}
# this is a non default value, so will fail if sysctl failed
[ "$(sysctl -n fs.inotify.max_user_watches)" -eq 524288 ] || failed
printf "sysctl test suite PASSED\n" >&1

View File

@ -9,9 +9,22 @@ onboot:
- name: sysctl
image: "linuxkit/sysctl:b16a483897dd5f71be7e0c04cd090b05f52682e1"
- name: test
image: "linuxkit/test-sysctl:c4df4c4d692904d6245dcdef1f4a79389bd3d894"
image: "alpine:3.6"
net: host
pid: host
ipc: host
readonly: true
binds:
- /check.sh:/check.sh
command: ["sh", "./check.sh"]
- name: poweroff
image: "linuxkit/poweroff:a8f1e4ad8d459f1fdaad9e4b007512cb3b504ae8"
command: ["/bin/sh", "/poweroff.sh", "10"]
files:
- path: check.sh
source: ./check.sh
trust:
org:
- linuxkit
image:
- alpine:3.6

View File

@ -4,6 +4,7 @@
# REPEAT:
set -e
set -v
# Source libraries. Uncomment if needed/defined
#. "${RT_LIB}"
@ -17,6 +18,7 @@ trap clean_up EXIT
# Test code goes here
moby build -output kernel+initrd test-sysctl
RESULT="$(linuxkit run qemu -kernel test-sysctl)"
echo "${RESULT}"
echo "${RESULT}" | grep -q "suite PASSED"
exit 0