summaryrefslogtreecommitdiff
path: root/test/integration
diff options
context:
space:
mode:
authorJulian Andres Klode <julian.klode@canonical.com>2024-09-05 14:56:01 +0200
committerJulian Andres Klode <julian.klode@canonical.com>2024-11-11 12:30:01 +0100
commit49d3d6b2c3dbc0d30e46131dd288f4e106ea2fe6 (patch)
tree18eac389bda24ae130426c7f802be309900083c6 /test/integration
parent09e853dd424a6ab53bd5791de75894a985968399 (diff)
Fix keeping back removals of obsolete packages
ResolveByKeepInternal() inadvertently considered packages that were marked for removals as not being possible to keep back, but that's not true, all they need is to have a currently installed version. The test case is a bit awkward to construct because our upgrade code doesn't get into a place where this happens that we know off. Or maybe it does with phased upgrades, but here we simplify this by using a helper binary that dumps state, marks for removal, and then calls ResolveByKeep and checks the removal is undone. LP: #2078720
Diffstat (limited to 'test/integration')
-rw-r--r--test/integration/solver3.broken1
-rwxr-xr-xtest/integration/test-resolve-by-keep-obsolete-removals29
2 files changed, 30 insertions, 0 deletions
diff --git a/test/integration/solver3.broken b/test/integration/solver3.broken
index 75ddbe5df..dd06ed0eb 100644
--- a/test/integration/solver3.broken
+++ b/test/integration/solver3.broken
@@ -26,6 +26,7 @@ test-phased-updates-upgrade
test-prevent-markinstall-multiarch-same-versionscrew
test-release-candidate-switching
test-resolve-by-keep-new-recommends
+test-resolve-by-keep-obsolete-removals
test-ubuntu-bug-1304403-obsolete-priority-standard
test-ubuntu-bug-1990586
test-ubuntu-bug-2025462-phased-dist-upgrade
diff --git a/test/integration/test-resolve-by-keep-obsolete-removals b/test/integration/test-resolve-by-keep-obsolete-removals
new file mode 100755
index 000000000..ab08ea81a
--- /dev/null
+++ b/test/integration/test-resolve-by-keep-obsolete-removals
@@ -0,0 +1,29 @@
+#!/bin/sh
+set -e
+
+TESTDIR="$(readlink -f "$(dirname "$0")")"
+. "$TESTDIR/framework"
+setupenvironment
+
+configarchitecture "amd64"
+
+insertpackage 'installed' 'obsolete-dependency' 'amd64' '1.0'
+insertpackage 'installed,unstable' 'foo' 'amd64' '2.0' 'Depends: obsolete-dependency'
+
+setupaptarchive
+
+echo 'Debug::pkgProblemResolver "1";' > rootdir/etc/apt/apt.conf.d/debug-problemresolver
+
+# We mark obsolete dependency for removal in B, then in C it is restored.
+testsuccessequal "A: foo:amd64 < 2.0 @ii mK >
+A: obsolete-dependency:amd64 < 1.0 @ii mK >
+B: foo:amd64 < 2.0 @ii mK Ib >
+B: obsolete-dependency:amd64 < 1.0 @ii mR >
+Entering ResolveByKeep
+ Dependencies are not satisfied for foo:amd64 < 2.0 @ii mK Ib >
+Keeping package foo:amd64
+ Dependencies are not satisfied for foo:amd64 < 2.0 @ii mK Ib >
+Package foo:amd64 foo:amd64 Depends on obsolete-dependency:amd64 < 1.0 @ii mR >
+ Keeping Package obsolete-dependency:amd64 due to Depends
+C: foo:amd64 < 2.0 @ii mK >
+C: obsolete-dependency:amd64 < 1.0 @ii mK >" runapt ${APTTESTHELPERSBINDIR}/testkeep obsolete-dependency