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.
 
 
 
 
 
 

91 lines
3.6 KiB

  1. #!/bin/sh
  2. set -e
  3. TESTDIR="$(readlink -f "$(dirname "$0")")"
  4. . "$TESTDIR/framework"
  5. setupenvironment
  6. configarchitecture 'amd64'
  7. buildsimplenativepackage 'foo' 'all' '1' 'stable'
  8. buildsimplenativepackage 'foo' 'all' '2' 'sid'
  9. setupaptarchive --no-update
  10. NEWMETHODS="$(readlink -f rootdir)/usr/lib/apt/methods"
  11. OLDMETHODS="$(readlink -f rootdir/usr/lib/apt/methods)"
  12. rm "$NEWMETHODS"
  13. mkdir "$NEWMETHODS"
  14. backupIFS="$IFS"
  15. IFS="$(printf "\n\b")"
  16. for METH in $(find "$OLDMETHODS" -maxdepth 1 ! -type d); do
  17. ln -s "$OLDMETHODS/$(basename "$METH")" "$NEWMETHODS"
  18. done
  19. IFS="$backupIFS"
  20. changetohttpswebserver
  21. for FILE in rootdir/etc/apt/sources.list.d/*-sid-* ; do
  22. sed -i -e 's#https:#http:#' -e "s#:${APTHTTPSPORT}/#:${APTHTTPPORT}/#" "$FILE"
  23. done
  24. pretest() {
  25. msgmsg "$@"
  26. rm -rf rootdir/var/lib/apt/lists
  27. testsuccessequal 'N: Unable to locate package foo' aptcache policy foo
  28. }
  29. pretest 'initialize test' 'update'
  30. testsuccess aptget update
  31. testsuccessequal "foo:
  32. Installed: (none)
  33. Candidate: 2
  34. Version table:
  35. 2 500
  36. 500 http://localhost:${APTHTTPPORT} sid/main all Packages
  37. 1 500
  38. 500 https://localhost:${APTHTTPSPORT} stable/main all Packages" aptcache policy foo
  39. pretest 'not found' 'release files'
  40. mv aptarchive/dists/stable aptarchive/dists/stable.good
  41. testfailuremsg "E: The repository 'https://localhost:${APTHTTPSPORT} stable Release' does not have a Release file.
  42. N: Updating from such a repository can't be done securely, and is therefore disabled by default.
  43. N: See apt-secure(8) manpage for repository creation and user configuration details." apt update
  44. testfailuremsg "E: The repository 'https://localhost:${APTHTTPSPORT} stable Release' does not have a Release file.
  45. N: Updating from such a repository can't be done securely, and is therefore disabled by default.
  46. N: See apt-secure(8) manpage for repository creation and user configuration details." aptget update
  47. mv aptarchive/dists/stable.good aptarchive/dists/stable
  48. posttest() {
  49. testsuccessequal "foo:
  50. Installed: (none)
  51. Candidate: 2
  52. Version table:
  53. 2 500
  54. 500 http://localhost:${APTHTTPPORT} sid/main all Packages" aptcache policy foo
  55. }
  56. posttest
  57. pretest 'method disabled' 'https'
  58. echo 'Dir::Bin::Methods::https "false";' > rootdir/etc/apt/apt.conf.d/99disable-https
  59. testfailuremsg "E: The method 'https' is explicitly disabled via configuration.
  60. N: If you meant to use Tor remember to use tor+https instead of https.
  61. E: Failed to fetch https://localhost:${APTHTTPSPORT}/dists/stable/InRelease
  62. E: Some index files failed to download. They have been ignored, or old ones used instead." aptget update
  63. rm -f rootdir/etc/apt/apt.conf.d/99disable-https
  64. posttest
  65. pretest 'method not installed' 'https'
  66. rm "${NEWMETHODS}/https"
  67. testfailuremsg "E: The method driver ${TMPWORKINGDIRECTORY}/rootdir/usr/lib/apt/methods/https could not be found.
  68. N: Is the package apt-transport-https installed?
  69. E: Failed to fetch https://localhost:${APTHTTPSPORT}/dists/stable/InRelease
  70. E: Some index files failed to download. They have been ignored, or old ones used instead." aptget update
  71. posttest
  72. pretest 'https connection refused' 'doom port'
  73. for FILE in rootdir/etc/apt/sources.list.d/*-stable-* ; do
  74. # lets see how many testservers run also Doom
  75. sed -i -e "s#:${APTHTTPSPORT}/#:666/#" "$FILE"
  76. done
  77. testwarning aptget update -o Dir::Bin::Methods::https="${OLDMETHODS}/https"
  78. testsuccess grep '^W: Failed to fetch https://localhost:666/dists/stable/InRelease ' rootdir/tmp/testwarning.output
  79. testequal 'W: Some index files failed to download. They have been ignored, or old ones used instead.' tail -n 1 rootdir/tmp/testwarning.output
  80. posttest