test-bug-738785-switch-protocol 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. #!/bin/sh
  2. set -e
  3. TESTDIR=$(readlink -f $(dirname $0))
  4. . $TESTDIR/framework
  5. setupenvironment
  6. configarchitecture "i386"
  7. buildsimplenativepackage 'apt' 'all' '1.0' 'stable'
  8. # setup http redirecting to https
  9. setupaptarchive --no-update
  10. changetowebserver -o 'aptwebserver::redirect::replace::/redirectme/=https://localhost:4433/' \
  11. -o 'aptwebserver::support::http=false'
  12. changetohttpswebserver
  13. sed -i -e 's#:4433/#:8080/redirectme#' -e 's# https:# http:#' rootdir/etc/apt/sources.list.d/*
  14. testsuccess aptget update -o Debug::Acquire::http=1 -o Debug::Acquire::https=1 -o Debug::pkgAcquire::Worker=1
  15. msgtest 'Test that the webserver does not answer' 'http requests'
  16. downloadfile 'http://localhost:8080/pool/apt_1.0/changelog' changelog >/dev/null 2>&1 && msgfail || msgpass
  17. echo 'Apt::Changelogs::Server "http://localhost:8080/redirectme";' > rootdir/etc/apt/apt.conf.d/changelog.conf
  18. testequal "'http://localhost:8080/redirectme/pool/apt_1.0/changelog'" aptget changelog apt --print-uris
  19. testsuccess aptget changelog apt -d
  20. testsuccess test -s apt.changelog
  21. rm -f apt.changelog
  22. testsuccess aptget download apt
  23. testsuccess test -s apt_1.0_all.deb
  24. rm apt_1.0_all.deb
  25. testsuccess aptget install apt -y
  26. testdpkginstalled 'apt'
  27. # create a copy of all methods, expect https
  28. eval `aptconfig shell METHODS Dir::Bin::Methods/d`
  29. COPYMETHODS='usr/lib/apt/methods'
  30. rm rootdir/$COPYMETHODS
  31. mkdir -p rootdir/$COPYMETHODS
  32. cd rootdir/$COPYMETHODS
  33. find $METHODS \! -type d | while read meth; do
  34. ln -s $meth
  35. done
  36. rm https
  37. cd - >/dev/null
  38. echo "Dir::Bin::Methods \"${COPYMETHODS}\";" >> aptconfig.conf
  39. aptget download apt
  40. testsuccess test ! -e apt_1.0_all.deb