test: Boot the live-iso faster, and login using ssh key

On Fedora 31 passworless root login is no longer working. We already
install a ssh key, may as well use it.

This also reduces the live boot timeout to 2s from 60s, which should
help with timeout problems when booting.

Cherry-picked from e3654e8297

Related: rhbz#1769525
This commit is contained in:
Brian C. Lane 2019-10-30 11:39:16 -07:00 committed by Alexander Todorov
parent e7cfd20ca3
commit f87db8844f
2 changed files with 24 additions and 2 deletions

View File

@ -63,8 +63,8 @@ class TestLiveIso(composertest.ComposerTestCase):
# Copy the resulting iso and shut down the VM
self.tearDownVirt(virt_dir="/var/tmp/test-results/*", local_dir=tmpdir)
# Boot the image
self.setUpTestMachine(tmpdir + "/live.iso")
# Boot the image, login using the ssh key
self.setUpTestMachine(tmpdir + "/live.iso", tmpdir + "/id_rsa")
# Upload the contents of the ./tests/ directory to the machine
self.machine.upload(["../tests"], "/")

View File

@ -15,6 +15,22 @@ function setup_tests {
# explicitly enable sshd for live-iso b/c it is disabled by default
# due to security concerns (no root password required)
sed -i.orig 's/^services.*/services --disabled="network" --enabled="NetworkManager,sshd"/' $share_dir/composer/live-iso.ks
# Make the live-iso boot more quickly (isolinux.cfg)
for cfg in "$share_dir"/templates.d/99-generic/live/config_files/*/isolinux.cfg; do
sed -i.orig 's/^timeout.*/timeout 20/' "$cfg"
done
# Make the live-iso boot more quickly (grub.cfg)
for cfg in "$share_dir"/templates.d/99-generic/live/config_files/*/grub.conf; do
sed -i.orig 's/^timeout.*/timeout 2/' "$cfg"
done
# Make the live-iso boot more quickly (grub2-efi.cfg)
for cfg in "$share_dir"/templates.d/99-generic/live/config_files/*/grub2-efi.cfg; do
sed -i.orig 's/^set timeout.*/set timeout=2/' "$cfg"
done
# explicitly enable logging in with empty passwords via ssh, because
# the default sshd setting for PermitEmptyPasswords is 'no'
awk -i inplace "
@ -43,6 +59,12 @@ function teardown_tests {
local blueprints_dir=$2
mv $share_dir/composer/live-iso.ks.orig $share_dir/composer/live-iso.ks
# Restore all the configuration files
for cfg in "$share_dir"/templates.d/99-generic/live/config_files/*/*.orig; do
mv "$cfg" "${cfg%%.orig}"
done
rm -rf $blueprints_dir
mv ${blueprints_dir}.orig $blueprints_dir
}