2018-09-26 13:32:42 +00:00
|
|
|
use base "installedtest";
|
|
|
|
use strict;
|
2021-03-25 10:27:58 +00:00
|
|
|
use modularity;
|
2018-09-26 13:32:42 +00:00
|
|
|
use testapi;
|
|
|
|
use utils;
|
2021-03-25 10:27:58 +00:00
|
|
|
|
2018-09-26 13:32:42 +00:00
|
|
|
sub run {
|
|
|
|
my $self=shift;
|
|
|
|
my $hook_run = 0;
|
|
|
|
# switch to tty and login as root
|
|
|
|
$self->root_console(tty=>3);
|
|
|
|
|
2021-03-25 10:27:58 +00:00
|
|
|
# Enable the module.
|
|
|
|
my $name = "swig";
|
|
|
|
my $stream = "4.0";
|
|
|
|
assert_script_run("dnf module enable -y $name:$stream");
|
|
|
|
|
|
|
|
# Check that it is listed in the enabled list.
|
|
|
|
my $enabled = script_output('dnf module list --enabled');
|
|
|
|
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 it is not listed in the disabled list.
|
|
|
|
my $disabled = script_output('dnf module list --disabled');
|
|
|
|
my @disabled_modules = parse_module_list($disabled);
|
|
|
|
if (is_listed($name, $stream, \@disabled_modules)) {
|
|
|
|
die "The enabled module is listed in the list of disabled modules but it should not be.";
|
|
|
|
}
|
|
|
|
|
|
|
|
# Disable some other module.
|
|
|
|
my $name_alt = "postgresql";
|
2022-03-04 11:48:52 +00:00
|
|
|
my $stream_alt = "14";
|
2021-03-25 10:27:58 +00:00
|
|
|
assert_script_run("dnf module disable -y $name_alt:$stream_alt");
|
|
|
|
|
|
|
|
# Check that it is listed in the disabled list.
|
|
|
|
$disabled = script_output('dnf module list --disabled');
|
|
|
|
@disabled_modules = parse_module_list($disabled);
|
|
|
|
unless (is_listed($name_alt, $stream_alt, \@disabled_modules)) {
|
|
|
|
die "The disabled module is not listed in the list of disabled modules but it should be.";
|
|
|
|
}
|
2018-09-26 13:32:42 +00:00
|
|
|
|
2021-03-25 10:27:58 +00:00
|
|
|
# Check that it is not listed in the enabled list.
|
|
|
|
$enabled = script_output('dnf module list --enabled');
|
|
|
|
@enabled_modules = parse_module_list($enabled);
|
|
|
|
if (is_listed($name_alt, $stream_alt, \@enabled_modules)) {
|
|
|
|
die "The disabled module is listed in the list of enabled modules but it should not be.";
|
|
|
|
}
|
2018-09-26 13:32:42 +00:00
|
|
|
|
2021-03-25 10:27:58 +00:00
|
|
|
# Reset the first module to its original state and do the list checks.
|
|
|
|
assert_script_run("dnf module reset -y $name");
|
2019-07-10 08:47:10 +00:00
|
|
|
|
2021-03-25 10:27:58 +00:00
|
|
|
# Check that the module has disappeared from both the lists.
|
|
|
|
$disabled = script_output('dnf module list --disabled');
|
|
|
|
@disabled_modules = parse_module_list($disabled);
|
|
|
|
if (is_listed($name, $stream, \@disabled_modules)) {
|
|
|
|
die "The disabled module is listed in the list of disabled modules but it should not be.";
|
|
|
|
}
|
|
|
|
|
|
|
|
$enabled = script_output('dnf module list --enabled');
|
|
|
|
@enabled_modules = parse_module_list($enabled);
|
|
|
|
if (is_listed($name, $stream, \@enabled_modules)) {
|
|
|
|
die "The disabled module is listed in the list of enabled modules but it should not be.";
|
|
|
|
}
|
|
|
|
|
|
|
|
# Reset the second module but do not perform any list checks.
|
|
|
|
assert_script_run("dnf module reset -y $name_alt");
|
|
|
|
|
2018-09-26 13:32:42 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
1;
|
|
|
|
|
|
|
|
# vim: set sw=4 et:
|