]> git.saurik.com Git - apt.git/blame - test/integration/test-apt-update-failure-propagation
test-apt-download-progress: Allow smaller progress change
[apt.git] / test / integration / test-apt-update-failure-propagation
CommitLineData
002b1bc4
DK
1#!/bin/sh
2set -e
3
4TESTDIR="$(readlink -f "$(dirname "$0")")"
5. "$TESTDIR/framework"
6setupenvironment
7configarchitecture 'amd64'
8
9buildsimplenativepackage 'foo' 'all' '1' 'stable'
10buildsimplenativepackage 'foo' 'all' '2' 'sid'
11setupaptarchive --no-update
12
13NEWMETHODS="$(readlink -f rootdir)/usr/lib/apt/methods"
14OLDMETHODS="$(readlink -f rootdir/usr/lib/apt/methods)"
15rm "$NEWMETHODS"
16mkdir "$NEWMETHODS"
17backupIFS="$IFS"
18IFS="$(printf "\n\b")"
19for METH in $(find "$OLDMETHODS" ! -type d); do
20 ln -s "$OLDMETHODS/$(basename "$METH")" "$NEWMETHODS"
21done
22IFS="$backupIFS"
23
24changetohttpswebserver
25for FILE in rootdir/etc/apt/sources.list.d/*-sid-* ; do
26 sed -i -e 's#https:#http:#' -e "s#:${APTHTTPSPORT}/#:${APTHTTPPORT}/#" "$FILE"
27done
28
29pretest() {
30 rm -rf rootdir/var/lib/apt/lists
87d6947d 31 testsuccessequal 'N: Unable to locate package foo' aptcache policy foo
002b1bc4
DK
32}
33pretest
34testsuccess aptget update
35testsuccessequal "foo:
36 Installed: (none)
37 Candidate: 2
38 Version table:
39 2 500
1dd20368 40 500 http://localhost:${APTHTTPPORT} sid/main all Packages
002b1bc4 41 1 500
1dd20368 42 500 https://localhost:${APTHTTPSPORT} stable/main all Packages" aptcache policy foo
002b1bc4
DK
43
44pretest
45mv aptarchive/dists/stable aptarchive/dists/stable.good
87d6947d 46testfailuremsg "E: The repository 'https://localhost:${APTHTTPSPORT} stable Release' does not have a Release file.
83960341 47N: Updating from such a repository can't be done securely, and is therefore disabled by default.
87d6947d
DK
48N: See apt-secure(8) manpage for repository creation and user configuration details." apt update
49testfailure aptget update --no-allow-insecure-repositories
1dd20368 50testequalor2 "Hit:1 http://localhost:${APTHTTPPORT} sid InRelease
002b1bc4
DK
51Ign:2 https://localhost:${APTHTTPSPORT} stable InRelease
52 404 Not Found
53Err:3 https://localhost:${APTHTTPSPORT} stable Release
54 404 Not Found
55Reading package lists...
56E: The repository 'https://localhost:${APTHTTPSPORT} stable Release' does not have a Release file.
83960341 57N: Updating from such a repository can't be done securely, and is therefore disabled by default.
1dd20368
DK
58N: See apt-secure(8) manpage for repository creation and user configuration details." "Ign:1 https://localhost:${APTHTTPSPORT} stable InRelease
59 404 Not Found
60Err:2 https://localhost:${APTHTTPSPORT} stable Release
61 404 Not Found
62Hit:3 http://localhost:${APTHTTPPORT} sid InRelease
63Reading package lists...
64E: The repository 'https://localhost:${APTHTTPSPORT} stable Release' does not have a Release file.
83960341 65N: Updating from such a repository can't be done securely, and is therefore disabled by default.
1dd20368
DK
66N: See apt-secure(8) manpage for repository creation and user configuration details." cat rootdir/tmp/testfailure.output
67
002b1bc4
DK
68mv aptarchive/dists/stable.good aptarchive/dists/stable
69posttest() {
70 testsuccessequal "foo:
71 Installed: (none)
72 Candidate: 2
73 Version table:
74 2 500
1dd20368 75 500 http://localhost:${APTHTTPPORT} sid/main all Packages" aptcache policy foo
002b1bc4
DK
76}
77posttest
78
79pretest
80rm "${NEWMETHODS}/https"
81testfailuremsg "E: The method driver ${TMPWORKINGDIRECTORY}/rootdir/usr/lib/apt/methods/https could not be found.
87d6947d 82N: Is the package apt-transport-https installed?
002b1bc4
DK
83W: Failed to fetch https://localhost:${APTHTTPSPORT}/dists/stable/InRelease
84E: Some index files failed to download. They have been ignored, or old ones used instead." aptget update
85posttest
86
87ln -s "$OLDMETHODS/https" "$NEWMETHODS"
88pretest
89for FILE in rootdir/etc/apt/sources.list.d/*-stable-* ; do
90 # lets see how many testservers run also Doom
91 sed -i -e "s#:${APTHTTPSPORT}/#:666/#" "$FILE"
92done
30c8107e
DK
93testwarning aptget update
94testequalor2 "W: Failed to fetch https://localhost:666/dists/stable/InRelease Failed to connect to localhost port 666: Connection refused
95W: 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
96W: Some index files failed to download. They have been ignored, or old ones used instead." tail -n 2 rootdir/tmp/testwarning.output
002b1bc4 97posttest