From f87db8844f32299f474dadb05d94dd1770cd058b Mon Sep 17 00:00:00 2001 From: "Brian C. Lane" Date: Wed, 30 Oct 2019 11:39:16 -0700 Subject: [PATCH] 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 e3654e829745661249ed1076ff907e5d4cf5a5d9 Related: rhbz#1769525 --- test/check-cli | 4 ++-- tests/test_cli.sh | 22 ++++++++++++++++++++++ 2 files changed, 24 insertions(+), 2 deletions(-) diff --git a/test/check-cli b/test/check-cli index 173c0dde..a25189d2 100755 --- a/test/check-cli +++ b/test/check-cli @@ -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"], "/") diff --git a/tests/test_cli.sh b/tests/test_cli.sh index cf793396..adf3b197 100755 --- a/tests/test_cli.sh +++ b/tests/test_cli.sh @@ -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 }