summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorJulian Andres Klode <julian.klode@canonical.com>2018-01-16 16:53:46 +0100
committerJulian Andres Klode <julian.klode@canonical.com>2018-01-17 11:52:38 +0100
commit698f9e3f9877be2aa181d6e40d3dc5c41ea318b7 (patch)
treeafcd1b5ee856242afe3de70692e358a4a6e68781 /test
parentca2fcc639c7363a04998f650b96573d806b32dd2 (diff)
Introduce inrelease-path option for sources.list
Allow specifying an alternative path to the InRelease file, so you can have multiple versions of a repository, for example. Enabling this option disables fallback to Release and Release.gpg, so setting it to InRelease can be used to ensure that only that will be tried. We add two test cases: One for checking that it works, and another for checking that the fallback does not happen. Closes: #886745
Diffstat (limited to 'test')
-rwxr-xr-xtest/integration/test-apt-by-hash-update28
1 files changed, 28 insertions, 0 deletions
diff --git a/test/integration/test-apt-by-hash-update b/test/integration/test-apt-by-hash-update
index 9701f97f9..f4794a84f 100755
--- a/test/integration/test-apt-by-hash-update
+++ b/test/integration/test-apt-by-hash-update
@@ -77,3 +77,31 @@ ensureitsbroken -o Acquire::By-Hash=0
sed -i "s#^\(deb\(-src\)\?\) \[by-hash=yes\] #\1 [by-hash=force] #" rootdir/etc/apt/sources.list.d/*
ensureitworks
#ensureitsbroken -o Acquire::By-Hash=0
+
+
+
+msgmsg 'Test InRelease by-hash via' 'sources option'
+
+rm -rf aptarchive/dists
+cp -a aptarchive/dists.bak aptarchive/dists
+mkdir -p aptarchive/dists/unstable/by-hash/SHA256
+inrelease_hash=$(sha256sum aptarchive/dists/unstable/InRelease | awk '{print $1}')
+mv aptarchive/dists/unstable/InRelease aptarchive/dists/unstable/by-hash/SHA256/$inrelease_hash
+#ensureitworks -o Acquire::By-Hash=force
+ensureitsbroken -o Acquire::By-Hash=1
+ensureitsbroken -o Acquire::By-Hash=0
+
+sed -i "s#^\(deb\(-src\)\?\) \[by-hash=force\] #\1 [by-hash=force inrelease-path=by-hash/SHA256/$inrelease_hash] #" rootdir/etc/apt/sources.list.d/*
+ensureitworks
+#ensureitsbroken -o Acquire::By-Hash=0
+
+msgmsg 'Test InRelease by-hash with' 'no fallback'
+
+rm -rf aptarchive/dists
+cp -a aptarchive/dists.bak aptarchive/dists
+
+testfailureequal "Get:1 file:${TMPWORKINGDIRECTORY}/aptarchive unstable InRelease
+Err:1 file:${TMPWORKINGDIRECTORY}/aptarchive unstable InRelease
+ File not found - ${TMPWORKINGDIRECTORY}/aptarchive/dists/unstable/by-hash/SHA256/${inrelease_hash} (2: No such file or directory)
+Reading package lists...
+E: Failed to fetch file://${TMPWORKINGDIRECTORY}/aptarchive/dists/unstable/InRelease File not found - ${TMPWORKINGDIRECTORY}/aptarchive/dists/unstable/by-hash/SHA256/${inrelease_hash} (2: No such file or directory)" aptget update