1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38
|
#!/bin/bash
. testsuite/functions.sh
PORT=12352
# Test that it fails with a non existing cache directory
if "$BINNAME" -db site1 -p $PORT --cache "/tmp/fakecachedir" --index nonexisting; then
exit 1
fi
CACHE_DIR=$(mktemp -d)
"$BINNAME" -b site1 -p $PORT --cache $CACHE_DIR --index nonexisting &
WEBORF_PID=$(jobs -p)
function cleanup () {
kill -9 $WEBORF_PID
ls "$CACHE_DIR"
rm -rf "$CACHE_DIR"
rm -f site1/cachedir.test
}
trap cleanup EXIT
curl -s http://localhost:$PORT/
[[ "$(ls $CACHE_DIR | wc -l)" = 1 ]]
curl -s http://localhost:$PORT/ | diff - $CACHE_DIR/*
touch site1/cachedir.test
sleep 1.1
curl -s http://localhost:$PORT/ | grep cachedir.test
rm site1/cachedir.test
sleep 1.1
if curl -s http://localhost:$PORT/ | grep cachedir.test; then
exit 1
fi
[[ "$(ls $CACHE_DIR | wc -l)" = 3 ]]
|