mirror of
https://github.com/flatpak/flatpak.git
synced 2026-03-16 22:19:47 -04:00
Merge pull request #3469 from alexlarsson/fix-gpg-tests
tests: Fix gpg signature failure checks
This commit is contained in:
@@ -166,6 +166,16 @@ assert_file_has_content () {
|
||||
fi
|
||||
}
|
||||
|
||||
assert_log_has_gpg_signature_error () {
|
||||
if ! grep -q -e "GPG signatures found, but none are in trusted keyring" "$1"; then
|
||||
if ! grep -q -e "Can't check signature: public key not found" "$1"; then
|
||||
sed -e 's/^/# /' < "$1" >&2
|
||||
echo 1>&2 "File '$1' doesn't have gpg signature error"
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
assert_symlink_has_content () {
|
||||
if ! readlink "$1" | grep -q -e "$2"; then
|
||||
readlink "$1" |sed -e 's/^/# /' >&2
|
||||
|
||||
@@ -221,25 +221,24 @@ ${FLATPAK} ${U} uninstall -y org.test.Platform org.test.Hello
|
||||
if ${FLATPAK} ${U} install -y test-missing-gpg-repo org.test.Platform 2> install-error-log; then
|
||||
assert_not_reached "Should not be able to install with missing gpg key"
|
||||
fi
|
||||
assert_file_has_content install-error-log "GPG signatures found, but none are in trusted keyring"
|
||||
|
||||
assert_log_has_gpg_signature_error install-error-log
|
||||
|
||||
if ${FLATPAK} ${U} install test-missing-gpg-repo org.test.Hello 2> install-error-log; then
|
||||
assert_not_reached "Should not be able to install with missing gpg key"
|
||||
fi
|
||||
assert_file_has_content install-error-log "GPG signatures found, but none are in trusted keyring"
|
||||
assert_log_has_gpg_signature_error install-error-log
|
||||
|
||||
echo "ok fail with missing gpg key"
|
||||
|
||||
if ${FLATPAK} ${U} install test-wrong-gpg-repo org.test.Platform 2> install-error-log; then
|
||||
assert_not_reached "Should not be able to install with wrong gpg key"
|
||||
fi
|
||||
assert_file_has_content install-error-log "GPG signatures found, but none are in trusted keyring"
|
||||
assert_log_has_gpg_signature_error install-error-log
|
||||
|
||||
if ${FLATPAK} ${U} install test-wrong-gpg-repo org.test.Hello 2> install-error-log; then
|
||||
assert_not_reached "Should not be able to install with wrong gpg key"
|
||||
fi
|
||||
assert_file_has_content install-error-log "GPG signatures found, but none are in trusted keyring"
|
||||
assert_log_has_gpg_signature_error install-error-log
|
||||
|
||||
echo "ok fail with wrong gpg key"
|
||||
|
||||
|
||||
Reference in New Issue
Block a user