fix reversed equals error

Signed-off-by: Avi Deitcher <avi@deitcher.net>
This commit is contained in:
Avi Deitcher 2020-10-19 17:26:25 +03:00
parent f0b002718d
commit 54be4048f0
4 changed files with 66 additions and 1 deletions

View File

@ -85,7 +85,7 @@ func systemInitCmd(ctx context.Context, args []string) {
// look for containerd options
ctrdArgs := []string{}
if b, err := ioutil.ReadFile(containerdOptsFile); err != nil {
if b, err := ioutil.ReadFile(containerdOptsFile); err == nil {
ctrdArgs = strings.Fields(string(b))
}

View File

@ -0,0 +1,13 @@
#!/bin/sh
function failed {
printf "containerd commandline vars not set: FAILED\n" >/dev/console
/sbin/poweroff -f
exit 1
}
ps -ef | grep containerd | grep -q trace || failed
printf "containerd commandline vars test suite PASSED\n" >/dev/console
/sbin/poweroff -f

View File

@ -0,0 +1,24 @@
#!/bin/sh
# SUMMARY: Check that the containerd command-line options have been enabled by init
# LABELS:
# REPEAT:
set -e
# Source libraries. Uncomment if needed/defined
#. "${RT_LIB}"
. "${RT_PROJECT_ROOT}/_lib/lib.sh"
NAME=init_containerd
clean_up() {
rm -rf ${NAME}-*
}
trap clean_up EXIT
# Test code goes here
linuxkit build -format kernel+initrd -name "${NAME}" test.yml
RESULT="$(linuxkit run $NAME)"
echo "${RESULT}"
echo "${RESULT}" | grep -q "suite PASSED"
exit 0

View File

@ -0,0 +1,28 @@
kernel:
image: linuxkit/kernel:5.4.39
cmdline: "console=ttyS0 console=ttyAMA0"
init:
- linuxkit/init:4f6508f4f35b134dda3807bb5d75c117c193a86a
- linuxkit/runc:v0.8
- linuxkit/containerd:a4aa19c608556f7d786852557c36136255220c1f
- linuxkit/ca-certificates:v0.8
services:
- name: test
image: alpine:3.11
pid: host
binds:
- /check.sh:/check.sh
- /dev/console:/dev/console
capabilities:
- CAP_SYS_BOOT
command: ["sh", "/check.sh"]
files:
- path: check.sh
source: ./check.sh
- path: /etc/containerd/cli-opts
contents: "--log-level trace"
trust:
org:
- linuxkit
image:
- alpine:3.11