From 9e52859618afabe5c47f986002cf7ef502b964fc Mon Sep 17 00:00:00 2001 From: Marek Blaha Date: Wed, 15 Mar 2023 13:08:59 +0100 Subject: [PATCH] Adjust obsoletes test to new dnf behavior. Now install takes only obsoleters of the latest version into account. --- dnf-behave-tests/dnf/obsoletes.feature | 46 +++++++++++-------- .../dnf-ci-obsoletes/PackageF-1.0-1.spec | 15 ++++++ .../PackageF-Obsoleter-3.0-1.spec | 17 +++++++ .../PackageF-Obsoleter-Second-3.0-1.spec | 17 +++++++ 4 files changed, 77 insertions(+), 18 deletions(-) create mode 100644 dnf-behave-tests/fixtures/specs/dnf-ci-obsoletes/PackageF-1.0-1.spec create mode 100644 dnf-behave-tests/fixtures/specs/dnf-ci-obsoletes/PackageF-Obsoleter-3.0-1.spec create mode 100644 dnf-behave-tests/fixtures/specs/dnf-ci-obsoletes/PackageF-Obsoleter-Second-3.0-1.spec diff --git a/dnf-behave-tests/dnf/obsoletes.feature b/dnf-behave-tests/dnf/obsoletes.feature index ebda0fc04..5a96d1df9 100644 --- a/dnf-behave-tests/dnf/obsoletes.feature +++ b/dnf-behave-tests/dnf/obsoletes.feature @@ -10,35 +10,45 @@ Background: Use dnf-ci-obsoletes repository @dnf5 -# PackageA has a split in its upgrade-path both PackageA-Obsoleter-1.0-1 and PackageA-3.0-1 are valid. -# PackageA-3.0-1 is picked because it lexicographically precedes PackageA-Obsoleter-1.0-1. -@bz1902279 -Scenario: Install of obsoleted package, but higher version than obsoleted present - When I execute dnf with args "install PackageA" +# PackageE has a split in its upgrade-path, PackageA-Obsoleter-1.0-1 obsoletes +# non-best version of PackageE < 2 +# https://issues.redhat.com/browse/RHEL-6304 +@bz2183279 +Scenario: Install obsoleted package, even though obsoleter of older version is present + When I execute dnf with args "install PackageE" Then the exit code is 0 And Transaction is following | Action | Package | - | install | PackageA-0:3.0-1.x86_64 | - And package state is - | package | reason | from_repo | - | PackageA-3.0-1.x86_64 | User | dnf-ci-obsoletes | + | install | PackageE-0:3.0-1.x86_64 | + And dnf5 transaction items for transaction "last" are + | action | package | reason | repository | + | Install | PackageE-0:3.0-1.x86_64 | User | dnf-ci-obsoletes | @dnf5 -# PackageE has a split in its upgrade-path both PackageA-Obsoleter-1.0-1 and PackageE-3.0-1 are valid. -# PackageA-Obsoleter-1.0-1 is picked because it lexicographically precedes PackageE-3.0-1. -@bz1902279 -Scenario: Install of obsoleting package, even though higher version than obsoleted present - When I execute dnf with args "install PackageE" +Scenario: Install alphabetically first of obsoleters when installing obsoleted package + When I execute dnf with args "install PackageF" Then the exit code is 0 And Transaction is following | Action | Package | - | install | PackageA-Obsoleter-0:1.0-1.x86_64 | - And package state is - | package | reason | from_repo | - | PackageA-Obsoleter-1.0-1.x86_64 | User | dnf-ci-obsoletes | + | install | PackageF-Obsoleter-0:3.0-1.x86_64 | +@dnf5 +Scenario: Upgrade a package with multiple obsoleters will install all of them + Given I execute dnf with args "install PackageF-1.0" + Then the exit code is 0 + And Transaction is following + | Action | Package | + | install | PackageF-0:1.0-1.x86_64 | + When I execute dnf with args "upgrade" + Then the exit code is 0 + And Transaction is following + | Action | Package | + | install | PackageF-Obsoleter-0:3.0-1.x86_64 | + | install | PackageF-Obsoleter-Second-0:3.0-1.x86_64 | + | obsoleted | PackageF-0:1.0-1.x86_64 | + # @dnf5 # TODO(nsella) different exit code Scenario: Do not install of obsoleting package using upgrade command, when obsoleted package not on the system diff --git a/dnf-behave-tests/fixtures/specs/dnf-ci-obsoletes/PackageF-1.0-1.spec b/dnf-behave-tests/fixtures/specs/dnf-ci-obsoletes/PackageF-1.0-1.spec new file mode 100644 index 000000000..c2ade66f9 --- /dev/null +++ b/dnf-behave-tests/fixtures/specs/dnf-ci-obsoletes/PackageF-1.0-1.spec @@ -0,0 +1,15 @@ +Name: PackageF +Epoch: 0 +Version: 1.0 +Release: 1 + +License: Public Domain +URL: None + +Summary: The made up package for obsoletes testing. + +%description + +%files + +%changelog diff --git a/dnf-behave-tests/fixtures/specs/dnf-ci-obsoletes/PackageF-Obsoleter-3.0-1.spec b/dnf-behave-tests/fixtures/specs/dnf-ci-obsoletes/PackageF-Obsoleter-3.0-1.spec new file mode 100644 index 000000000..0dbb18c32 --- /dev/null +++ b/dnf-behave-tests/fixtures/specs/dnf-ci-obsoletes/PackageF-Obsoleter-3.0-1.spec @@ -0,0 +1,17 @@ +Name: PackageF-Obsoleter +Epoch: 0 +Version: 3.0 +Release: 1 + +License: Public Domain +URL: None + +Summary: The made up package for obsoletes testing. + +Obsoletes: PackageF < 3 + +%description + +%files + +%changelog diff --git a/dnf-behave-tests/fixtures/specs/dnf-ci-obsoletes/PackageF-Obsoleter-Second-3.0-1.spec b/dnf-behave-tests/fixtures/specs/dnf-ci-obsoletes/PackageF-Obsoleter-Second-3.0-1.spec new file mode 100644 index 000000000..d4a37ef18 --- /dev/null +++ b/dnf-behave-tests/fixtures/specs/dnf-ci-obsoletes/PackageF-Obsoleter-Second-3.0-1.spec @@ -0,0 +1,17 @@ +Name: PackageF-Obsoleter-Second +Epoch: 0 +Version: 3.0 +Release: 1 + +License: Public Domain +URL: None + +Summary: The made up package for obsoletes testing. + +Obsoletes: PackageF < 3 + +%description + +%files + +%changelog