diff --git a/test/check-cli b/test/check-cli index cdfba9c8..1865b7ea 100755 --- a/test/check-cli +++ b/test/check-cli @@ -44,6 +44,10 @@ class TestQcow2(composertest.ComposerTestCase): # Boot the image 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 self.machine.upload(["../tests"], "/") @@ -87,6 +91,10 @@ class TestTar(composertest.ComposerTestCase): # Boot the image, login using the ssh key 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 self.machine.upload(["../tests"], "/") diff --git a/tests/cli/lib/lib.sh b/tests/cli/lib/lib.sh index c913d613..e1e26b44 100755 --- a/tests/cli/lib/lib.sh +++ b/tests/cli/lib/lib.sh @@ -122,7 +122,7 @@ check_root_account() { fi 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" else # ssh returns 255 in case of any ssh error, so it's better to grep the specific error message diff --git a/tests/cli/test_boot_live-iso.sh b/tests/cli/test_boot_live-iso.sh index ff3109eb..3f6e915a 100755 --- a/tests/cli/test_boot_live-iso.sh +++ b/tests/cli/test_boot_live-iso.sh @@ -15,7 +15,7 @@ set -e rlJournalStart rlPhaseStartTest "Verify live iso" # 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 "custom_cmdline_arg" /proc/cmdline rlPhaseEnd diff --git a/tests/cli/test_boot_qcow2.sh b/tests/cli/test_boot_qcow2.sh index d984bdf3..183735ba 100755 --- a/tests/cli/test_boot_qcow2.sh +++ b/tests/cli/test_boot_qcow2.sh @@ -15,8 +15,8 @@ set -e rlJournalStart rlPhaseStartTest "Verify VM instance" # 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" - rlAssertGrep "custom_cmdline_arg" /proc/cmdline rlPhaseEnd rlJournalEnd rlJournalPrintText diff --git a/tests/cli/test_boot_tar_kickstart.sh b/tests/cli/test_boot_tar_kickstart.sh index 0b1e5d9b..56689b6b 100755 --- a/tests/cli/test_boot_tar_kickstart.sh +++ b/tests/cli/test_boot_tar_kickstart.sh @@ -15,6 +15,7 @@ set -e rlJournalStart rlPhaseStartTest "Verify VM instance" # 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" rlPhaseEnd rlJournalEnd