]>
Commit | Line | Data |
---|---|---|
6c34ccca DK |
1 | #!/bin/sh |
2 | set -e | |
3 | ||
4 | TESTDIR=$(readlink -f $(dirname $0)) | |
5 | . $TESTDIR/framework | |
6 | setupenvironment | |
7 | configarchitecture 'i386' | |
8 | ||
9 | buildsimplenativepackage 'cool' 'i386' '1.0' 'unstable' | |
10 | ||
11 | setupaptarchive --no-update | |
12 | ||
13 | testfileexists() { | |
1e3f4083 | 14 | msgtest 'Test for existence of file' "$1" |
6c34ccca DK |
15 | test -e "$1" && msgpass || msgfail |
16 | rm -f "$1" | |
17 | } | |
18 | ||
19 | testfilemissing() { | |
20 | msgtest 'Test for non-existance of file' "$1" | |
21 | test -e "$1" && msgfail || msgpass | |
22 | rm -f "$1" | |
23 | } | |
24 | ||
25 | testrun() { | |
26 | rm -rf rootdir/var/lib/apt | |
6c34ccca | 27 | |
d57f6084 | 28 | if [ "$1" = 'trusted' ]; then |
c99fe2e1 | 29 | testsuccess aptget update |
e1bd768b | 30 | |
d57f6084 DK |
31 | testsuccess aptget download cool |
32 | testfileexists 'cool_1.0_i386.deb' | |
33 | ||
34 | testsuccess aptget download cool --allow-unauthenticated | |
35 | testfileexists 'cool_1.0_i386.deb' | |
36 | else | |
c99fe2e1 | 37 | testsuccess aptget update --allow-insecure-repositories |
e1bd768b | 38 | |
d57f6084 DK |
39 | testfailure aptget download cool |
40 | testfilemissing 'cool_1.0_i386.deb' | |
41 | ||
42 | testsuccess aptget download cool --allow-unauthenticated | |
43 | testfileexists 'cool_1.0_i386.deb' | |
44 | fi | |
6c34ccca DK |
45 | |
46 | mv aptarchive/pool/cool_1.0_i386.deb aptarchive/pool/cool_1.0_i386.deb.bak | |
47 | echo 'this is not a good package' > aptarchive/pool/cool_1.0_i386.deb | |
d57f6084 | 48 | testfailure aptget download cool |
6c34ccca DK |
49 | testfilemissing cool_1.0_i386.deb |
50 | ||
d57f6084 | 51 | testfailure aptget download cool --allow-unauthenticated # unauthenticated doesn't mean unchecked |
6c34ccca DK |
52 | testfilemissing cool_1.0_i386.deb |
53 | ||
54 | rm -f aptarchive/pool/cool_1.0_i386.deb | |
55 | mv aptarchive/pool/cool_1.0_i386.deb.bak aptarchive/pool/cool_1.0_i386.deb | |
56 | testsuccess aptget download cool --allow-unauthenticated | |
57 | testfileexists 'cool_1.0_i386.deb' | |
58 | } | |
59 | ||
d57f6084 | 60 | testrun 'trusted' |
6c34ccca DK |
61 | |
62 | find aptarchive/ \( -name 'Release.gpg' -o -name 'InRelease' \) -delete | |
d57f6084 DK |
63 | testrun 'untrusted' |
64 | ||
65 | changetowebserver | |
66 | testrun 'untrusted' |