From 24e68aa8a21e74fb6086a7b80568abda31e686a6 Mon Sep 17 00:00:00 2001 From: Lukas Ruzicka Date: Sep 27 2018 06:09:36 +0000 Subject: Create openqa tests to test modularity. --- diff --git a/lib/utils.pm b/lib/utils.pm index 47a710c..3cdce8f 100644 --- a/lib/utils.pm +++ b/lib/utils.pm @@ -642,3 +642,10 @@ sub check_desktop_clean { } die "Clean desktop not reached!"; } + +sub download_modularity_tests { +# Download the modularity test script, place in the system and then +# modify the access rights to make it executable. + assert_script_run 'curl -o /root/test.py https://pagure.io/fedora-qa/modularity_testing_scripts/raw/master/f/modular_functions.py'; + assert_script_run 'chmod 755 /root/test.py'; +} diff --git a/templates b/templates index fbec8c6..7d8cbf2 100755 --- a/templates +++ b/templates @@ -1581,6 +1581,17 @@ }, { machine => { name => "64bit" }, + prio => 30, + product => { + arch => "x86_64", + distri => "fedora", + flavor => "universal", + version => "*", + }, + test_suite => { name => "modularity_tests" }, + }, + { + machine => { name => "64bit" }, prio => 20, product => { arch => "x86_64", @@ -2238,6 +2249,18 @@ test_suite => { name => "install_kickstart_user_creation" }, }, { + group_name => "Fedora PowerPC", + machine => { name => "ppc64le" }, + prio => 30, + product => { + arch => "ppc64le", + distri => "fedora", + flavor => "universal", + version => "*", + }, + test_suite => { name => "modularity_tests" }, + }, + { group_name => "Fedora PowerPC", machine => { name => "ppc64le" }, prio => 20, @@ -3222,6 +3245,18 @@ test_suite => { name => "install_kickstart_hdd" }, }, { + group_name => "Fedora PowerPC", + machine => { name => "ppc64" }, + prio => 30, + product => { + arch => "ppc64", + distri => "fedora", + flavor => "universal", + version => "*", + }, + test_suite => { name => "modularity_tests" }, + }, + { group_name => "Fedora PowerPC", machine => { name => "ppc64" }, prio => 30, @@ -3762,6 +3797,18 @@ test_suite => { name => "install_kickstart_user_creation" }, }, { + group_name => "Fedora AArch64", + machine => { name => "aarch64" }, + prio => 30, + product => { + arch => "aarch64", + distri => "fedora", + flavor => "universal", + version => "*", + }, + test_suite => { name => "modularity_tests" }, + }, + { group_name => "Fedora AArch64", machine => { name => "aarch64" }, prio => 20, @@ -5209,6 +5256,17 @@ ], }, { + name => "modularity_tests", + settings => [ + { key => "POSTINSTALL", value => "modularity_module_list modularity_enable_disable_module modularity_install_module modularity_update_norepo" }, + { key => "USER_LOGIN", value => "false" }, + { key => "ROOT_PASSWORD", value => "weakpassword" }, + { key => "START_AFTER_TEST", value => "install_default_upload" }, + { key => "BOOTFROM", value => "c" }, + { key => "HDD_1", value => "disk_%FLAVOR%_%MACHINE%.qcow2" }, + ], + }, + { name => "base_services_start", settings => [ { key => "POSTINSTALL", value => "base_services_start" }, diff --git a/tests/modularity_enable_disable_module.pm b/tests/modularity_enable_disable_module.pm new file mode 100644 index 0000000..6794d51 --- /dev/null +++ b/tests/modularity_enable_disable_module.pm @@ -0,0 +1,23 @@ +use base "installedtest"; +use strict; +use testapi; +use utils; +sub run { + my $self=shift; + my $hook_run = 0; + # switch to tty and login as root + $self->root_console(tty=>3); + + # Download the testing script + download_modularity_tests(); + + # Check that modularity works and that a particular module is available in the system. + assert_script_run('/root/test.py -m dwm -s 6.0 -a list'); + + # Check that module can be enabled and disabled. + assert_script_run('/root/test.py -m dwm -s 6.0 -a enable,disable -f hard'); +} + +1; + +# vim: set sw=4 et: diff --git a/tests/modularity_install_module.pm b/tests/modularity_install_module.pm new file mode 100644 index 0000000..b159be1 --- /dev/null +++ b/tests/modularity_install_module.pm @@ -0,0 +1,22 @@ +use base "installedtest"; +use strict; +use testapi; +use utils; +sub run { + my $self=shift; + # switch to tty and login as root + $self->root_console(tty=>3); + + # Download the testing script + download_modularity_tests(); + + # Check that modularity works and that a particular module is available in the system. + assert_script_run('/root/test.py -m nodejs -s 8 -a list'); + + # Check that module can be enabled and removed. + assert_script_run('/root/test.py -m nodejs -s 8 -a install,remove -f hard'); +} + +1; + +# vim: set sw=4 et: diff --git a/tests/modularity_module_list.pm b/tests/modularity_module_list.pm new file mode 100644 index 0000000..6e7f605 --- /dev/null +++ b/tests/modularity_module_list.pm @@ -0,0 +1,36 @@ +use base "installedtest"; +use strict; +use testapi; +use utils; + +sub run { + my $self=shift; + # switch to tty and login as root + $self->root_console(tty=>3); + + # The test case will check that dnf has modular functions and that + # it is possible to invoke modular commands to work with modularity. + # It does not check the content of the further listed lists for any + # particular packages, modules or streams. + + # Check that modularity works and dnf can list the modules. + assert_script_run('dnf module list'); + + # Check that modularity works and dnf can list the modules + # with the -all option. + assert_script_run('dnf module list --all'); + + # Check that dnf lists the enabled modules. + assert_script_run('dnf module list --enabled'); + + # Check that dnf lists the disabled modules. + assert_script_run('dnf module list --disabled'); + + # Check that dnf lists the installed modules. + assert_script_run('dnf module list --installed'); +} + + +1; + +# vim: set sw=4 et: diff --git a/tests/modularity_update_norepo.pm b/tests/modularity_update_norepo.pm new file mode 100644 index 0000000..cb7340a --- /dev/null +++ b/tests/modularity_update_norepo.pm @@ -0,0 +1,28 @@ +use base "installedtest"; +use strict; +use testapi; +use utils; +sub run { + my $self=shift; + # switch to tty and login as root + $self->root_console(tty=>3); + + # Download the testing script + download_modularity_tests(); + + # Update the system + assert_script_run('dnf update -y'); + + # Enable and install the nodejs module, stream 8. + assert_script_run('/root/test.py -m nodejs -s 8 -a enable,install -f hard'); + + # Update the system without modular repos. + assert_script_run('dnf update --disablerepo=\*modular -y'); + + # Check that the same version is listed in the installed modules. + assert_script_run('/root/test.py -m nodejs -s 8 -a checkinstall -f hard'); +} + +1; + +# vim: set sw=4 et: