summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorMichael Vogt <mvo@ubuntu.com>2016-01-02 22:08:30 +0100
committerMichael Vogt <mvo@ubuntu.com>2016-01-02 22:18:13 +0100
commitee02b5b3949372a178d37cadaa08db0bfd5b991f (patch)
tree873cb79c1a6e86b8dfffe5f65604665c70adb17c /test
parentbd8274311db48fdcc78456c17c2d59497b96cc2f (diff)
Add new APT::Keep-Downloaded-Packages option
This option controls if downloaded packages should be kept after a successful install or if they should be deleted. The default for "apt-get" is that they are kept (just like before). However the default for "apt" is that they get deleted. Closes: #160743
Diffstat (limited to 'test')
-rwxr-xr-xtest/integration/test-apt-keep-downloaded-pkgs43
1 files changed, 43 insertions, 0 deletions
diff --git a/test/integration/test-apt-keep-downloaded-pkgs b/test/integration/test-apt-keep-downloaded-pkgs
new file mode 100755
index 000000000..4cc7fbb04
--- /dev/null
+++ b/test/integration/test-apt-keep-downloaded-pkgs
@@ -0,0 +1,43 @@
+#!/bin/sh
+set -e
+
+TESTDIR="$(readlink -f "$(dirname "$0")")"
+. "$TESTDIR/framework"
+
+setupenvironment
+configarchitecture 'native'
+
+buildsimplenativepackage 'pkg1' 'all' '1.0' 'stable'
+buildsimplenativepackage 'pkg2' 'all' '1.0' 'stable'
+buildsimplenativepackage 'pkg3' 'all' '1.0' 'stable'
+buildsimplenativepackage 'pkg4' 'all' '1.0' 'stable'
+
+# local (file) installs
+setupaptarchive
+
+# ensure that install from local sources does not remove debs
+testsuccess aptget install pkg1 -o APT::Keep-Downloaded-Packages=false
+testsuccess test -f aptarchive/pool/pkg1_1.0_all.deb
+
+# now switch to http and downloading debs
+changetowebserver
+testsuccess aptget update
+
+# ensure that the downloaded pkg is kept with "keep=true"
+testsuccess aptget install pkg2 -o APT::Keep-Downloaded-Packages=true
+testsuccess test -f aptarchive/pool/pkg2_1.0_all.deb
+testsuccess test -f rootdir/var/cache/apt/archives/pkg2_1.0_all.deb
+
+# ensure that the downloaded pkg is removed when requested
+testsuccess aptget install pkg3 -o APT::Keep-Downloaded-Packages=false
+testsuccess test -f aptarchive/pool/pkg3_1.0_all.deb
+# this was there before, keep it
+testsuccess test -f rootdir/var/cache/apt/archives/pkg2_1.0_all.deb
+# this got installed so we can remove it now
+testfailure test -f rootdir/var/cache/apt/archives/pkg3_1.0_all.deb
+
+
+# ensure that install from the download dir does not delete packages
+mv aptarchive/pool/pkg4_1.0_all.deb rootdir/var/cache/apt/archives
+testsuccess aptget install $(pwd)/rootdir/var/cache/apt/archives/pkg4_1.0_all.deb -o APT::Keep-Downloaded-Packages=false
+testsuccess test -f $(pwd)/rootdir/var/cache/apt/archives/pkg4_1.0_all.deb \ No newline at end of file