diff --git a/tests/images/customize.sh b/tests/images/customize.sh index ae55a9307..7a61d4000 100755 --- a/tests/images/customize.sh +++ b/tests/images/customize.sh @@ -145,28 +145,44 @@ qemu_disk() { } assert() { - grep -Fq "$1" log + if grep -Fq "$1" log; then + echo "Assertion passed: '$1' found in log" + return 0 + else + echo "Assertion failed: '$1' not found in log" + return 1 + fi +} + +assert_not() { + if grep -Fq "$1" log; then + echo "Assertion failed: '$1' not found in log" + return 1 + else + echo "Assertion passed: '$1' found in log" + return 0 + fi } check_live_noinstall() { assert @applied-live-ign@ assert @applied-live-2-ign@ - ! assert @applied-dest-ign@ - ! assert @applied-dest-2-ign@ + assert_not @applied-dest-ign@ + assert_not @applied-dest-2-ign@ assert @did-not-install@ - ! assert @preinst-1@ - ! assert @preinst-2@ - ! assert @postinst-1@ - ! assert @postinst-2@ + assert_not @preinst-1@ + assert_not @preinst-2@ + assert_not @postinst-1@ + assert_not @postinst-2@ assert 'Adding "coreos-installer test certificate" to list of CAs' } check_live_install() { assert @applied-live-ign@ assert @applied-live-2-ign@ - ! assert @applied-dest-ign@ - ! assert @applied-dest-2-ign@ - ! assert @did-not-install@ + assert_not @applied-dest-ign@ + assert_not @applied-dest-2-ign@ + assert_not @did-not-install@ assert @preinst-1@ assert @preinst-2@ assert @postinst-1@ @@ -175,14 +191,14 @@ check_live_install() { } check_dest() { - ! assert @applied-live-ign@ - ! assert @applied-live-2-ign@ + assert_not @applied-live-ign@ + assert_not @applied-live-2-ign@ assert @applied-dest-ign@ assert @applied-dest-2-ign@ - ! assert @preinst-1@ - ! assert @preinst-2@ - ! assert @postinst-1@ - ! assert @postinst-2@ + assert_not @preinst-1@ + assert_not @preinst-2@ + assert_not @postinst-1@ + assert_not @postinst-2@ assert 'Adding "coreos-installer test certificate" to list of CAs' }