Skip to content

Commit

Permalink
test/images/customize: add debug logic to give better feedback
Browse files Browse the repository at this point in the history
  • Loading branch information
prestist committed Jun 5, 2024
1 parent 7f81dac commit 2479a4d
Showing 1 changed file with 87 additions and 16 deletions.
103 changes: 87 additions & 16 deletions tests/images/customize.sh
Original file line number Diff line number Diff line change
Expand Up @@ -145,44 +145,115 @@ 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() {
echo "Checking assertion: @applied-live-ign@"
assert @applied-live-ign@

echo "Checking assertion: @applied-live-2-ign@"
assert @applied-live-2-ign@
! assert @applied-dest-ign@
! assert @applied-dest-2-ign@

echo "Checking assertion: @applied-dest-ign@ should not be present"
assert_not @applied-dest-ign@

echo "Checking assertion: @applied-dest-2-ign@ should not be present"
assert_not @applied-dest-2-ign@

echo "Checking assertion: @did-not-install@"
assert @did-not-install@
! assert @preinst-1@
! assert @preinst-2@
! assert @postinst-1@
! assert @postinst-2@

echo "Checking assertion: @preinst-1@ should not be present"
assert_not @preinst-1@

echo "Checking assertion: @preinst-2@ should not be present"
assert_not @preinst-2@

echo "Checking assertion: @postinst-1@ should not be present"
assert_not @postinst-1@

echo "Checking assertion: @postinst-2@ should not be present"
assert_not @postinst-2@

echo 'Checking assertion: Adding "coreos-installer test certificate" to list of CAs'
assert 'Adding "coreos-installer test certificate" to list of CAs'
}

check_live_install() {
echo "Checking assertion: @applied-live-ign@"
assert @applied-live-ign@

echo "Checking assertion: @applied-live-2-ign@"
assert @applied-live-2-ign@
! assert @applied-dest-ign@
! assert @applied-dest-2-ign@
! assert @did-not-install@

echo "Checking assertion: @applied-dest-ign@ should not be present"
assert_not @applied-dest-ign@

echo "Checking assertion: @applied-dest-2-ign@ should not be present"
assert_not @applied-dest-2-ign@

echo "Checking assertion: @did-not-install@ should not be present"
assert_not @did-not-install@

echo "Checking assertion: @preinst-1@"
assert @preinst-1@

echo "Checking assertion: @preinst-2@"
assert @preinst-2@

echo "Checking assertion: @postinst-1@"
assert @postinst-1@

echo "Checking assertion: @postinst-2@"
assert @postinst-2@

echo 'Checking assertion: Adding "coreos-installer test certificate" to list of CAs'
assert 'Adding "coreos-installer test certificate" to list of CAs'
}

check_dest() {
! assert @applied-live-ign@
! assert @applied-live-2-ign@
echo "Checking assertion: @applied-live-ign@ should not be present"
assert_not @applied-live-ign@

echo "Checking assertion: @applied-live-2-ign@ should not be present"
assert_not @applied-live-2-ign@

echo "Checking assertion: @applied-dest-ign@"
assert @applied-dest-ign@

echo "Checking assertion: @applied-dest-2-ign@"
assert @applied-dest-2-ign@
! assert @preinst-1@
! assert @preinst-2@
! assert @postinst-1@
! assert @postinst-2@

echo "Checking assertion: @preinst-1@ should not be present"
assert_not @preinst-1@

echo "Checking assertion: @preinst-2@ should not be present"
assert_not @preinst-2@

echo "Checking assertion: @postinst-1@ should not be present"
assert_not @postinst-1@

echo "Checking assertion: @postinst-2@ should not be present"
assert_not @postinst-2@

echo 'Checking assertion: Adding "coreos-installer test certificate" to list of CAs'
assert 'Adding "coreos-installer test certificate" to list of CAs'
}

Expand Down

0 comments on commit 2479a4d

Please sign in to comment.