From e4bec00d2089ca8d0e7989bfcde5cc668960a7c7 Mon Sep 17 00:00:00 2001 From: Jaroslav Mracek Date: Thu, 4 Jan 2024 16:46:23 +0100 Subject: [PATCH] Add test for remove command to ensure not removing according to provides The new behavior is more stable for cases when the same spec is used multiple times with remove command. Requires: https://github.com/rpm-software-management/dnf5/pull/1126 --- .../dnf/remove-no-provides.feature | 27 +++++++++ dnf-behave-tests/dnf/remove-provides.feature | 60 ------------------- .../dnf-ci-provides-alternatives/bar-1.0.spec | 19 ++++++ .../dnf-ci-provides-alternatives/foo-1.0.spec | 19 ++++++ 4 files changed, 65 insertions(+), 60 deletions(-) create mode 100644 dnf-behave-tests/dnf/remove-no-provides.feature delete mode 100644 dnf-behave-tests/dnf/remove-provides.feature create mode 100644 dnf-behave-tests/fixtures/specs/dnf-ci-provides-alternatives/bar-1.0.spec create mode 100644 dnf-behave-tests/fixtures/specs/dnf-ci-provides-alternatives/foo-1.0.spec diff --git a/dnf-behave-tests/dnf/remove-no-provides.feature b/dnf-behave-tests/dnf/remove-no-provides.feature new file mode 100644 index 000000000..5a8bb4acf --- /dev/null +++ b/dnf-behave-tests/dnf/remove-no-provides.feature @@ -0,0 +1,27 @@ +@dnf5daemon +Feature: Remove RPMs by provides + + +Background: Install two providers of foo - foo and bar + Given I use repository "dnf-ci-provides-alternatives" + When I execute dnf with args "install foo bar" + Then the exit code is 0 + And Transaction is following + | Action | Package | + | install | foo-0:1.0-1.noarch | + | install | bar-0:1.0-1.noarch | + + + +@dnf5 +Scenario: Remove an RPM by name and not by provide + When I execute dnf with args "remove 'foo'" + Then the exit code is 0 + And Transaction is following + | Action | Package | + | remove | foo-0:1.0-1.noarch | + When I execute dnf with args "remove 'foo'" + Then the exit code is 0 + And Transaction is empty + + diff --git a/dnf-behave-tests/dnf/remove-provides.feature b/dnf-behave-tests/dnf/remove-provides.feature deleted file mode 100644 index 5a9aa216a..000000000 --- a/dnf-behave-tests/dnf/remove-provides.feature +++ /dev/null @@ -1,60 +0,0 @@ -@dnf5daemon -Feature: Remove RPMs by provides - - -Background: Install glibc - Given I use repository "dnf-ci-fedora" - When I execute dnf with args "install glibc" - Then the exit code is 0 - And Transaction is following - | Action | Package | - | install | glibc-0:2.28-9.fc29.x86_64 | - | install-dep | setup-0:2.12.1-1.fc29.noarch | - | install-dep | filesystem-0:3.9-2.fc29.x86_64 | - | install-dep | basesystem-0:11-6.fc29.noarch | - | install-dep | glibc-common-0:2.28-9.fc29.x86_64 | - | install-dep | glibc-all-langpacks-0:2.28-9.fc29.x86_64 | - - -@dnf5 -Scenario Outline: Remove an RPM by provide e:v-r - When I execute dnf with args "remove 'glibc '" - Then the exit code is 0 - And Transaction is following - | Action | Package | - | remove | glibc-0:2.28-9.fc29.x86_64 | - | remove-unused | setup-0:2.12.1-1.fc29.noarch | - | remove-unused | filesystem-0:3.9-2.fc29.x86_64 | - | remove-unused | basesystem-0:11-6.fc29.noarch | - | remove-unused | glibc-common-0:2.28-9.fc29.x86_64 | - | remove-unused | glibc-all-langpacks-0:2.28-9.fc29.x86_64 | - -Examples: - | operator | e:v-r | - | = | 0:2.28-9.fc29 | - | > | 0:2.28-8.fc29 | - | >= | 0:2.28-9.fc29 | - | < | 0:2.28-26.fc29 | - | <= | 0:2.28-9.fc29 | - - -# @dnf5 -# TODO(nsella) different stdout -Scenario Outline: Remove an RPM by - When I execute dnf with args "remove " - Then the exit code is 0 - And Transaction is following - | Action | Package | - | remove | glibc-0:2.28-9.fc29.x86_64 | - | remove-unused | setup-0:2.12.1-1.fc29.noarch | - | remove-unused | filesystem-0:3.9-2.fc29.x86_64 | - | remove-unused | basesystem-0:11-6.fc29.noarch | - | remove-unused | glibc-common-0:2.28-9.fc29.x86_64 | - | remove-unused | glibc-all-langpacks-0:2.28-9.fc29.x86_64 | - -Examples: - | provide type | provide | - | provide | 'libm.so.6()(64bit)' | - | file provide | /etc/ld.so.conf | - | file provide that is directory | /var/db | - | file provide containing wildcards | /etc/ld*.conf | diff --git a/dnf-behave-tests/fixtures/specs/dnf-ci-provides-alternatives/bar-1.0.spec b/dnf-behave-tests/fixtures/specs/dnf-ci-provides-alternatives/bar-1.0.spec new file mode 100644 index 000000000..e2398a049 --- /dev/null +++ b/dnf-behave-tests/fixtures/specs/dnf-ci-provides-alternatives/bar-1.0.spec @@ -0,0 +1,19 @@ +Name: bar +Version: 1.0 +Release: 1 + +Provides: foo + +Summary: Package bar that provides foo +License: GPLv2+ and Public Domain + +BuildArch: noarch + +%description +Dummy. + + +%files + + +%changelog diff --git a/dnf-behave-tests/fixtures/specs/dnf-ci-provides-alternatives/foo-1.0.spec b/dnf-behave-tests/fixtures/specs/dnf-ci-provides-alternatives/foo-1.0.spec new file mode 100644 index 000000000..d098cf3b3 --- /dev/null +++ b/dnf-behave-tests/fixtures/specs/dnf-ci-provides-alternatives/foo-1.0.spec @@ -0,0 +1,19 @@ +Name: foo +Version: 1.0 +Release: 1 + +Summary: A dummy package foo +License: GPLv2+ and Public Domain + +BuildArch: noarch + + + +%description +Dummy. + + +%files + + +%changelog