diff --git a/data/elemental/cloud-config.yaml b/data/elemental/cloud-config.yaml index dedb08a71fa8..accf0c617055 100644 --- a/data/elemental/cloud-config.yaml +++ b/data/elemental/cloud-config.yaml @@ -1,10 +1,13 @@ -name: "Default user" +name: "Post-installation configuration" stages: - initramfs: - - name: "Setup users" - ensure_entities: - - path: /etc/shadow - entity: | - kind: "shadow" - username: "root" - password: "%TEST_PASSWORD%" + initramfs: + - name: "Setup users" + ensure_entities: + - path: /etc/shadow + entity: | + kind: "shadow" + username: "root" + password: "%TEST_PASSWORD%" + after-install-chroot: + - commands: + - grub2-editenv /run/elemental/efi/grub_oem_env set timeout=-1 diff --git a/tests/elemental/installation.pm b/tests/elemental/installation.pm index 9cec5a5dabab..cb2dbdc0f66e 100644 --- a/tests/elemental/installation.pm +++ b/tests/elemental/installation.pm @@ -1,4 +1,4 @@ -# Copyright 2023 SUSE LLC +# Copyright 2023-2024 SUSE LLC # SPDX-License-Identifier: FSFAP # Summary: Test boot of Elemental OS @@ -12,6 +12,7 @@ use testapi; use power_action_utils qw(power_action); use serial_terminal qw(select_serial_terminal); use utils qw(file_content_replace); +use Utils::Architectures; sub run { my ($self) = @_; @@ -25,12 +26,13 @@ sub run { } ); - - # Wait for GRUB - $self->wait_grub(bootloader_time => 120); - send_key('ret', wait_screen_change => 1); - wait_still_screen(timeout => 90); - save_screenshot(); + # Wait for boot + # Bypass Grub on aarch64 as it can take too long to match the first grub2 needle + if (is_aarch64) { + $self->wait_boot_past_bootloader(textmode => 1); + } else { + $self->wait_boot(textmode => 1); + } ## No GUI, easier and quicker to use the serial console select_serial_terminal(); @@ -46,22 +48,26 @@ sub run { # Install Elemental OS on HDD assert_script_run('elemental install /dev/vda --debug --cloud-init ' . $cloudconfig); - # Reboot after installation - power_action('reboot', keepconsole => 1, textmode => 1); - - # Use new root password - $testapi::password = get_var('TEST_PASSWORD'); - # Loop on all entries to test them + my @loop_count; foreach my $boot_entry (keys %boot_entries) { my $state = $boot_entries{$boot_entry}; my $state_file = "/run/cos/${boot_entry}_mode"; + # Incrememnt the loop counter + push @loop_count, $_; + + # Reboot to test the Grub entry + power_action('reboot', keepconsole => 1, textmode => 1); + + # Use new root password after the first reboot (so after OS installation) + $testapi::password = get_var('TEST_PASSWORD') if @loop_count == 1; + # Select SUT for bootloader select_console('sut'); # Wait for GRUB - $self->wait_grub(bootloader_time => 120); + $self->wait_grub(); # Choose entry to test send_key_until_needlematch($state->{tag}, 'down'); @@ -73,7 +79,7 @@ sub run { select_serial_terminal(); # Check that we are booted in the correct entry - # NOTE: Shell and Perl return code are inverted! + # NOTE: Shell and Perl return codes are inverted! if (!script_run("[[ -f ${state_file} ]]")) { record_info("$boot_entry detected!", "$state_file has been detected!"); } else { @@ -83,9 +89,6 @@ sub run { # Check the installed OS assert_script_run('cat /etc/os-release'); - # Reboot to test the next entry - power_action('reboot', keepconsole => 1, textmode => 1); - # Record boot record_info('OS boot', "$boot_entry: successfully tested!"); }