-
Notifications
You must be signed in to change notification settings - Fork 155
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
clhm.ignition-warnings: Improve test to ignore additional warnings
Signed-off-by: Jan Schintag <jan.schintag@de.ibm.com>
- Loading branch information
Showing
1 changed file
with
9 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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" |