tests: Use the same asserts as before
after the changes around live-iso and qcow2 test cases the asserts used have also changed. This commit utilizes the existing test lib.
This commit is contained in:
parent
e1b45958f4
commit
d67745d755
@ -41,6 +41,10 @@ class TestQcow2(composertest.ComposerTestCase):
|
|||||||
# Boot the image
|
# Boot the image
|
||||||
self.setUpTestMachine(tmpdir + "/disk.qcow2", tmpdir + "/id_rsa")
|
self.setUpTestMachine(tmpdir + "/disk.qcow2", tmpdir + "/id_rsa")
|
||||||
|
|
||||||
|
# Upload SSH keys to the machine so we can use the existing assertions
|
||||||
|
# by ssh'ing to localhost
|
||||||
|
self.machine.upload([tmpdir + "/id_rsa", tmpdir + "/id_rsa.pub"], "/root/.ssh")
|
||||||
|
|
||||||
# Upload the contents of the ./tests/ directory to the machine
|
# Upload the contents of the ./tests/ directory to the machine
|
||||||
self.machine.upload(["../tests"], "/")
|
self.machine.upload(["../tests"], "/")
|
||||||
|
|
||||||
@ -88,6 +92,10 @@ class TestTar(composertest.ComposerTestCase):
|
|||||||
# Boot the image, login using the ssh key
|
# Boot the image, login using the ssh key
|
||||||
self.setUpTestMachine(tmpdir + "/disk.img", tmpdir + "/id_rsa")
|
self.setUpTestMachine(tmpdir + "/disk.img", tmpdir + "/id_rsa")
|
||||||
|
|
||||||
|
# Upload SSH keys to the machine so we can use the existing assertions
|
||||||
|
# by ssh'ing to localhost
|
||||||
|
self.machine.upload([tmpdir + "/id_rsa", tmpdir + "/id_rsa.pub"], "/root/.ssh")
|
||||||
|
|
||||||
# Upload the contents of the ./tests/ directory to the machine
|
# Upload the contents of the ./tests/ directory to the machine
|
||||||
self.machine.upload(["../tests"], "/")
|
self.machine.upload(["../tests"], "/")
|
||||||
|
|
||||||
|
@ -122,7 +122,7 @@ check_root_account() {
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
if [ $ROOT_ACCOUNT_LOCKED == 0 ]; then
|
if [ $ROOT_ACCOUNT_LOCKED == 0 ]; then
|
||||||
rlRun -t -c "ssh $SSH_OPTS ${SSH_USER}@${SSH_MACHINE} \"sudo grep '^root::' /etc/shadow\"" \
|
rlRun -t -c "ssh $SSH_OPTS ${SSH_USER}@${SSH_MACHINE} \"sudo passwd --status root | grep -E '^root\s+NP?'\"" \
|
||||||
0 "Password for root account in /etc/shadow is empty"
|
0 "Password for root account in /etc/shadow is empty"
|
||||||
else
|
else
|
||||||
# ssh returns 255 in case of any ssh error, so it's better to grep the specific error message
|
# ssh returns 255 in case of any ssh error, so it's better to grep the specific error message
|
||||||
|
@ -15,7 +15,7 @@ set -e
|
|||||||
rlJournalStart
|
rlJournalStart
|
||||||
rlPhaseStartTest "Verify live iso"
|
rlPhaseStartTest "Verify live iso"
|
||||||
# Just the fact that this is running means the image can boot and ssh is working
|
# Just the fact that this is running means the image can boot and ssh is working
|
||||||
rlRun -t -c "passwd --status root | grep -E '^root\s+NP?'" 0 "root account has no password set"
|
ROOT_ACCOUNT_LOCKED=0 verify_image liveuser localhost "-p 22"
|
||||||
rlAssertGrep "liveuser" /etc/passwd
|
rlAssertGrep "liveuser" /etc/passwd
|
||||||
rlAssertGrep "custom_cmdline_arg" /proc/cmdline
|
rlAssertGrep "custom_cmdline_arg" /proc/cmdline
|
||||||
rlPhaseEnd
|
rlPhaseEnd
|
||||||
|
@ -15,8 +15,8 @@ set -e
|
|||||||
rlJournalStart
|
rlJournalStart
|
||||||
rlPhaseStartTest "Verify VM instance"
|
rlPhaseStartTest "Verify VM instance"
|
||||||
# Just the fact that this is running means the image can boot and ssh is working
|
# Just the fact that this is running means the image can boot and ssh is working
|
||||||
|
verify_image root localhost "-p 22"
|
||||||
rlAssertExists "/root/.ssh/authorized_keys"
|
rlAssertExists "/root/.ssh/authorized_keys"
|
||||||
rlAssertGrep "custom_cmdline_arg" /proc/cmdline
|
|
||||||
rlPhaseEnd
|
rlPhaseEnd
|
||||||
rlJournalEnd
|
rlJournalEnd
|
||||||
rlJournalPrintText
|
rlJournalPrintText
|
||||||
|
@ -15,6 +15,7 @@ set -e
|
|||||||
rlJournalStart
|
rlJournalStart
|
||||||
rlPhaseStartTest "Verify VM instance"
|
rlPhaseStartTest "Verify VM instance"
|
||||||
# Just the fact that this is running means the image can boot and ssh is working
|
# Just the fact that this is running means the image can boot and ssh is working
|
||||||
|
CHECK_CMDLINE=0 verify_image root localhost "-p 22"
|
||||||
rlAssertExists "/root/.ssh/authorized_keys"
|
rlAssertExists "/root/.ssh/authorized_keys"
|
||||||
rlPhaseEnd
|
rlPhaseEnd
|
||||||
rlJournalEnd
|
rlJournalEnd
|
||||||
|
Loading…
Reference in New Issue
Block a user