From 1475813b7534ae76608bba0bcd01977f5da8a0ad Mon Sep 17 00:00:00 2001 From: Lukas Ruzicka Date: Wed, 10 Jul 2019 10:47:10 +0200 Subject: [PATCH] Update the modularity tests. * Add test to check module defaults. * Add whitelist download. * Fix install test to include selected profile to be on the safe side. * Add test into templates. --- lib/utils.pm | 4 ++++ templates | 2 +- tests/modularity_checkdefaults.pm | 22 ++++++++++++++++++++++ tests/modularity_enable_disable_module.pm | 6 +++++- tests/modularity_install_module.pm | 5 ++++- 5 files changed, 36 insertions(+), 3 deletions(-) create mode 100644 tests/modularity_checkdefaults.pm diff --git a/lib/utils.pm b/lib/utils.pm index d6376a53..cca9c237 100644 --- a/lib/utils.pm +++ b/lib/utils.pm @@ -647,7 +647,11 @@ sub check_desktop_clean { sub download_modularity_tests { # Download the modularity test script, place in the system and then # modify the access rights to make it executable. + my $whitelist = @_; assert_script_run 'curl -o /root/test.py https://pagure.io/fedora-qa/modularity_testing_scripts/raw/master/f/modular_functions.py'; + if ($whitelist eq 'whitelist') { + assert_script_run 'curl -o /root/whitelist https://pagure.io/fedora-qa/modularity_testing_scripts/raw/master/f/whitelist'; + } assert_script_run 'chmod 755 /root/test.py'; } diff --git a/templates b/templates index 0f4fa01a..3d816974 100755 --- a/templates +++ b/templates @@ -4712,7 +4712,7 @@ { name => "modularity_tests", settings => [ - { key => "POSTINSTALL", value => "modularity_module_list modularity_enable_disable_module modularity_install_module" }, + { key => "POSTINSTALL", value => "modularity_module_list modularity_enable_disable_module modularity_install_module modularity_checkdefaults" }, { key => "USER_LOGIN", value => "false" }, { key => "ROOT_PASSWORD", value => "weakpassword" }, { key => "START_AFTER_TEST", value => "install_default_upload" }, diff --git a/tests/modularity_checkdefaults.pm b/tests/modularity_checkdefaults.pm new file mode 100644 index 00000000..6ebfa013 --- /dev/null +++ b/tests/modularity_checkdefaults.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('whitelist'); + + # Test if modules have default stream and profile defined. + assert_script_run('/root/test.py -a checkdefaults -w whitelist'); + + # Upload modular logs + upload_logs '/root/modular.log', failok=>1; +} + +1; + +# vim: set sw=4 et: diff --git a/tests/modularity_enable_disable_module.pm b/tests/modularity_enable_disable_module.pm index 46e9f7b7..e4732292 100644 --- a/tests/modularity_enable_disable_module.pm +++ b/tests/modularity_enable_disable_module.pm @@ -11,11 +11,15 @@ sub run { # Download the testing script download_modularity_tests(); - # Check that modularity works and that a particular module is available in the system. + # Check that modularity works, that a particular module is available in the system, + # and display information about that module. assert_script_run('/root/test.py -m dwm -s 6.1 -a list'); # Check that module can be enabled and disabled. assert_script_run('/root/test.py -m dwm -s 6.1 -a enable,disable -f hard'); + + # Upload the modular log file. + upload_logs '/root/modular.log', failok=>1; } 1; diff --git a/tests/modularity_install_module.pm b/tests/modularity_install_module.pm index 6b71511c..ccfdb2a0 100644 --- a/tests/modularity_install_module.pm +++ b/tests/modularity_install_module.pm @@ -14,7 +14,10 @@ sub run { assert_script_run('/root/test.py -m nodejs -s 11 -a list'); # Check that module can be enabled and removed. - assert_script_run('/root/test.py -m nodejs -s 11 -a install,remove -f hard'); + assert_script_run('/root/test.py -m nodejs -s 11 -p default -a install,remove -f hard'); + + # Upload modular logs + upload_logs '/root/modular.log', failok=>1; } 1;