From e89bb488cd71af4151f3a9bd1b5ef9bbb9c7065b Mon Sep 17 00:00:00 2001 From: Pavla Kratochvilova Date: Mon, 12 Feb 2024 12:31:39 +0100 Subject: [PATCH] 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 1533b7686..1c048f597 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 f9b32d145..f9e24116c 100644 --- a/dnf-behave-tests/dnf/module/enable.feature +++ b/dnf-behave-tests/dnf/module/enable.feature @@ -41,3 +41,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 | |