X-Git-Url: https://git.saurik.com/apt.git/blobdiff_plain/002b1bc46b18e9d309d337ddb15a6ccdfb6c9dde..4b1fb7b1876bdb46cb7a0329158f12638baa2464:/test/integration/test-apt-update-failure-propagation diff --git a/test/integration/test-apt-update-failure-propagation b/test/integration/test-apt-update-failure-propagation index 713f09db7..1361b1b93 100755 --- a/test/integration/test-apt-update-failure-propagation +++ b/test/integration/test-apt-update-failure-propagation @@ -16,7 +16,7 @@ rm "$NEWMETHODS" mkdir "$NEWMETHODS" backupIFS="$IFS" IFS="$(printf "\n\b")" -for METH in $(find "$OLDMETHODS" ! -type d); do +for METH in $(find "$OLDMETHODS" -maxdepth 1 ! -type d); do ln -s "$OLDMETHODS/$(basename "$METH")" "$NEWMETHODS" done IFS="$backupIFS" @@ -27,32 +27,45 @@ for FILE in rootdir/etc/apt/sources.list.d/*-sid-* ; do done pretest() { + msgmsg "$@" rm -rf rootdir/var/lib/apt/lists - testsuccessequal 'N: Unable to locate package foo' aptcache policy foo -q=0 + testsuccessequal 'N: Unable to locate package foo' aptcache policy foo } -pretest +pretest 'initialize test' 'update' testsuccess aptget update testsuccessequal "foo: Installed: (none) Candidate: 2 Version table: 2 500 - 500 http://localhost:${APTHTTPPORT} sid/main amd64 Packages + 500 http://localhost:${APTHTTPPORT} sid/main all Packages 1 500 - 500 https://localhost:${APTHTTPSPORT} stable/main amd64 Packages" aptcache policy foo + 500 https://localhost:${APTHTTPSPORT} stable/main all Packages" aptcache policy foo -pretest +pretest 'not found' 'release files' mv aptarchive/dists/stable aptarchive/dists/stable.good -testfailuremsg "E: The repository 'https://localhost:${APTHTTPSPORT} stable Release' does not have a Release file." aptget update -testfailureequal "Hit:1 http://localhost:${APTHTTPPORT} sid InRelease +testfailuremsg "E: The repository 'https://localhost:${APTHTTPSPORT} stable Release' does not have a Release file. +N: Updating from such a repository can't be done securely, and is therefore disabled by default. +N: See apt-secure(8) manpage for repository creation and user configuration details." apt update +testfailure aptget update --no-allow-insecure-repositories +testequalor2 "Hit:1 http://localhost:${APTHTTPPORT} sid InRelease Ign:2 https://localhost:${APTHTTPSPORT} stable InRelease 404 Not Found Err:3 https://localhost:${APTHTTPSPORT} stable Release 404 Not Found Reading package lists... E: The repository 'https://localhost:${APTHTTPSPORT} stable Release' does not have a Release file. -N: Updating such a repository securily is impossible and therefore disabled by default. -N: See apt-secure(8) manpage for repository creation and user configuration details." aptget update -q=0 +N: Updating from such a repository can't be done securely, and is therefore disabled by default. +N: See apt-secure(8) manpage for repository creation and user configuration details." "Ign:1 https://localhost:${APTHTTPSPORT} stable InRelease + 404 Not Found +Err:2 https://localhost:${APTHTTPSPORT} stable Release + 404 Not Found +Hit:3 http://localhost:${APTHTTPPORT} sid InRelease +Reading package lists... +E: The repository 'https://localhost:${APTHTTPSPORT} stable Release' does not have a Release file. +N: Updating from such a repository can't be done securely, and is therefore disabled by default. +N: See apt-secure(8) manpage for repository creation and user configuration details." cat rootdir/tmp/testfailure.output + mv aptarchive/dists/stable.good aptarchive/dists/stable posttest() { testsuccessequal "foo: @@ -60,23 +73,34 @@ posttest() { Candidate: 2 Version table: 2 500 - 500 http://localhost:${APTHTTPPORT} sid/main amd64 Packages" aptcache policy foo + 500 http://localhost:${APTHTTPPORT} sid/main all Packages" aptcache policy foo } posttest -pretest +pretest 'method disabled' 'https' +echo 'Dir::Bin::Methods::https "false";' > rootdir/etc/apt/apt.conf.d/99disable-https +testfailuremsg "E: The method 'https' is explicitly disabled via configuration. +N: If you meant to use Tor remember to use tor+https instead of https. +E: Failed to fetch https://localhost:${APTHTTPSPORT}/dists/stable/InRelease +E: Some index files failed to download. They have been ignored, or old ones used instead." aptget update +rm -f rootdir/etc/apt/apt.conf.d/99disable-https +posttest + +pretest 'method not installed' 'https' rm "${NEWMETHODS}/https" testfailuremsg "E: The method driver ${TMPWORKINGDIRECTORY}/rootdir/usr/lib/apt/methods/https could not be found. -W: Failed to fetch https://localhost:${APTHTTPSPORT}/dists/stable/InRelease +N: Is the package apt-transport-https installed? +E: Failed to fetch https://localhost:${APTHTTPSPORT}/dists/stable/InRelease E: Some index files failed to download. They have been ignored, or old ones used instead." aptget update posttest -ln -s "$OLDMETHODS/https" "$NEWMETHODS" -pretest +pretest 'https connection refused' 'doom port' for FILE in rootdir/etc/apt/sources.list.d/*-stable-* ; do # lets see how many testservers run also Doom sed -i -e "s#:${APTHTTPSPORT}/#:666/#" "$FILE" done -testwarningmsg "W: Failed to fetch https://localhost:666/dists/stable/InRelease Failed to connect to localhost port 666: Connection refused -W: Some index files failed to download. They have been ignored, or old ones used instead." aptget update +testwarning aptget update -o Dir::Bin::Methods::https="${OLDMETHODS}/https" +testequalor2 "W: Failed to fetch https://localhost:666/dists/stable/InRelease Failed to connect to localhost port 666: Connection refused +W: Some index files failed to download. They have been ignored, or old ones used instead." "W: Failed to fetch https://localhost:666/dists/stable/InRelease couldn't connect to host +W: Some index files failed to download. They have been ignored, or old ones used instead." tail -n 2 rootdir/tmp/testwarning.output posttest