vmcheck/autoupdate-check.sh: Fix --check/--preview tests

Noticed this while looking at the logs for #1432.

Because --check and --preview exit with rc=77 when there are no updates,
we would actually stop early on in the test and marking it as SKIPPED.
Fix this by making sure we explicitly check for the $rc we expected when
using those switches.

I also added a final grep pass to make it easy to inspect whether we
skipped any tests. I was about to do this nicely in `multitest.py`
instead, though it may not be of this world much longer, so meh...

Closes: #1450
Approved by: cgwalters
This commit is contained in:
Jonathan Lebon 2018-07-10 11:49:03 -04:00 committed by Atomic Bot
parent bfd39aecf3
commit fbee05bcc5
2 changed files with 19 additions and 11 deletions

View File

@ -48,6 +48,8 @@ tests:
- ci/build-check.sh
- ci/vmcheck-provision.sh
- make vmcheck
# make sure we're aware of any tests that were skipped
- "grep -nr '^SKIP: ' vmcheck/ || :"
timeout: 60m

View File

@ -69,11 +69,21 @@ if [ -s out.txt ]; then
fi
echo "ok disabled"
# runs --check and --preview, verifies rc matches what we expect, and capturing
# output for a following assert_output
assert_check_preview_rc() {
local expected_rc=$1; shift
local rc=0
vm_rpmostree upgrade --check > out.txt || rc=$?
assert_streq $rc $expected_rc
vm_rpmostree upgrade --preview > out-verbose.txt || rc=$?
assert_streq $rc $expected_rc
}
# check that --check/--preview still works
vm_rpmostree upgrade --check > out.txt
assert_file_has_content out.txt "No updates available."
vm_rpmostree upgrade --preview > out.txt
assert_check_preview_rc 77
assert_file_has_content out.txt "No updates available."
assert_file_has_content out-verbose.txt "No updates available."
echo "ok --check/--preview no updates"
# ok, let's test out check
@ -150,8 +160,7 @@ echo "ok check mode layered only with advisories"
# clear out cache first to make sure they start from scratch
vm_rpmostree cleanup -m
vm_cmd systemctl stop rpm-ostreed
vm_rpmostree upgrade --check > out.txt
vm_rpmostree upgrade --preview > out-verbose.txt
assert_check_preview_rc 0
assert_output
echo "ok --check/--preview layered pkgs check policy"
@ -160,8 +169,7 @@ vm_change_update_policy off
vm_rpmostree cleanup -m
vm_cmd systemctl stop rpm-ostreed
vm_rpmostree status | grep 'AutomaticUpdates: disabled'
vm_rpmostree upgrade --check > out.txt
vm_rpmostree upgrade --preview > out-verbose.txt
assert_check_preview_rc 0
assert_output
echo "ok --check/--preview layered pkgs off policy"
@ -212,16 +220,14 @@ echo "ok check mode ostree"
# check that we get similar output with --check/--preview
vm_rpmostree upgrade --check > out.txt
vm_rpmostree upgrade --preview > out-verbose.txt
assert_check_preview_rc 0
assert_output2
echo "ok --check/--preview base pkgs check policy"
vm_change_update_policy off
vm_rpmostree cleanup -m
vm_cmd systemctl stop rpm-ostreed
vm_rpmostree upgrade --check > out.txt
vm_rpmostree upgrade --preview > out-verbose.txt
assert_check_preview_rc 0
assert_output2
echo "ok --check/--preview base pkgs off policy"