X-Git-Url: https://git.saurik.com/apt.git/blobdiff_plain/e29a7a394cfd41e8bad81535e0a8c07654f34bf6..d2cb5b153fb13d587b1ff632cab34ce0c403326e:/test/integration/test-apt-update-file diff --git a/test/integration/test-apt-update-file b/test/integration/test-apt-update-file index fbcd473cc..94b604f0e 100755 --- a/test/integration/test-apt-update-file +++ b/test/integration/test-apt-update-file @@ -10,27 +10,45 @@ TESTDIR=$(readlink -f $(dirname $0)) setupenvironment configarchitecture "amd64" -configcompression 'bz2' 'gz' +configcompression 'bz2' 'gz' -insertpackage 'unstable' 'foo' 'all' '1.0' +insertpackage 'unstable' 'foo' 'all' '1' +insertsource 'unstable' 'foo' 'all' '1' -umask 022 setupaptarchive --no-update # ensure the archive is not writable +addtrap 'prefix' 'chmod 750 aptarchive/dists/unstable/main/binary-amd64;' chmod 550 aptarchive/dists/unstable/main/binary-amd64 -testsuccess aptget update -qq -testsuccess aptget update -qq -aptget update -qq -o Debug::pkgAcquire::Auth=1 2> output.log +testsuccess aptget update -# ensure that the hash of the uncompressed file was verified even on a local -# ims hit -canary="SHA512:$(bzcat aptarchive/dists/unstable/main/binary-amd64/Packages.bz2 | sha512sum |cut -f1 -d' ')" -grep -q "RecivedHash: $canary" output.log +# the release files aren't an IMS-hit, but the indexes are +redatereleasefiles '+1 hour' -# foo is still available -testsuccess aptget install -s foo +# we don't download the index if it isn't updated +testsuccess aptget update -o Debug::pkgAcquire::Auth=1 +# file:/ isn't shown in the log, so see if it was downloaded anyhow +cp -a rootdir/tmp/testsuccess.output rootdir/tmp/update.output +canary="SHA512:$(bzcat aptarchive/dists/unstable/main/binary-amd64/Packages.bz2 | sha512sum |cut -f1 -d' ')" +testfailure grep -- "$canary" rootdir/tmp/update.output + +testfoo() { + # foo is still available + testsuccess aptget install -s foo + testsuccess aptcache showsrc foo + testsuccess aptget source foo --print-uris +} +testfoo + +# the release file is new again, the index still isn't, but it is somehow gone now from disk +redatereleasefiles '+2 hour' +find rootdir/var/lib/apt/lists -name '*_Packages*' -delete + +testsuccess aptget update -o Debug::pkgAcquire::Auth=1 +# file:/ isn't shown in the log, so see if it was downloaded anyhow +cp -a rootdir/tmp/testsuccess.output rootdir/tmp/update.output +canary="SHA512:$(bzcat aptarchive/dists/unstable/main/binary-amd64/Packages.bz2 | sha512sum |cut -f1 -d' ')" +testsuccess grep -- "$canary" rootdir/tmp/update.output -# the cleanup should still work -chmod 750 aptarchive/dists/unstable/main/binary-amd64 +testfoo