summaryrefslogtreecommitdiff
path: root/tests/test-commit-sign.sh
diff options
context:
space:
mode:
authorColin Walters <walters@verbum.org>2017-09-26 20:51:24 -0400
committerAtomic Bot <atomic-devel@projectatomic.io>2017-09-27 19:04:11 +0000
commit33141404150ec0166fb72e8f50c461194aec52f4 (patch)
tree7385e35fb5c53dd64f70c47992fbcbebc8367cbd /tests/test-commit-sign.sh
parentd319e7598271ed07c04048f2e7bcf711622a7f7e (diff)
downloadostree-33141404150ec0166fb72e8f50c461194aec52f4.tar.gz
tests/commit-sign: Update a bit to more modern style
I was trying to debug this while working on another PR. Add `echo ok` lines and also use `assert_file_has_content` more directly; there's no reason to use an intermediate `grep` since if it fails it won't print the original file. Closes: #1220 Approved by: jlebon
Diffstat (limited to 'tests/test-commit-sign.sh')
-rwxr-xr-xtests/test-commit-sign.sh28
1 files changed, 15 insertions, 13 deletions
diff --git a/tests/test-commit-sign.sh b/tests/test-commit-sign.sh
index 755818c8..b0a88138 100755
--- a/tests/test-commit-sign.sh
+++ b/tests/test-commit-sign.sh
@@ -26,7 +26,7 @@ if ! has_gpgme; then
exit 0
fi
-echo "1..1"
+echo "1..6"
keyid="472CDAFA"
oldpwd=`pwd`
@@ -73,6 +73,7 @@ if env OSTREE_GPG_HOME=${test_tmpdir} ${CMD_PREFIX} ostree --repo=repo pull orig
assert_not_reached "pull with no trusted GPG keys unexpectedly succeeded!"
fi
rm repo -rf
+echo "ok pull no trusted GPG"
# And a test case with valid signature
cd ${test_tmpdir}
@@ -80,9 +81,10 @@ mkdir repo
ostree_repo_init repo
${CMD_PREFIX} ostree --repo=repo remote add origin $(cat httpd-address)/ostree/gnomerepo
${CMD_PREFIX} ostree --repo=repo pull origin main
-${CMD_PREFIX} ostree --repo=repo show --gpg-verify-remote=origin main | grep -o 'Found [[:digit:]] signature' > show-verify-remote
-assert_file_has_content show-verify-remote 'Found 1 signature'
+${CMD_PREFIX} ostree --repo=repo show --gpg-verify-remote=origin main > show.txt
+assert_file_has_content_literal show.txt 'Found 1 signature'
rm repo -rf
+echo "ok pull verify"
# A test with corrupted detached signature
cd ${test_tmpdir}
@@ -96,6 +98,7 @@ if ${CMD_PREFIX} ostree --repo=repo pull origin main; then
assert_not_reached "pull with corrupted signature unexpectedly succeeded!"
fi
rm repo -rf
+echo "ok pull corrupted sig"
# And now attempt to pull the same corrupted commit, but with GPG
# verification off
@@ -105,6 +108,7 @@ ostree_repo_init repo
${CMD_PREFIX} ostree --repo=repo remote add --set=gpg-verify=false origin $(cat httpd-address)/ostree/gnomerepo
${CMD_PREFIX} ostree --repo=repo pull origin main
rm repo -rf
+echo "ok repull corrupted"
# Add an unsigned commit to the repo, then pull, then sign the commit,
# then pull again. Make sure we get the expected number of signatures
@@ -117,23 +121,21 @@ mkdir repo
ostree_repo_init repo
${CMD_PREFIX} ostree --repo=repo remote add --set=gpg-verify=false origin $(cat httpd-address)/ostree/gnomerepo
${CMD_PREFIX} ostree --repo=repo pull origin main
-if ${CMD_PREFIX} ostree --repo=repo show main | grep -o 'Found [[:digit:]] signature'; then
- assert_not_reached
-fi
+${CMD_PREFIX} ostree --repo=repo show main > show.txt
+assert_not_file_has_content show.txt 'Found.*signature'
${CMD_PREFIX} ostree --repo=${test_tmpdir}/ostree-srv/gnomerepo gpg-sign --gpg-homedir=${test_tmpdir}/gpghome main $keyid
${CMD_PREFIX} ostree --repo=repo pull origin main
-${CMD_PREFIX} ostree --repo=repo show main | grep -o 'Found [[:digit:]] signature' > show
-assert_file_has_content show 'Found 1 signature'
+${CMD_PREFIX} ostree --repo=repo show main > show.txt
+assert_file_has_content_literal show.txt 'Found 1 signature'
+echo "ok pull unsigned, then sign"
# Delete the signature from the commit so the detached metadata is empty,
# then pull and verify the signature is also deleted on the client side.
${CMD_PREFIX} ostree --repo=${test_tmpdir}/ostree-srv/gnomerepo gpg-sign --gpg-homedir=${test_tmpdir}/gpghome --delete main $keyid
${CMD_PREFIX} ostree --repo=repo pull origin main
-if ${CMD_PREFIX} ostree --repo=repo show main | grep -o 'Found [[:digit:]] signature'; then
- assert_not_reached
-fi
+${CMD_PREFIX} ostree --repo=repo show main >show.txt
+assert_not_file_has_content show.txt 'Found.*signature'
+echo "ok pull sig deleted"
rm -rf repo gnomerepo-files
libtest_cleanup_gpg
-
-echo "ok"