Skip to content

Commit

Permalink
customize: add debug logic
Browse files Browse the repository at this point in the history
  • Loading branch information
prestist committed May 29, 2024
1 parent 31d2e78 commit be04223
Showing 1 changed file with 91 additions and 30 deletions.
121 changes: 91 additions & 30 deletions tests/images/customize.sh
Original file line number Diff line number Diff line change
Expand Up @@ -145,45 +145,106 @@ 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
}

check_live_noinstall() {
assert @applied-live-ign@
assert @applied-live-2-ign@
! assert @applied-dest-ign@
! assert @applied-dest-2-ign@
assert @did-not-install@
! assert @preinst-1@
! assert @preinst-2@
! assert @postinst-1@
! assert @postinst-2@
assert 'Adding "coreos-installer test certificate" to list of CAs'
echo "Checking assertion: @applied-live-ign@"
assert @applied-live-ign@ || { echo "Failed assertion: @applied-live-ign@"; return 1; }

echo "Checking assertion: @applied-live-2-ign@"
assert @applied-live-2-ign@ || { echo "Failed assertion: @applied-live-2-ign@"; return 1; }

echo "Checking assertion: @applied-dest-ign@ should not be present"
! assert @applied-dest-ign@ || { echo "Failed assertion: @applied-dest-ign@ should not be present"; return 1; }

echo "Checking assertion: @applied-dest-2-ign@ should not be present"
! assert @applied-dest-2-ign@ || { echo "Failed assertion: @applied-dest-2-ign@ should not be present"; return 1; }

echo "Checking assertion: @did-not-install@"
assert @did-not-install@ || { echo "Failed assertion: @did-not-install@"; return 1; }

echo "Checking assertion: @preinst-1@ should not be present"
! assert @preinst-1@ || { echo "Failed assertion: @preinst-1@ should not be present"; return 1; }

echo "Checking assertion: @preinst-2@ should not be present"
! assert @preinst-2@ || { echo "Failed assertion: @preinst-2@ should not be present"; return 1; }

echo "Checking assertion: @postinst-1@ should not be present"
! assert @postinst-1@ || { echo "Failed assertion: @postinst-1@ should not be present"; return 1; }

echo "Checking assertion: @postinst-2@ should not be present"
! assert @postinst-2@ || { echo "Failed assertion: @postinst-2@ should not be present"; return 1; }

echo 'Checking assertion: Adding "coreos-installer test certificate" to list of CAs'
assert 'Adding "coreos-installer test certificate" to list of CAs' || { echo 'Failed assertion: Adding "coreos-installer test certificate" to list of CAs'; return 1; }
}

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 @preinst-1@
assert @preinst-2@
assert @postinst-1@
assert @postinst-2@
assert 'Adding "coreos-installer test certificate" to list of CAs'
echo "Checking assertion: @applied-live-ign@"
assert @applied-live-ign@ || { echo "Failed assertion: @applied-live-ign@"; return 1; }

echo "Checking assertion: @applied-live-2-ign@"
assert @applied-live-2-ign@ || { echo "Failed assertion: @applied-live-2-ign@"; return 1; }

echo "Checking assertion: @applied-dest-ign@ should not be present"
! assert @applied-dest-ign@ || { echo "Failed assertion: @applied-dest-ign@ should not be present"; return 1; }

echo "Checking assertion: @applied-dest-2-ign@ should not be present"
! assert @applied-dest-2-ign@ || { echo "Failed assertion: @applied-dest-2-ign@ should not be present"; return 1; }

echo "Checking assertion: @did-not-install@ should not be present"
! assert @did-not-install@ || { echo "Failed assertion: @did-not-install@ should not be present"; return 1; }

echo "Checking assertion: @preinst-1@"
assert @preinst-1@ || { echo "Failed assertion: @preinst-1@"; return 1; }

echo "Checking assertion: @preinst-2@"
assert @preinst-2@ || { echo "Failed assertion: @preinst-2@"; return 1; }

echo "Checking assertion: @postinst-1@"
assert @postinst-1@ || { echo "Failed assertion: @postinst-1@"; return 1; }

echo "Checking assertion: @postinst-2@"
assert @postinst-2@ || { echo "Failed assertion: @postinst-2@"; return 1; }

echo 'Checking assertion: Adding "coreos-installer test certificate" to list of CAs'
assert 'Adding "coreos-installer test certificate" to list of CAs' || { echo 'Failed assertion: Adding "coreos-installer test certificate" to list of CAs'; return 1; }
}

check_dest() {
! assert @applied-live-ign@
! assert @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 'Adding "coreos-installer test certificate" to list of CAs'
echo "Checking assertion: @applied-live-ign@ should not be present"
! assert @applied-live-ign@ || { echo "Failed assertion: @applied-live-ign@ should not be present"; return 1; }

echo "Checking assertion: @applied-live-2-ign@ should not be present"
! assert @applied-live-2-ign@ || { echo "Failed assertion: @applied-live-2-ign@ should not be present"; return 1; }

echo "Checking assertion: @applied-dest-ign@"
assert @applied-dest-ign@ || { echo "Failed assertion: @applied-dest-ign@"; return 1; }

echo "Checking assertion: @applied-dest-2-ign@"
assert @applied-dest-2-ign@ || { echo "Failed assertion: @applied-dest-2-ign@"; return 1; }

echo "Checking assertion: @preinst-1@ should not be present"
! assert @preinst-1@ || { echo "Failed assertion: @preinst-1@ should not be present"; return 1; }

echo "Checking assertion: @preinst-2@ should not be present"
! assert @preinst-2@ || { echo "Failed assertion: @preinst-2@ should not be present"; return 1; }

echo "Checking assertion: @postinst-1@ should not be present"
! assert @postinst-1@ || { echo "Failed assertion: @postinst-1@ should not be present"; return 1; }

echo "Checking assertion: @postinst-2@ should not be present"
! assert @postinst-2@ || { echo "Failed assertion: @postinst-2@ should not be present"; return 1; }

echo 'Checking assertion: Adding "coreos-installer test certificate" to list of CAs'
assert 'Adding "coreos-installer test certificate" to list of CAs' || { echo 'Failed assertion: Adding "coreos-installer test certificate" to list of CAs'; return 1; }
}

# Check equivalence of ISO outputs
Expand Down

0 comments on commit be04223

Please sign in to comment.