Skip to content

Commit

Permalink
Enable firstboot_hostname in first boot test
Browse files Browse the repository at this point in the history
Related ticket https://progress.opensuse.org/issues/69175
This change also aims to allow testing other firstboot clients, see
motivation here https://progress.opensuse.org/issues/69130
  • Loading branch information
JRivrain committed Aug 28, 2020
1 parent 47c6905 commit cebce66
Show file tree
Hide file tree
Showing 8 changed files with 252 additions and 25 deletions.
174 changes: 174 additions & 0 deletions data/yast2/firstboot/firstboot_custom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,174 @@
<?xml version="1.0"?>
<productDefines xmlns="http://www.suse.com/1.0/yast2ns"
xmlns:config="http://www.suse.com/1.0/configns">

<!--
$Id$
Work around for the text domain
textdomain="firstboot"
-->

<textdomain>firstboot</textdomain>

<globals>

<!--
If a variable root_password_as_first_user is present in globals section,
inst_user step will have the check box
"Use this password for system administrator"
so you don't need to include root password step (fate#306297).
If the variable is missing (commented), the check box won't appear.
The value of the variable (true/false) will set the default value for the check box.
<root_password_as_first_user config:type="boolean">true</root_password_as_first_user>
-->

<!-- The default value of "Automatic Login" checkbox -->
<enable_autologin config:type="boolean">false</enable_autologin>

<!--
For more variables that can be in this section, look into the control file
(/etc/YaST2/control.xml or root directory of installation media)
-->
</globals>
<proposals config:type="list">
<proposal>
<name>firstboot_hardware</name>
<mode>installation</mode>
<stage>firstboot</stage>
<label>Hardware Configuration</label>
<proposal_modules config:type="list">
<proposal_module>printer</proposal_module>
</proposal_modules>
</proposal>
</proposals>
<workflows config:type="list">
<workflow>
<defaults>
<enable_back>yes</enable_back>
<enable_next>yes</enable_next>
<archs>all</archs>
</defaults>
<stage>firstboot</stage>
<label>Configuration</label>
<mode>installation</mode>
<modules config:type="list">
<module>
<label>Network Autosetup</label>
<name>firstboot_setup_dhcp</name>
</module>
<module>
<label>Language and Keyboard</label>
<enabled config:type="boolean">true</enabled>
<!-- step for configuration of both language and keyboard layout (fate#306296) -->
<name>firstboot_language_keyboard</name>
</module>
<module>
<label>Language</label>
<enabled config:type="boolean">false</enabled>
<name>firstboot_language</name>
</module>
<module>
<label>Keyboard Layout</label>
<enabled config:type="boolean">false</enabled>
<name>firstboot_keyboard</name>
</module>
<module>
<label>Welcome</label>
<name>firstboot_welcome</name>
</module>
<module>
<label>License Agreement</label>
<enabled config:type="boolean">true</enabled>
<name>firstboot_licenses</name>
</module>
<module>
<label>Host Name</label>
<enabled config:type="boolean">true</enabled>
<name>firstboot_hostname</name>
</module>
<module>
<label>Network</label>
<!-- this step only restarts service 'network' -->
<name>firstboot_network_write</name>
<enabled config:type="boolean">false</enabled>
</module>
<module>
<enabled config:type="boolean">true</enabled>
<name>firstboot_ssh</name>
</module>
<module>
<label>Network</label>
<name>inst_lan</name>
<enabled config:type="boolean">false</enabled>
</module>
<module>
<label>Automatic Configuration</label>
<name>inst_automatic_configuration</name>
<enabled config:type="boolean">false</enabled>
</module>
<module>
<label>Time and Date</label>
<enabled config:type="boolean">true</enabled>
<name>firstboot_timezone</name>
</module>
<module>
<label>NTP Client</label>
<enabled config:type="boolean">false</enabled>
<name>firstboot_ntp</name>
</module>
<module>
<label>Desktop</label>
<enabled config:type="boolean">false</enabled>
<name>firstboot_desktop</name>
</module>
<module>
<label>Network</label>
<name>inst_lan</name>
<enabled config:type="boolean">false</enabled>
</module>
<module>
<label>Users</label>
<enabled config:type="boolean">true</enabled>
<name>firstboot_user</name>
</module>
<module>
<label>Root Password</label>
<enabled config:type="boolean">true</enabled>
<name>firstboot_root</name>
</module>
<module>
<label>Customer Center</label>
<name>registration</name>
<enabled config:type="boolean">false</enabled>
</module>
<module>
<label>Hardware</label>
<name>inst_proposal</name>
<enabled config:type="boolean">false</enabled>
<proposal>firstboot_hardware</proposal>
</module>
<module>
<label>Finish Setup</label>
<name>firstboot_write</name>
<enable_back>no</enable_back>
<enable_next>no</enable_next>
</module>
<module>
<label>Finish Setup</label>
<name>inst_congratulate</name>
<enable_back>no</enable_back>
<enable_next>yes</enable_next>
</module>

</modules>
</workflow>
</workflows>
<texts>
<!--
Labels used during Automatic Configuration: use "text_id" from "ac_step"
-->
<ac_label_1><label>Configuring network...</label></ac_label_1>
<ac_label_2><label>Configuring hardware...</label></ac_label_2>
</texts>
</productDefines>
Original file line number Diff line number Diff line change
Expand Up @@ -19,3 +19,5 @@ schedule:
- installation/yast2_firstboot
- installation/first_boot
- console/validate_yast2_firstboot_configuration
test_data:
<<: !include test_data/yast/firstboot/yast2_firstboot.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,3 +18,5 @@ schedule:
- installation/yast2_firstboot
- installation/first_boot
- console/validate_yast2_firstboot_configuration
test_data:
<<: !include test_data/yast/firstboot/yast2_firstboot.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,5 @@ schedule:
- installation/yast2_firstboot
- installation/first_boot
- console/validate_yast2_firstboot_configuration
test_data:
<<: !include test_data/yast/firstboot/yast2_firstboot.yaml
28 changes: 28 additions & 0 deletions schedule/yast/firstboot/yast2_firstboot_custom.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
---
name: yast2_fistboot_custom
description: >
Variant of YaST2 Firstboot module using custom control file. Allows us to test different scenarios,
and to see if the yast2-firstboot package remains stable whith an old, potentially deprecated control file.
vars:
YAST2_FIRSTBOOT_USERNAME: firstbootuser
schedule:
- boot/boot_to_desktop
- console/prepare_test_data
- console/consoletest_setup
- console/hostname
- installation/enable_y2_firstboot
- autoyast/autoyast_reboot
- installation/grub_test
- installation/yast2_firstboot
- installation/first_boot
- console/validate_yast2_firstboot_configuration
test_data:
clients:
- firstboot_language_keyboard
- firstboot_welcome
- firstboot_licenses
- firstboot_hostname
- firstboot_timezone
- firstboot_user
- firstboot_root
custom_control_file: yast2/firstboot/firstboot_custom.xml
7 changes: 7 additions & 0 deletions test_data/yast/firstboot/yast2_firstboot.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
clients:
- firstboot_language_keyboard
- firstboot_welcome
- firstboot_licenses
- firstboot_timezone
- firstboot_user
- firstboot_root
10 changes: 8 additions & 2 deletions tests/installation/enable_y2_firstboot.pm
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# SUSE's openQA tests
#
# Copyright © 2019 SUSE LLC
# Copyright © 2020 SUSE LLC
#
# Copying and distribution of this file, with or without modification,
# are permitted in any medium without royalty provided the copyright
Expand All @@ -9,18 +9,24 @@

# Summary: Enable YaST2 Firstboot module - Desktop workstation configuration utility
# Doc: https://en.opensuse.org/YaST_Firstboot
# Maintainer: Martin Loviska <mloviska@suse.com>
# Maintainer: QA SLE YaST team <qa-sle-yast@suse.de>

use base 'y2_installbase';
use strict;
use warnings;
use testapi;
use utils qw(zypper_call clear_console);
use scheduler 'get_test_suite_data';

sub run {
my $test_data = get_test_suite_data();
select_console 'root-console';
zypper_call "in yast2-firstboot";
assert_script_run 'touch /var/lib/YaST2/reconfig_system';
# Use default file from package if no custom file was specified
if ($test_data->{custom_control_file}) {
assert_script_run 'wget ' . data_url($test_data->{custom_control_file}) . ' -O /etc/YaST2/firstboot.xml';
}
clear_console;
}

Expand Down
52 changes: 29 additions & 23 deletions tests/installation/yast2_firstboot.pm
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# SUSE's openQA tests
#
# Copyright © 2019 SUSE LLC
# Copyright © 2020 SUSE LLC
#
# Copying and distribution of this file, with or without modification,
# are permitted in any medium without royalty provided the copyright
Expand All @@ -9,7 +9,7 @@

# Summary: Utilize OS using YaST2 Firstboot module
# Doc: https://en.opensuse.org/YaST_Firstboot
# Maintainer: Martin Loviska <mloviska@suse.com>
# Maintainer: QA SLE YaST team <qa-sle-yast@suse.de>

use base 'y2_installbase';
use y2_logs_helper qw(accept_license verify_license_has_to_be_accepted);
Expand All @@ -19,8 +19,9 @@ use testapi;
use utils qw(zypper_call clear_console);
use installation_user_settings qw(await_password_check enter_userinfo enter_rootinfo);
use version_utils qw(is_sle is_opensuse);
use scheduler 'get_test_suite_data';

sub language_and_keyboard {
sub firstboot_language_keyboard {
my $shortcuts = {
l => 'lang',
k => 'keyboard'
Expand All @@ -34,7 +35,7 @@ sub language_and_keyboard {
wait_screen_change(sub { send_key $cmd{next}; }, 7);
}

sub license {
sub firstboot_licenses {
my $self = shift;
# default TO value was not sufficient
assert_screen('license-agreement', 60);
Expand All @@ -46,45 +47,50 @@ sub license {
send_key $cmd{next};
}

sub welcome {
sub firstboot_welcome {
assert_screen 'welcome';
wait_screen_change(sub { send_key $cmd{next}; }, 7);
}

sub clock_and_timezone {
sub firstboot_timezone {
assert_screen 'inst-timezone';
wait_screen_change(sub { send_key $cmd{next}; }, 7);
}

sub user_setup {
my $is_not_shared_passwd = shift;
sub firstboot_user {
assert_screen 'local_user';
enter_userinfo(username => get_var('YAST2_FIRSTBOOT_USERNAME'));
if (defined($is_not_shared_passwd)) {
send_key 'alt-t' if (is_opensuse);
}
else {
send_key 'alt-t' if (is_sle('>=12-sp4'));
}
wait_screen_change(sub { send_key $cmd{next}; }, 7);
await_password_check;
wait_screen_change(sub { send_key $cmd{next}; }, 7) unless defined($is_not_shared_passwd);
}

sub root_setup {
sub firstboot_root {
assert_screen 'root_user', 60;
enter_rootinfo;
wait_screen_change(sub { send_key $cmd{next}; }, 7);
}

sub firstboot_hostname {
if (check_screen 'bsc1173298') {
record_soft_failure "bsc#1173298";
send_key $cmd{ok};
wait_screen_change(sub { send_key $cmd{next}; }, 7);
return;
}
assert_screen 'hostname';
wait_screen_change(sub { send_key $cmd{next}; }, 7);
}

sub run {
my $self = shift;
language_and_keyboard;
welcome;
$self->license;
clock_and_timezone;
user_setup(1);
root_setup;
my $self = shift;
my $test_data = get_test_suite_data();
my %clients;
foreach my $client (@{$test_data->{clients}}) {
# Make sure the subroutine called from test data exists
die "Client '$client' is not defined in the module, please check test_data" unless defined(&{"$client"});
my $client_method = \&{"$client"};
$client_method->($self);
}
assert_screen 'installation_completed';
send_key $cmd{finish};
}
Expand Down

0 comments on commit cebce66

Please sign in to comment.