test-releasefile-valid-until 2.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. #!/bin/sh
  2. set -e
  3. TESTDIR=$(readlink -f $(dirname $0))
  4. . $TESTDIR/framework
  5. setupenvironment
  6. configarchitecture 'i386'
  7. insertpackage 'wheezy' 'apt' 'all' '0.8.15'
  8. getlabelfromsuite() {
  9. echo -n 'Testcases'
  10. }
  11. setupaptarchive --no-update
  12. runtest() {
  13. local MSG="$1"
  14. msgtest "$1" "$2"
  15. rm -rf rootdir/var/lib/apt/lists
  16. aptget clean
  17. generatereleasefiles "$3" "$4"
  18. signreleasefiles
  19. shift 4
  20. if expr match "$MSG" '.*accepted.*' >/dev/null; then
  21. testsuccess --nomsg aptget update "$@"
  22. testfailure grep -q 'is expired' rootdir/tmp/testsuccess.output
  23. else
  24. testfailure --nomsg aptget update "$@"
  25. testsuccess grep -q 'is expired' rootdir/tmp/testfailure.output
  26. fi
  27. }
  28. runtest 'Release file is accepted as it has' 'no Until' '' ''
  29. runtest 'Release file is accepted as it has' 'no Until and good Max-Valid' '' '' -o Acquire::Max-ValidTime=3600
  30. runtest 'Release file is rejected as it has' 'no Until, but bad Max-Valid' 'now - 2 days' '' -o Acquire::Max-ValidTime=3600
  31. runtest 'Release file is accepted as it has' 'good Until' 'now - 3 days' 'now + 1 day'
  32. runtest 'Release file is rejected as it has' 'bad Until' 'now - 7 days' 'now - 4 days'
  33. runtest 'Release file is rejected as it has' 'bad Until (ignore good Max-Valid)' 'now - 7 days' 'now - 4 days' -o Acquire::Max-ValidTime=1209600
  34. runtest 'Release file is rejected as it has' 'bad Max-Valid (bad Until)' 'now - 7 days' 'now - 4 days' -o Acquire::Max-ValidTime=86400
  35. runtest 'Release file is rejected as it has' 'bad Max-Valid (good Until)' 'now - 7 days' 'now + 4 days' -o Acquire::Max-ValidTime=86400
  36. runtest 'Release file is accepted as it has' 'good labeled Max-Valid' 'now - 7 days' 'now + 4 days' -o Acquire::Max-ValidTime=86400 -o Acquire::Max-ValidTime::Testcases=1209600
  37. runtest 'Release file is rejected as it has' 'bad labeled Max-Valid' 'now - 7 days' 'now + 4 days' -o Acquire::Max-ValidTime=1209600 -o Acquire::Max-ValidTime::Testcases=86400
  38. runtest 'Release file is accepted as it has' 'good Until (good Min-Valid, no Max-Valid)' 'now - 7 days' 'now + 1 days' -o Acquire::Min-ValidTime=1209600
  39. runtest 'Release file is accepted as it has' 'good Min-Valid (bad Until, no Max-Valid)' 'now - 7 days' 'now - 4 days' -o Acquire::Min-ValidTime=1209600
  40. runtest 'Release file is accepted as it has' 'good Min-Valid (bad Until, good Max-Valid) <' 'now - 7 days' 'now - 2 days' -o Acquire::Min-ValidTime=1209600 -o Acquire::Max-ValidTime=2419200
  41. runtest 'Release file is rejected as it has' 'bad Max-Valid (bad Until, good Min-Valid) >' 'now - 7 days' 'now - 2 days' -o Acquire::Max-ValidTime=12096 -o Acquire::Min-ValidTime=2419200
  42. runtest 'Release file is rejected as it has' 'bad Max-Valid (bad Until, bad Min-Valid) <' 'now - 7 days' 'now - 2 days' -o Acquire::Min-ValidTime=12096 -o Acquire::Max-ValidTime=241920
  43. runtest 'Release file is rejected as it has' 'bad Max-Valid (bad Until, bad Min-Valid) >' 'now - 7 days' 'now - 2 days' -o Acquire::Max-ValidTime=12096 -o Acquire::Min-ValidTime=241920