test-different-methods-for-same-source 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. #!/bin/sh
  2. set -e
  3. TESTDIR="$(readlink -f "$(dirname "$0")")"
  4. . "$TESTDIR/framework"
  5. setupenvironment
  6. configarchitecture 'amd64'
  7. insertpackage 'stable' 'foo' 'all' '1'
  8. insertsource 'stable' 'foo' 'all' '1'
  9. setupaptarchive --no-update
  10. # install a slowed down file: otherwise its to fast to reproduce combining
  11. NEWMETHODS="$(readlink -f rootdir)/usr/lib/apt/methods"
  12. OLDMETHODS="$(readlink -f rootdir/usr/lib/apt/methods)"
  13. rm "$NEWMETHODS"
  14. mkdir "$NEWMETHODS"
  15. backupIFS="$IFS"
  16. IFS="$(printf "\n\b")"
  17. for METH in $(find "$OLDMETHODS" -maxdepth 1 ! -type d); do
  18. ln -s "$OLDMETHODS/$(basename "$METH")" "$NEWMETHODS"
  19. done
  20. IFS="$backupIFS"
  21. ln -s "${OLDMETHODS}/http" "${NEWMETHODS}/http-ng"
  22. changetowebserver
  23. webserverconfig 'aptwebserver::redirect::replace::/redirectme/' "http://localhost:${APTHTTPPORT}/"
  24. sed -i -e 's# http:# http-ng:#' $(find rootdir/etc/apt/sources.list.d -name '*-deb-src.list')
  25. testsuccess apt update -o Debug::Acquire::http-ng=1
  26. cp rootdir/tmp/testsuccess.output update.log
  27. # all requests are folded into the first Release file
  28. testsuccess grep ' http-ng://' update.log
  29. testfailure grep ' http://' update.log
  30. # see if method-specific debug was enabled
  31. testsuccess grep '^Answer for: http-ng:' update.log
  32. rm -rf rootdir/var/lib/apt/lists
  33. sed -i -e "s#:${APTHTTPPORT}/#:${APTHTTPPORT}/redirectme#" rootdir/etc/apt/sources.list.d/*
  34. testsuccess apt update -o Debug::Acquire::http-ng=1
  35. cp rootdir/tmp/testsuccess.output update.log
  36. # all requests are folded into the first Release file
  37. testsuccess grep ' http-ng://' update.log
  38. testfailure grep '^[^L].* http://' update.log
  39. # see if method-specific debug was enabled
  40. testsuccess grep '^Answer for: http-ng:' update.log