test-apt-update-hooks 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. #!/bin/sh
  2. set -e
  3. TESTDIR="$(readlink -f "$(dirname "$0")")"
  4. . "$TESTDIR/framework"
  5. setupenvironment
  6. configarchitecture 'i386'
  7. confighashes 'SHA512'
  8. insertpackage 'unstable' 'foo' 'i386' '1.0'
  9. insertpackage 'testing' 'foo' 'any' '1.0'
  10. setupaptarchive --no-update
  11. APTARCHIVE="$(readlink -f ./aptarchive)"
  12. signreleasefiles 'Joe Sixpack'
  13. echo 'APT::Update::Post-Invoke-Success { "echo SUCCESS"; };' >> rootdir/etc/apt/apt.conf.d/display-success.conf
  14. echo 'APT::Update::Post-Invoke { "echo RUN"; };' >> rootdir/etc/apt/apt.conf.d/display-success.conf
  15. msgmsg "All sources OK => run Post-Invoke-Success and Post-Invoke"
  16. testsuccess aptget update
  17. cp rootdir/tmp/testsuccess.output aptupdate.output
  18. testsuccess grep "RUN" aptupdate.output
  19. testsuccess grep "SUCCESS" aptupdate.output
  20. msgmsg "Some sources broken => run Post-Invoke-Success and Post-Invoke"
  21. sed -i -e '/^ / d' -e '/^SHA512:/ d' "$APTARCHIVE/dists/unstable/Release"
  22. signreleasefiles
  23. testfailure aptget update
  24. cp rootdir/tmp/testfailure.output aptupdate.output
  25. testsuccess grep "RUN" aptupdate.output
  26. testsuccess grep "SUCCESS" aptupdate.output
  27. msgmsg "All sources broken => run Post-Invoke"
  28. sed -i -e '/^ / d' -e '/^SHA512:/ d' "$APTARCHIVE/dists/testing/Release"
  29. signreleasefiles
  30. testfailure aptget update
  31. cp rootdir/tmp/testfailure.output aptupdate.output
  32. testsuccess grep "RUN" aptupdate.output
  33. testfailure grep "SUCCESS" aptupdate.output