]> git.saurik.com Git - apt.git/blame - test/integration/test-apt-update-failure-propagation
reenable gcc warnings for deprecated functions
[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
31 testsuccessequal 'N: Unable to locate package foo' aptcache policy foo -q=0
32}
33pretest
34testsuccess aptget update
35testsuccessequal "foo:
36 Installed: (none)
37 Candidate: 2
38 Version table:
39 2 500
40 500 http://localhost:${APTHTTPPORT} sid/main amd64 Packages
41 1 500
42 500 https://localhost:${APTHTTPSPORT} stable/main amd64 Packages" aptcache policy foo
43
44pretest
45mv aptarchive/dists/stable aptarchive/dists/stable.good
995a4bf6 46testfailuremsg "E: The repository 'https://localhost:${APTHTTPSPORT} stable Release' does not have a Release file." apt update
002b1bc4
DK
47testfailureequal "Hit:1 http://localhost:${APTHTTPPORT} sid InRelease
48Ign:2 https://localhost:${APTHTTPSPORT} stable InRelease
49 404 Not Found
50Err:3 https://localhost:${APTHTTPSPORT} stable Release
51 404 Not Found
52Reading package lists...
53E: The repository 'https://localhost:${APTHTTPSPORT} stable Release' does not have a Release file.
54N: Updating such a repository securily is impossible and therefore disabled by default.
995a4bf6 55N: See apt-secure(8) manpage for repository creation and user configuration details." aptget update -q=0 --no-allow-insecure-repositories
002b1bc4
DK
56mv aptarchive/dists/stable.good aptarchive/dists/stable
57posttest() {
58 testsuccessequal "foo:
59 Installed: (none)
60 Candidate: 2
61 Version table:
62 2 500
63 500 http://localhost:${APTHTTPPORT} sid/main amd64 Packages" aptcache policy foo
64}
65posttest
66
67pretest
68rm "${NEWMETHODS}/https"
69testfailuremsg "E: The method driver ${TMPWORKINGDIRECTORY}/rootdir/usr/lib/apt/methods/https could not be found.
70W: Failed to fetch https://localhost:${APTHTTPSPORT}/dists/stable/InRelease
71E: Some index files failed to download. They have been ignored, or old ones used instead." aptget update
72posttest
73
74ln -s "$OLDMETHODS/https" "$NEWMETHODS"
75pretest
76for FILE in rootdir/etc/apt/sources.list.d/*-stable-* ; do
77 # lets see how many testservers run also Doom
78 sed -i -e "s#:${APTHTTPSPORT}/#:666/#" "$FILE"
79done
80testwarningmsg "W: Failed to fetch https://localhost:666/dists/stable/InRelease Failed to connect to localhost port 666: Connection refused
81W: Some index files failed to download. They have been ignored, or old ones used instead." aptget update
82posttest