summaryrefslogtreecommitdiffstats
path: root/test/integration/test-apt-update-not-modified
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-07 09:00:48 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-07 09:00:48 +0000
commit851b6a097165af4d51c0db01b5e05256e5006896 (patch)
tree5f7c388ec894a7806c49a99f3bdb605d0b299a7c /test/integration/test-apt-update-not-modified
parentInitial commit. (diff)
downloadapt-851b6a097165af4d51c0db01b5e05256e5006896.tar.xz
apt-851b6a097165af4d51c0db01b5e05256e5006896.zip
Adding upstream version 2.6.1.upstream/2.6.1upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'test/integration/test-apt-update-not-modified')
-rwxr-xr-xtest/integration/test-apt-update-not-modified183
1 files changed, 183 insertions, 0 deletions
diff --git a/test/integration/test-apt-update-not-modified b/test/integration/test-apt-update-not-modified
new file mode 100755
index 0000000..c6dbb8d
--- /dev/null
+++ b/test/integration/test-apt-update-not-modified
@@ -0,0 +1,183 @@
+#!/bin/sh
+set -e
+
+TESTDIR="$(readlink -f "$(dirname "$0")")"
+. "$TESTDIR/framework"
+
+setupenvironment
+configarchitecture 'amd64' 'i386'
+confighashes 'SHA256'
+
+insertpackage 'unstable' 'apt' 'amd64,i386' '1.0'
+
+export APT_DONT_SIGN=''
+setupaptarchive --no-update
+
+methodtest() {
+ msgmsg 'Test InRelease with' "$1"
+ rm -rf rootdir/var/lib/apt/lists
+ cp -a aptarchive/dists aptarchive/dists.good
+ # get our cache populated
+ testsuccess aptget update
+ listcurrentlistsdirectory > listsdir.lst
+
+ # hit again with a good cache
+ testsuccessequal "Hit:1 $1 unstable InRelease
+Reading package lists..." aptget update
+ testfileequal 'listsdir.lst' "$(listcurrentlistsdirectory)"
+
+ # drop an architecture, which means the file should be gone now
+ configarchitecture 'i386'
+ sed '/_binary-amd64_Packages/ d' listsdir.lst > listsdir-without-amd64.lst
+ testsuccessequal "Hit:1 $1 unstable InRelease
+Reading package lists..." aptget update
+ testfileequal 'listsdir-without-amd64.lst' "$(listcurrentlistsdirectory)"
+
+ # readd arch so its downloaded again…
+ configarchitecture 'amd64' 'i386'
+ # … but oh noes, hashsum mismatch!
+ SIZE=$(stat -c '%s' 'aptarchive/dists/unstable/main/binary-amd64/Packages.gz')
+ breakfiles aptarchive/dists/unstable/main/binary-amd64/Packages.gz
+ testfailureequal "Hit:1 $1 unstable InRelease
+Get:2 $1 unstable/main amd64 Packages [$SIZE B]
+Err:2 $1 unstable/main amd64 Packages
+ Hash Sum mismatch
+ Hashes of expected file:
+ - Filesize:$(stat -c '%s' 'aptarchive/dists/unstable/main/binary-amd64/Packages.gz.bak') [weak]
+ - SHA256:$(sha256sum 'aptarchive/dists/unstable/main/binary-amd64/Packages.gz.bak' | cut -d' ' -f 1)
+ Hashes of received file:
+ - SHA256:$(sha256sum 'aptarchive/dists/unstable/main/binary-amd64/Packages.gz' | cut -d' ' -f 1)
+ - Filesize:$(stat -c '%s' 'aptarchive/dists/unstable/main/binary-amd64/Packages.gz') [weak]
+ Last modification reported: $(lastmodification 'aptarchive/dists/unstable/main/binary-amd64/Packages.gz')
+ Release file created at: $(releasefiledate 'aptarchive/dists/unstable/InRelease')
+Reading package lists...
+E: Failed to fetch $1/dists/unstable/main/binary-amd64/Packages.gz Hash Sum mismatch
+ Hashes of expected file:
+ - Filesize:$(stat -c '%s' 'aptarchive/dists/unstable/main/binary-amd64/Packages.gz.bak') [weak]
+ - SHA256:$(sha256sum 'aptarchive/dists/unstable/main/binary-amd64/Packages.gz.bak' | cut -d' ' -f 1)
+ Hashes of received file:
+ - SHA256:$(sha256sum 'aptarchive/dists/unstable/main/binary-amd64/Packages.gz' | cut -d' ' -f 1)
+ - Filesize:$(stat -c '%s' 'aptarchive/dists/unstable/main/binary-amd64/Packages.gz') [weak]
+ Last modification reported: $(lastmodification 'aptarchive/dists/unstable/main/binary-amd64/Packages.gz')
+ Release file created at: $(releasefiledate 'aptarchive/dists/unstable/InRelease')
+E: Some index files failed to download. They have been ignored, or old ones used instead." aptget update
+ testfileequal 'listsdir-without-amd64.lst' "$(listcurrentlistsdirectory)"
+ rm -rf aptarchive/dists
+ cp -a aptarchive/dists.good aptarchive/dists
+
+ # … now everything is fine again
+ testsuccessequal "Hit:1 $1 unstable InRelease
+Get:2 $1 unstable/main amd64 Packages [$(stat -c '%s' 'aptarchive/dists/unstable/main/binary-amd64/Packages.gz') B]
+Reading package lists..." aptget update
+ testfileequal 'listsdir.lst' "$(listcurrentlistsdirectory)"
+
+ webserverconfig 'aptwebserver::support::modified-since' 'false'
+ webserverconfig 'aptwebserver::support::last-modified' 'false'
+ testsuccessequal "Get:1 $1 unstable InRelease [$(stat -c '%s' 'aptarchive/dists/unstable/InRelease') B]
+Reading package lists..." aptget update
+ webserverconfig 'aptwebserver::support::modified-since' 'true'
+ webserverconfig 'aptwebserver::support::last-modified' 'true'
+
+ msgmsg 'Test Release.gpg with' "$1"
+ rm -rf rootdir/var/lib/apt/lists
+ find aptarchive/dists -name 'InRelease' -delete
+ # get our cache populated
+ testsuccess aptget update
+ listcurrentlistsdirectory > listsdir.lst
+
+ # hit again with a good cache
+ testsuccessequal "Ign:1 $1 unstable InRelease
+ 404 Not Found
+Hit:2 $1 unstable Release
+Reading package lists..." aptget update
+ testfileequal 'listsdir.lst' "$(listcurrentlistsdirectory)"
+
+ # drop an architecture, which means the file should be gone now
+ configarchitecture 'i386'
+ sed '/_binary-amd64_Packages/ d' listsdir.lst > listsdir-without-amd64.lst
+ testsuccessequal "Ign:1 $1 unstable InRelease
+ 404 Not Found
+Hit:2 $1 unstable Release
+Reading package lists..." aptget update
+ testfileequal 'listsdir-without-amd64.lst' "$(listcurrentlistsdirectory)"
+
+ # readd arch so its downloaded again…
+ configarchitecture 'amd64' 'i386'
+ # … but oh noes, hashsum mismatch!
+ SIZE=$(stat -c '%s' 'aptarchive/dists/unstable/main/binary-amd64/Packages.gz')
+ breakfiles 'aptarchive/dists/unstable/main/binary-amd64/Packages.gz'
+ testfailureequal "Ign:1 $1 unstable InRelease
+ 404 Not Found
+Hit:2 $1 unstable Release
+Get:4 $1 unstable/main amd64 Packages [$SIZE B]
+Err:4 $1 unstable/main amd64 Packages
+ Hash Sum mismatch
+ Hashes of expected file:
+ - Filesize:$(stat -c '%s' 'aptarchive/dists/unstable/main/binary-amd64/Packages.gz.bak') [weak]
+ - SHA256:$(sha256sum 'aptarchive/dists/unstable/main/binary-amd64/Packages.gz.bak' | cut -d' ' -f 1)
+ Hashes of received file:
+ - SHA256:$(sha256sum 'aptarchive/dists/unstable/main/binary-amd64/Packages.gz' | cut -d' ' -f 1)
+ - Filesize:$(stat -c '%s' 'aptarchive/dists/unstable/main/binary-amd64/Packages.gz') [weak]
+ Last modification reported: $(lastmodification 'aptarchive/dists/unstable/main/binary-amd64/Packages.gz')
+ Release file created at: $(releasefiledate 'aptarchive/dists/unstable/Release')
+Reading package lists...
+E: Failed to fetch $1/dists/unstable/main/binary-amd64/Packages.gz Hash Sum mismatch
+ Hashes of expected file:
+ - Filesize:$(stat -c '%s' 'aptarchive/dists/unstable/main/binary-amd64/Packages.gz.bak') [weak]
+ - SHA256:$(sha256sum 'aptarchive/dists/unstable/main/binary-amd64/Packages.gz.bak' | cut -d' ' -f 1)
+ Hashes of received file:
+ - SHA256:$(sha256sum 'aptarchive/dists/unstable/main/binary-amd64/Packages.gz' | cut -d' ' -f 1)
+ - Filesize:$(stat -c '%s' 'aptarchive/dists/unstable/main/binary-amd64/Packages.gz') [weak]
+ Last modification reported: $(lastmodification 'aptarchive/dists/unstable/main/binary-amd64/Packages.gz')
+ Release file created at: $(releasefiledate 'aptarchive/dists/unstable/Release')
+E: Some index files failed to download. They have been ignored, or old ones used instead." aptget update
+ testfileequal 'listsdir-without-amd64.lst' "$(listcurrentlistsdirectory)"
+ rm -rf aptarchive/dists
+ cp -a aptarchive/dists.good aptarchive/dists
+ find aptarchive/dists -name 'InRelease' -delete
+
+ # … now everything is fine again
+ testsuccessequal "Ign:1 $1 unstable InRelease
+ 404 Not Found
+Hit:2 $1 unstable Release
+Get:4 $1 unstable/main amd64 Packages [$(stat -c '%s' 'aptarchive/dists/unstable/main/binary-amd64/Packages.gz') B]
+Reading package lists..." aptget update
+ testfileequal 'listsdir.lst' "$(listcurrentlistsdirectory)"
+
+ webserverconfig 'aptwebserver::support::modified-since' 'false'
+ webserverconfig 'aptwebserver::support::last-modified' 'false'
+ testsuccessequal "Ign:1 $1 unstable InRelease
+ 404 Not Found
+Get:2 $1 unstable Release [$(stat -c '%s' 'aptarchive/dists/unstable/Release') B]
+Reading package lists..." aptget update
+ webserverconfig 'aptwebserver::support::modified-since' 'true'
+ webserverconfig 'aptwebserver::support::last-modified' 'true'
+
+ rm -rf aptarchive/dists
+ cp -a aptarchive/dists.good aptarchive/dists
+
+ # new release file, but the indexes are the same
+ redatereleasefiles '+2 hours'
+
+ rm -rf rootdir/var/lib/apt/lists.good
+ cp -a rootdir/var/lib/apt/lists rootdir/var/lib/apt/lists.good
+ testsuccessequal "Get:1 $1 unstable InRelease [$(stat -c '%s' 'aptarchive/dists/unstable/InRelease') B]
+Reading package lists..." aptget update
+
+ rm -rf rootdir/var/lib/apt/lists
+ cp -a rootdir/var/lib/apt/lists.good rootdir/var/lib/apt/lists
+ find rootdir/var/lib/apt/lists -name '*_Packages*' -delete
+ testsuccessequal "Get:1 $1 unstable InRelease [$(stat -c '%s' 'aptarchive/dists/unstable/InRelease') B]
+Get:2 $1 unstable/main amd64 Packages [$(stat -c '%s' 'aptarchive/dists/unstable/main/binary-amd64/Packages.gz') B]
+Get:3 $1 unstable/main i386 Packages [$(stat -c '%s' 'aptarchive/dists/unstable/main/binary-i386/Packages.gz') B]
+Reading package lists..." aptget update
+
+ rm -rf aptarchive/dists
+ cp -a aptarchive/dists.good aptarchive/dists
+}
+
+changetowebserver
+methodtest "http://localhost:${APTHTTPPORT}"
+
+changetohttpswebserver
+methodtest "https://localhost:${APTHTTPSPORT}"