From faba07823689f68004892ef540d0ee594318964e Mon Sep 17 00:00:00 2001 From: Luca BRUNO Date: Mon, 14 Dec 2020 10:36:00 +0000 Subject: [PATCH] tests/ignition: check file ownership for system users This ensure that entries in Ignition configuration can reference system users even if not present in ostree commit (e.g. `zincati). --- tests/kola/ignition/sysusers/config.fcc | 12 ++++++++++++ tests/kola/ignition/sysusers/test.sh | 20 ++++++++++++++++++++ 2 files changed, 32 insertions(+) create mode 100644 tests/kola/ignition/sysusers/config.fcc create mode 100755 tests/kola/ignition/sysusers/test.sh diff --git a/tests/kola/ignition/sysusers/config.fcc b/tests/kola/ignition/sysusers/config.fcc new file mode 100644 index 0000000000..d42a6d19c4 --- /dev/null +++ b/tests/kola/ignition/sysusers/config.fcc @@ -0,0 +1,12 @@ +--- +variant: fcos +version: 1.0.0 +storage: + files: + - path: /etc/zincati/config.d/00-dummy-placeholder.toml + mode: 0644 + user: + name: "zincati" + contents: + inline: | + # Dummy placeholder diff --git a/tests/kola/ignition/sysusers/test.sh b/tests/kola/ignition/sysusers/test.sh new file mode 100755 index 0000000000..9e2030bd48 --- /dev/null +++ b/tests/kola/ignition/sysusers/test.sh @@ -0,0 +1,20 @@ +#!/usr/bin/env bash +set -euo pipefail + +ok() { + echo "ok" "$@" +} + +fatal() { + echo "$@" >&2 + exit 1 +} + +TARGET="/etc/zincati/config.d/00-dummy-placeholder.toml" +OWNER=$(stat -c '%U' "${TARGET}") + +# make sure the placeholder file is owned by the proper system user. +if test "${OWNER}" != 'zincati' ; then + fatal "unexpected owner of ${TARGET}: ${OWNER}" +fi +ok "placeholder file correctly owned by zincati user"