test-http-pipeline-messup 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. #!/bin/sh
  2. set -e
  3. TESTDIR="$(readlink -f "$(dirname "$0")")"
  4. . "$TESTDIR/framework"
  5. setupenvironment
  6. configarchitecture "i386"
  7. # try a little harder to create a size mismatch
  8. buildsimplenativepackage 'pkg0' 'all' '1.0' 'stable' "Depends: foo" '' '' '' '' 'none'
  9. buildsimplenativepackage 'pkga' 'all' '1.0' 'stable' "Depends: foo" '' '' '' '' 'none'
  10. buildsimplenativepackage 'pkgb' 'all' '1.0' 'stable' "Depends: foo" '' '' '' '' 'none'
  11. buildsimplenativepackage 'pkgc' 'all' '1.0' 'stable' "Depends: f$(for i in $(seq 0 1000); do printf 'o'; done)" '' '' '' '' 'none'
  12. buildsimplenativepackage 'pkgd' 'all' '1.0' 'stable' "Depends: f$(for i in $(seq 0 1000); do printf 'o'; done)" '' '' '' '' 'none'
  13. setupaptarchive --no-update
  14. # simulate (and be a predictable) pipeline mess-up by the server/proxy
  15. changetowebserver \
  16. -o 'aptwebserver::overwrite::.*pkga.*::filename=/pool/pkgd_1.0_all.deb' \
  17. -o 'aptwebserver::overwrite::.*pkgc.*::filename=/pool/pkgb_1.0_all.deb' \
  18. -o 'aptwebserver::overwrite::.*pkgb.*::filename=/pool/pkgc_1.0_all.deb' \
  19. -o 'aptwebserver::overwrite::.*pkgd.*::filename=/pool/pkga_1.0_all.deb'
  20. echo 'Debug::Acquire::http "true";
  21. Debug::pkgAcquire::Worker "true";' > rootdir/etc/apt/apt.conf.d/99debug
  22. testsuccess aptget update
  23. cd downloaded
  24. # messup is bigger than pipeline: checks if fixup isn't trying too hard
  25. testfailure aptget download pkga pkgb pkgc pkgd -o Acquire::http::Pipeline-Depth=2
  26. for pkg in 'pkga' 'pkgd'; do
  27. testfailure test -f ${pkg}_1.0_all.deb
  28. done
  29. for pkg in 'pkgb' 'pkgc'; do
  30. testsuccess test -f ${pkg}_1.0_all.deb
  31. testsuccess cmp ../incoming/${pkg}_1.0_all.deb ${pkg}_1.0_all.deb
  32. rm -f ${pkg}_1.0_all.deb
  33. done
  34. # ensure that pipeling is enabled for rest of this test
  35. echo 'Acquire::http::Pipeline-Depth 10;' > ../rootdir/etc/apt/apt.conf.d/99enable-pipeline
  36. # the output is a bit strange: it looks like it has downloaded pkga 4 times
  37. testwarning aptget download pkg0 pkga pkgb pkgc pkgd
  38. for pkg in 'pkg0' 'pkga' 'pkgb' 'pkgc' 'pkgd'; do
  39. testsuccess test -f ${pkg}_1.0_all.deb
  40. testsuccess cmp ../incoming/${pkg}_1.0_all.deb ${pkg}_1.0_all.deb
  41. rm -f ${pkg}_1.0_all.deb
  42. done
  43. # while hashes will pass (as none are available), sizes will not match, so failure
  44. # checks that no hashes means that pipeline depth is ignored as we can't fixup
  45. testfailure aptget download pkga pkgb pkgc pkgd --allow-unauthenticated -o Acquire::ForceHash=ROT26