From 5661b8aa1fa5755f07ef1368b57918000e067462 Mon Sep 17 00:00:00 2001 From: Pavla Kratochvilova Date: Mon, 12 Feb 2024 12:31:39 +0100 Subject: [PATCH 1/2] Test switching of module streams --- .../dnf/module/enable-errors.feature | 26 +++---------------- dnf-behave-tests/dnf/module/enable.feature | 23 ++++++++++++++++ 2 files changed, 26 insertions(+), 23 deletions(-) diff --git a/dnf-behave-tests/dnf/module/enable-errors.feature b/dnf-behave-tests/dnf/module/enable-errors.feature index 7d012e9c6..bba27f9f5 100644 --- a/dnf-behave-tests/dnf/module/enable-errors.feature +++ b/dnf-behave-tests/dnf/module/enable-errors.feature @@ -5,8 +5,8 @@ Background: Given I use repository "dnf-ci-fedora-modular-updates" -Scenario: Fail to enable a different stream of an already enabled module (dnf) - Given I set dnf command to "dnf" +@dnf5 +Scenario: Fail to enable a different stream of an already enabled module When I execute dnf with args "module enable nodejs:8" Then the exit code is 0 And Transaction is following @@ -22,32 +22,12 @@ Scenario: Fail to enable a different stream of an already enabled module (dnf) | nodejs | enabled | 8 | | And stderr is """ + Failed to resolve the transaction: The operation would result in switching of module 'nodejs' stream '8' to stream '10' Error: It is not possible to switch enabled streams of a module unless explicitly enabled via configuration option module_stream_switch. It is recommended to rather remove all installed content from the module, and reset the module using 'dnf module reset ' command. After you reset the module, you can install the other stream. """ -Scenario: Fail to enable a different stream of an already enabled module (yum) - Given I set dnf command to "yum" - When I execute dnf with args "module enable nodejs:8" - Then the exit code is 0 - And Transaction is following - | Action | Package | - | module-stream-enable | nodejs:8 | - And modules state is following - | Module | State | Stream | Profiles | - | nodejs | enabled | 8 | | - When I execute dnf with args "module enable nodejs:10" - Then the exit code is 1 - And modules state is following - | Module | State | Stream | Profiles | - | nodejs | enabled | 8 | | - And stderr is - """ - The operation would result in switching of module 'nodejs' stream '8' to stream '10' - Error: It is not possible to switch enabled streams of a module unless explicitly enabled via configuration option module_stream_switch. - It is recommended to rather remove all installed content from the module, and reset the module using 'yum module reset ' command. After you reset the module, you can install the other stream. - """ Scenario: Fail to install a different stream of an already enabled module Given I set dnf command to "dnf" diff --git a/dnf-behave-tests/dnf/module/enable.feature b/dnf-behave-tests/dnf/module/enable.feature index 56b53f325..4acd9f45a 100644 --- a/dnf-behave-tests/dnf/module/enable.feature +++ b/dnf-behave-tests/dnf/module/enable.feature @@ -40,3 +40,26 @@ Scenario: Enable a module stream that was already enabled And modules state is following | Module | State | Stream | Profiles | | nodejs | enabled | 8 | | + + +@dnf5 +Scenario: Enable a different stream of an already enabled module when module_stream_switch=true + Given I configure dnf with + | key | value | + | module_stream_switch | True | + When I execute dnf with args "module enable nodejs:8" + Then the exit code is 0 + And Transaction is following + | Action | Package | + | module-stream-enable | nodejs:8 | + And modules state is following + | Module | State | Stream | Profiles | + | nodejs | enabled | 8 | | + When I execute dnf with args "module enable nodejs:10" + Then the exit code is 0 + And Transaction is following + | Action | Package | + | module-stream-switch | nodejs:8 -> 10 | + And modules state is following + | Module | State | Stream | Profiles | + | nodejs | enabled | 10 | | From 94a893e2c6c5117f31f07570dc57875ca33fd78b Mon Sep 17 00:00:00 2001 From: Pavla Kratochvilova Date: Mon, 11 Mar 2024 10:43:31 +0100 Subject: [PATCH 2/2] Remove obsolete recommendation related to switching module streams The approach was obsoleted after implementing module switch-to command. The recommendation may be harmful, since modules may also contain packages from base and theirs removal could result in a malfunctioning system. --- dnf-behave-tests/dnf/module/enable-errors.feature | 3 --- 1 file changed, 3 deletions(-) diff --git a/dnf-behave-tests/dnf/module/enable-errors.feature b/dnf-behave-tests/dnf/module/enable-errors.feature index bba27f9f5..76158e68c 100644 --- a/dnf-behave-tests/dnf/module/enable-errors.feature +++ b/dnf-behave-tests/dnf/module/enable-errors.feature @@ -25,7 +25,6 @@ Scenario: Fail to enable a different stream of an already enabled module Failed to resolve the transaction: The operation would result in switching of module 'nodejs' stream '8' to stream '10' Error: It is not possible to switch enabled streams of a module unless explicitly enabled via configuration option module_stream_switch. - It is recommended to rather remove all installed content from the module, and reset the module using 'dnf module reset ' command. After you reset the module, you can install the other stream. """ @@ -48,7 +47,6 @@ Scenario: Fail to install a different stream of an already enabled module """ The operation would result in switching of module 'nodejs' stream '8' to stream '10' Error: It is not possible to switch enabled streams of a module unless explicitly enabled via configuration option module_stream_switch. - It is recommended to rather remove all installed content from the module, and reset the module using 'dnf module reset ' command. After you reset the module, you can install the other stream. """ @@ -72,7 +70,6 @@ Scenario: Fail to install a different stream of an already enabled module using """ The operation would result in switching of module 'nodejs' stream '8' to stream '10' Error: It is not possible to switch enabled streams of a module unless explicitly enabled via configuration option module_stream_switch. - It is recommended to rather remove all installed content from the module, and reset the module using 'dnf module reset ' command. After you reset the module, you can install the other stream. """ @dnf5