summaryrefslogtreecommitdiff
path: root/test/integration/test-policy-pinning
diff options
context:
space:
mode:
Diffstat (limited to 'test/integration/test-policy-pinning')
-rwxr-xr-xtest/integration/test-policy-pinning58
1 files changed, 50 insertions, 8 deletions
diff --git a/test/integration/test-policy-pinning b/test/integration/test-policy-pinning
index 6b1473564..9e1ea4ac5 100755
--- a/test/integration/test-policy-pinning
+++ b/test/integration/test-policy-pinning
@@ -25,28 +25,70 @@ testequalpolicy() {
Pinned packages:" aptcache policy $*
}
-aptget update -qq
+aptgetupdate() {
+ # just to be sure that no old files are used
+ rm -rf rootdir/var/lib/apt
+ if aptget update -qq 2>&1 | grep '^E: '; then
+ msgwarn 'apt-get update failed with an error'
+ fi
+}
+
+### not signed archive
+
+aptgetupdate
testequalpolicy 100 500
testequalpolicy 990 500 -t now
sed -i aptarchive/Release -e 1i"NotAutomatic: yes"
-aptget update -qq
+aptgetupdate
testequalpolicy 100 1 -o Test=NotAutomatic
testequalpolicy 990 1 -o Test=NotAutomatic -t now
sed -i aptarchive/Release -e 1i"ButAutomaticUpgrades: yes"
-aptget update -qq
+aptgetupdate
testequalpolicy 100 100 -o Test=ButAutomaticUpgrades
testequalpolicy 990 100 -o Test=ButAutomaticUpgrades -t now
sed -i aptarchive/Release -e 's#NotAutomatic: yes#NotAutomatic: no#' -e '/ButAutomaticUpgrades: / d'
-aptget update -qq
+aptgetupdate
testequalpolicy 100 500 -o Test=Automatic
testequalpolicy 990 500 -o Test=Automatic -t now
+sed -i aptarchive/Release -e '/NotAutomatic: / d' -e '/ButAutomaticUpgrades: / d'
+
+### signed but no key in trusted
+
+signreleasefiles 'Marvin Paranoid'
+aptgetupdate
+testequalpolicy 100 500
+testequalpolicy 990 500 -t now
+
+sed -i aptarchive/Release -e 1i"NotAutomatic: yes"
+signreleasefiles 'Marvin Paranoid'
+aptgetupdate
+
+testequalpolicy 100 1 -o Test=NotAutomatic
+testequalpolicy 990 1 -o Test=NotAutomatic -t now
+
+sed -i aptarchive/Release -e 1i"ButAutomaticUpgrades: yes"
+signreleasefiles 'Marvin Paranoid'
+aptgetupdate
+
+testequalpolicy 100 100 -o Test=ButAutomaticUpgrades
+testequalpolicy 990 100 -o Test=ButAutomaticUpgrades -t now
+
+sed -i aptarchive/Release -e 's#NotAutomatic: yes#NotAutomatic: no#' -e '/ButAutomaticUpgrades: / d'
+signreleasefiles 'Marvin Paranoid'
+aptgetupdate
+
+testequalpolicy 100 500 -o Test=Automatic
+testequalpolicy 990 500 -o Test=Automatic -t now
+
+### signed and valid key
+
buildsimplenativepackage "coolstuff" "all" "1.0" "stable"
buildsimplenativepackage "coolstuff" "all" "2.0~bpo1" "backports"
@@ -132,7 +174,7 @@ Pin-Priority: -1" > rootdir/etc/apt/preferences
rm rootdir/etc/apt/preferences
sed -i aptarchive/dists/backports/Release -e 1i"NotAutomatic: yes"
signreleasefiles
-aptget update -qq
+aptgetupdate
testequalpolicycoolstuff "" "1.0" 1 500 0 "" -o Test=NotAutomatic
testequalpolicycoolstuff "" "1.0" 1 990 0 "" -o Test=NotAutomatic -t stable
@@ -160,7 +202,7 @@ testequalpolicycoolstuff "" "1.0" 1 990 600 "2.0~bpo1" -o Test=NotAutomatic -t s
rm rootdir/etc/apt/preferences
sed -i aptarchive/dists/backports/Release -e 1i"ButAutomaticUpgrades: yes"
signreleasefiles
-aptget update -qq
+aptgetupdate
testequalpolicycoolstuff "" "1.0" 100 500 0 "" -o Test=ButAutomaticUpgrades
testequalpolicycoolstuff "" "1.0" 100 990 0 "" -o Test=ButAutomaticUpgrades -t stable
@@ -206,7 +248,7 @@ setupaptarchive
sed -i aptarchive/dists/backports/Release -e 1i"NotAutomatic: yes"
signreleasefiles
-aptget update -qq
+aptgetupdate
testequalpolicycoolstuff "2.0~bpo1" "2.0~bpo1" 1 500 0 "" "2.0~bpo2" -o Test=NotAutomatic
testequalpolicycoolstuff "2.0~bpo1" "2.0~bpo1" 1 990 0 "" "2.0~bpo2" -o Test=NotAutomatic -t stable
@@ -214,7 +256,7 @@ testequalpolicycoolstuff "2.0~bpo1" "2.0~bpo2" 990 500 0 "" "2.0~bpo2" -o Test=N
sed -i aptarchive/dists/backports/Release -e 1i"ButAutomaticUpgrades: yes"
signreleasefiles
-aptget update -qq
+aptgetupdate
testequalpolicycoolstuff "2.0~bpo1" "2.0~bpo2" 100 500 0 "" "2.0~bpo2" -o Test=ButAutomaticUpgrades
testequalpolicycoolstuff "2.0~bpo1" "2.0~bpo2" 100 990 0 "" "2.0~bpo2" -o Test=ButAutomaticUpgrades -t stable