You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

69 lines
1.7 KiB

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