tests: Always cleanup gpg-agent when exiting
Add `libtest_cleanup_gpg()` to the array of commands to run when exiting. This provides 2 improvements: 1. You don't need to worry about whether the test will spawn a gpg-agent and therefore require adding a call to `libtest_cleanup_gpg()`. 2. All the existing users were calling `libtest_cleanup_gpg()` at the end of the script. If there was a failure and the script exited early, then it wouldn't cleanup and there may be a stray gpg-agent hanging around. Closes: #1799 Approved by: cgwalters
This commit is contained in:
parent
0dd27bbf4b
commit
abb173352d
|
|
@ -648,6 +648,7 @@ libtest_cleanup_gpg () {
|
||||||
local gpg_homedir=${1:-${test_tmpdir}/gpghome}
|
local gpg_homedir=${1:-${test_tmpdir}/gpghome}
|
||||||
gpg-connect-agent --homedir "${gpg_homedir}" killagent /bye || true
|
gpg-connect-agent --homedir "${gpg_homedir}" killagent /bye || true
|
||||||
}
|
}
|
||||||
|
libtest_exit_cmds+=(libtest_cleanup_gpg)
|
||||||
|
|
||||||
is_bare_user_only_repo () {
|
is_bare_user_only_repo () {
|
||||||
grep -q 'mode=bare-user-only' $1/config
|
grep -q 'mode=bare-user-only' $1/config
|
||||||
|
|
|
||||||
|
|
@ -140,4 +140,3 @@ assert_not_file_has_content show.txt 'Found.*signature'
|
||||||
echo "ok pull sig deleted"
|
echo "ok pull sig deleted"
|
||||||
|
|
||||||
rm -rf repo gnomerepo-files
|
rm -rf repo gnomerepo-files
|
||||||
libtest_cleanup_gpg
|
|
||||||
|
|
|
||||||
|
|
@ -89,8 +89,6 @@ if ${OSTREE} show test2 | grep -o 'Found [[:digit:]] signature'; then
|
||||||
assert_not_reached
|
assert_not_reached
|
||||||
fi
|
fi
|
||||||
|
|
||||||
libtest_cleanup_gpg
|
|
||||||
|
|
||||||
echo "ok"
|
echo "ok"
|
||||||
|
|
||||||
# Remaining tests require gpg
|
# Remaining tests require gpg
|
||||||
|
|
|
||||||
|
|
@ -120,5 +120,3 @@ echo "ok pull mirror with invalid summary sig and no verification"
|
||||||
# assert_file_has_content deltas.txt "${origmain}-${newmain}"
|
# assert_file_has_content deltas.txt "${origmain}-${newmain}"
|
||||||
|
|
||||||
# echo "ok pull mirror with signed summary covering static deltas"
|
# echo "ok pull mirror with signed summary covering static deltas"
|
||||||
|
|
||||||
libtest_cleanup_gpg
|
|
||||||
|
|
|
||||||
|
|
@ -274,5 +274,3 @@ cmp repo/tmp/cache/summaries/origin ${test_tmpdir}/ostree-srv/gnomerepo/summary.
|
||||||
cmp repo/tmp/cache/summaries/origin.sig ${test_tmpdir}/ostree-srv/gnomerepo/summary.sig.2 >&2
|
cmp repo/tmp/cache/summaries/origin.sig ${test_tmpdir}/ostree-srv/gnomerepo/summary.sig.2 >&2
|
||||||
|
|
||||||
echo "ok pull with signed summary broken cache"
|
echo "ok pull with signed summary broken cache"
|
||||||
|
|
||||||
libtest_cleanup_gpg
|
|
||||||
|
|
|
||||||
|
|
@ -280,5 +280,3 @@ ${CMD_PREFIX} ostree --repo=${test_tmpdir}/ostree-srv/gnomerepo summary -u --gpg
|
||||||
${OSTREE} pull --require-static-deltas R1:main
|
${OSTREE} pull --require-static-deltas R1:main
|
||||||
|
|
||||||
echo "ok gpg trusted signed commit for delta upgrades"
|
echo "ok gpg trusted signed commit for delta upgrades"
|
||||||
|
|
||||||
libtest_cleanup_gpg
|
|
||||||
|
|
|
||||||
|
|
@ -62,5 +62,3 @@ assert_file_has_content_literal raw-summary.txt "('main', ("
|
||||||
assert_file_has_content_literal raw-summary.txt "('other', ("
|
assert_file_has_content_literal raw-summary.txt "('other', ("
|
||||||
assert_file_has_content_literal raw-summary.txt "{'ostree.summary.last-modified': <uint64"
|
assert_file_has_content_literal raw-summary.txt "{'ostree.summary.last-modified': <uint64"
|
||||||
echo "ok view summary raw"
|
echo "ok view summary raw"
|
||||||
|
|
||||||
libtest_cleanup_gpg
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue