Skip to content

Commit

Permalink
clhm.ignition-warnings: Improve test to ignore additional warnings
Browse files Browse the repository at this point in the history
Signed-off-by: Jan Schintag <jan.schintag@de.ibm.com>
  • Loading branch information
jschintag authored and bgilbert committed May 6, 2022
1 parent 6efda1a commit 0856e21
Showing 1 changed file with 9 additions and 12 deletions.
21 changes: 9 additions & 12 deletions tests/kola/clhm/ignition-warnings/test.sh
Original file line number Diff line number Diff line change
@@ -1,31 +1,28 @@
#!/bin/bash
# kola: { "platforms": "qemu-unpriv", "allowConfigWarnings": true }
# - platforms: qemu-unpriv
# - This test should pass everywhere if it passes anywhere.
# - allowConfigWarnings: true
# - We intentionally exclude the Install section from a systemd unit.
# This is valid but not ideal, so Butane warns about it.
# - platforms: qemu-unpriv
# - This test should pass everywhere if it passes anywhere.
# - allowConfigWarnings: true
# - We intentionally exclude the Install section from a systemd unit.
# This is valid but not ideal, so Butane warns about it.
# This test ensures that Ignition warnings are displayed on the console.

set -xeuo pipefail

. $KOLA_EXT_DATA/commonlib.sh

WARN='\033[0;33m' # yellow
RESET='\033[0m' # reset
WARN='\e\[0;33m' # yellow
RESET='\e\[0m' # reset

warning="${WARN}Ignition: warning at \\$.systemd.units.0.contents: unit \"echo.service\" is enabled, but has no install section so enable does nothing${RESET}"
warningsfile="/etc/issue.d/30_coreos_ignition_warnings.issue"
tmpd=$(mktemp -d)
expectedwarningsfile="${tmpd}"/expectedwarningsfile

# Check for the motd file
if ! test -f ${warningsfile}; then
fatal "not found Ignition warnings issue file"
fi

echo -e "${WARN}Ignition: warning at $.systemd.units.0.contents: unit \"echo.service\" is enabled, but has no install section so enable does nothing${RESET}" > $expectedwarningsfile

if ! diff $expectedwarningsfile $warningsfile; then
if ! grep -P -q "${warning}" "${warningsfile}"; then
fatal "Ignition warning did not show up as expected in issue.d"
fi
ok "Successfully displayed Ignition warning on the console"

0 comments on commit 0856e21

Please sign in to comment.