From 6783f0eb9b24e430179a0c7113323f3b05516093 Mon Sep 17 00:00:00 2001 From: Trevor Cooper Date: Sat, 14 Aug 2021 22:32:07 -0700 Subject: [PATCH] initial updates for modularity testing (incomplete) --- tests/modularity_install_module.pm | 2 +- tests/modularity_module_list.pm | 46 ++++++++++++------------------ 2 files changed, 20 insertions(+), 28 deletions(-) diff --git a/tests/modularity_install_module.pm b/tests/modularity_install_module.pm index 9deebfb0..b16f39ed 100644 --- a/tests/modularity_install_module.pm +++ b/tests/modularity_install_module.pm @@ -12,7 +12,7 @@ sub run { # Install a Ruby module. my $name = "nodejs"; my $stream = "14"; - my $profile = "default"; + my $profile = "common"; assert_script_run("dnf module install -y $name:$stream/$profile"); # Check that it is listed in the installed list. diff --git a/tests/modularity_module_list.pm b/tests/modularity_module_list.pm index d3c61b9e..ea7ad7c1 100644 --- a/tests/modularity_module_list.pm +++ b/tests/modularity_module_list.pm @@ -12,34 +12,26 @@ sub run { # The test case will check that dnf has modular functions and that # it is possible to invoke modular commands to work with modularity. - # Check that modular repositories are installed and enabled. - # If the repository does not exist, the output of the command is empty. - if (lc(get_var('VERSION')) eq "rawhide") { - my $mrawhide_output = script_output("dnf repolist --enabled rawhide-modular"); - die "The rawhide-modular repo seems not to be installed." unless (length $mrawhide_output); - } - else { - my $mfedora_output = script_output("dnf repolist --enabled fedora-modular"); - die "The fedora-modular repo seems not to be installed." unless (length $mfedora_output); - my $mupdates_output = script_output("dnf repolist --enabled updates-modular"); - die "The updates-modular repo seems not to be installed." unless (length $mupdates_output); - } - - # Check that modularity works and dnf can list the modules. - my $modules = script_output('dnf module list --disablerepo=updates-modular --disablerepo=updates-testing-modular', timeout => 270); - my @modules = parse_module_list($modules); - die "The module list seems to be empty when it should not be." if (scalar @modules == 0); - - # Check that modularity works and dnf can list the modules - # with the -all option. - $modules = script_output('dnf module list --all --disablerepo=updates-modular --disablerepo=updates-testing-modular', timeout => 270); - @modules = parse_module_list($modules); - die "The module list seems to be empty when it should not be." if (scalar @modules == 0); - # Check that dnf lists the enabled modules. - $modules = script_output('dnf module list --enabled', timeout => 270); - @modules = parse_module_list($modules); - die "There seem to be enabled modules when the list should be empty." unless (scalar @modules == 0); + # NOTE: In Rocky the baseos and appstream default repos include and add modules in the + # default installation where in Fedora all modules are in separate modular repos. + # Until we figure out how to keep track of the count of expected enabled modular + # packages this will need to assume what appears to be the default in minimal. + my $modules = script_output('dnf module list --enabled', timeout => 270); + my @modules = parse_module_list($modules); + die "Enabled modules is less than the default (3)." unless (scalar @modules < 3); + die "Enabled modules is greater than the default (3)." unless (scalar @modules > 3); + + # More advanced... loop over default modules and check them directly. The is_listed + # bit comes from modularity_enable_disable_module.pm + + #perl 5.26 [d][e] + #perl-IO-Socket-SSL 2.066 [d][e] + #perl-libwww-perl 6.34 [d][e] + #my @enabled_modules = parse_module_list($enabled); + #unless (is_listed($name, $stream, \@enabled_modules)) { + # die "The enabled module is not listed in the list of enabled modules but it should be."; + #} # Check that dnf lists the disabled modules. $modules = script_output('dnf module list --disabled', timeout => 270);