frontend tests: fail if the server minifies files multiple times

caching_middleware: when calculating a cacheKey of an resource, ignore the query string
caching-middleware-duplicate-compress
webzwo0i 2020-11-15 21:09:31 +01:00
parent b760e699c6
commit e35a2b4cb5
2 changed files with 19 additions and 9 deletions

View File

@ -91,7 +91,7 @@ CachingMiddleware.prototype = new function () {
const supportsGzip =
(req.get('Accept-Encoding') || '').indexOf('gzip') != -1;
const path = require('url').parse(req.url).path;
const path = require('url').parse(req.url).pathname;
const cacheKey = generateCacheKey(path);
fs.stat(`${CACHE_DIR}minified_${cacheKey}`, (error, stats) => {

View File

@ -34,12 +34,22 @@ done
log "Successfully connected to Etherpad on http://localhost:9001"
# start the remote runner
try cd "${MY_DIR}"
log "Starting the remote runner..."
node remote_runner.js
exit_code=$?
echo "Now starting the remote runner"
failed=0
node remote_runner.js || failed=1
kill "$(cat /tmp/sauce.pid)"
kill "$ep_pid" && wait "$ep_pid"
log "Done."
exit "$exit_code"
kill $(cat /tmp/sauce.pid)
kill $ep_pid
cd "${MY_DIR}/../../../"
# print the start of every minified file for debugging
find var/ -type f -name "minified_*" -not -name "*.gz" |xargs head -n2
# is any package minified more than once?
find var/ -type f -name "minified_*" |xargs md5sum|cut -d" " -f1|sort|uniq -c|egrep "^\W+1\W" -v
if [ $? -eq 0 ]; then
echo "FAILED: a resource is packaged multiple times"
failed=2
fi
exit $failed