libvm: add vm_get_journal_after_cursor

The cursor argument was getting munged up by SSH. Use a helper to make
sure we always get quoting right.

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

View File

@ -418,10 +418,17 @@ vm_wait_content_after_cursor() {
EOF
}
# Minor helper that makes sure to get quoting right
vm_get_journal_after_cursor() {
from_cursor=$1; shift
to_file=$1; shift
# add an extra helping of quotes for hungry ssh
vm_cmd journalctl --after-cursor "'$from_cursor'" > $to_file
}
vm_assert_journal_has_content() {
from_cursor=$1; shift
# add an extra helping of quotes for hungry ssh
vm_cmd journalctl --after-cursor "'$from_cursor'" > tmp-journal.txt
vm_get_journal_after_cursor $from_cursor tmp-journal.txt
assert_file_has_content tmp-journal.txt "$@"
rm -f tmp-journal.txt
}

View File

@ -98,7 +98,7 @@ vm_wait_content_after_cursor $cursor 'Txn AutomaticUpdateTrigger.*successful'
vm_rpmostree status -v > out.txt
assert_not_file_has_content out.txt "AvailableUpdate"
# And check the unit name https://github.com/projectatomic/rpm-ostree/pull/1368
vm_cmd journalctl -u rpm-ostreed --after-cursor ${cursor} > journal.txt
vm_get_journal_after_cursor $cursor journal.txt
assert_file_has_content journal.txt 'client(id:cli.*unit:rpm-ostreed-automatic.service'
rm -f journal.txt