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