Add a test case for the sysctl package

Signed-off-by: Justin Cormack <justin.cormack@docker.com>
This commit is contained in:
Justin Cormack
2017-05-19 15:41:13 +01:00
parent e12b5a36ba
commit 345a294b5e
6 changed files with 138 additions and 0 deletions

View File

@@ -0,0 +1,36 @@
kernel:
image: "linuxkit/kernel:4.9.x"
cmdline: "console=ttyS0 page_poison=1"
init:
- linuxkit/init:cbd7ae748f0a082516501a3e914fa0c924ee941e
- linuxkit/runc:24dfe632ed3ff53a026ee3fac046fd544434e2d6
- linuxkit/containerd:1c71f95fa36040ea7e987deb98a7a2a363853f01
- linuxkit/ca-certificates:4e9a83e890e6477dcd25029fc4f1ced61d0642f4
onboot:
- name: sysctl
image: "linuxkit/sysctl:2cf2f9d5b4d314ba1bfc22b2fe931924af666d8c"
net: host
pid: host
ipc: host
capabilities:
- CAP_SYS_ADMIN
readonly: true
- name: test
image: "linuxkit/test-sysctl:37315a58ec0c18a28be7e2770feb3bf38384492d"
net: host
pid: host
- name: poweroff
image: "linuxkit/poweroff:961412b8ef5c5285de0d40ec076701d955eaa084"
net: host
pid: host
command: ["/bin/sh", "/poweroff.sh", "3"]
capabilities:
- CAP_SYS_BOOT
readonly: true
trust:
image:
- linuxkit/kernel
- linuxkit/binfmt
- linuxkit/rngd
outputs:
- format: kernel+initrd

View File

@@ -0,0 +1,23 @@
#!/bin/sh
# SUMMARY: Check that the sysctl config works
# LABELS:
# REPEAT:
# AUTHOR: Justin Cormack <justin.cormack@docker.com>
set -e
# Source libraries. Uncomment if needed/defined
#. "${RT_LIB}"
. "${RT_PROJECT_ROOT}/_lib/lib.sh"
clean_up() {
find . -iname "test-sysctl*" -not -iname "*.yml" -exec rm -rf {} \;
}
trap clean_up EXIT
# Test code goes here
moby build test-sysctl
RESULT="$(linuxkit run qemu test-sysctl)"
echo "${RESULT}" | grep -q "suite PASSED"
exit 0

View File

@@ -0,0 +1,36 @@
#!/bin/sh
# SUMMARY: LinuxKit package tests
# LABELS:
# For the top level group.sh also specify a 'NAME:' comment
# Source libraries. Uncomment if needed/defined
#. "${RT_LIB}"
#. "${RT_PROJECT_ROOT}/_lib/lib.sh"
group_init() {
# Group initialisation code goes here
return 0
}
group_deinit() {
# Group de-initialisation code goes here
return 0
}
CMD=$1
case $CMD in
init)
group_init
res=$?
;;
deinit)
group_deinit
res=$?
;;
*)
res=1
;;
esac
exit $res