From 231df444208a5fbfa851d7da032054a1fa253e1a Mon Sep 17 00:00:00 2001 From: Sohan Kunkerkar Date: Wed, 6 Apr 2022 16:17:25 -0400 Subject: [PATCH] tests: ensure that Ignition warnings are displayed on the console Follow up to https://github.com/coreos/fedora-coreos-config/pull/1621#pullrequestreview-930860551 This adds kola test coverage for displaying Ignition warnings on the console. --- tests/kola/ignition/warnings/config.ign | 14 +++++++++++++ .../kola/ignition/warnings/data/commonlib.sh | 1 + tests/kola/ignition/warnings/test.sh | 20 +++++++++++++++++++ 3 files changed, 35 insertions(+) create mode 100644 tests/kola/ignition/warnings/config.ign create mode 120000 tests/kola/ignition/warnings/data/commonlib.sh create mode 100755 tests/kola/ignition/warnings/test.sh diff --git a/tests/kola/ignition/warnings/config.ign b/tests/kola/ignition/warnings/config.ign new file mode 100644 index 0000000000..26c837bdc2 --- /dev/null +++ b/tests/kola/ignition/warnings/config.ign @@ -0,0 +1,14 @@ +{ + "ignition": { + "version": "3.3.0" + }, + "systemd": { + "units": [ + { + "contents": "[Unit]\nDescription=echo service template\n[Service]\nType=oneshot\nExecStart=/bin/echo %i\n", + "enabled": true, + "name": "echo.service" + } + ] + } +} \ No newline at end of file diff --git a/tests/kola/ignition/warnings/data/commonlib.sh b/tests/kola/ignition/warnings/data/commonlib.sh new file mode 120000 index 0000000000..b8dcbdca1a --- /dev/null +++ b/tests/kola/ignition/warnings/data/commonlib.sh @@ -0,0 +1 @@ +../../../data/commonlib.sh \ No newline at end of file diff --git a/tests/kola/ignition/warnings/test.sh b/tests/kola/ignition/warnings/test.sh new file mode 100755 index 0000000000..f9fb5c809b --- /dev/null +++ b/tests/kola/ignition/warnings/test.sh @@ -0,0 +1,20 @@ +#!/bin/bash +# kola: { "platforms": "qemu-unpriv" } +# This test ensures that Ignition warnings +# are displayed on the console. + +set -xeuo pipefail + +. $KOLA_EXT_DATA/commonlib.sh + +warningsfile="/etc/issue.d/30_coreos_ignition_warnings.issue" + +# Make sure the motd file gets created +if ! test -f ${warningsfile}; then + fatal "not found ignition warnings issue file" +fi +# Checking for the warning +if ! grep -e 'unit "echo.service" is enabled' ${warningsfile} ; then + fatal "failed to display Ignition warning on the console" +fi +ok "Successfully displayed Ignition warning on the console"