Move the remote_config tests out to a separate test outside the smoke
tests, simplifying debugging httpd with a default configuration by reducing the amount of unexpected requests flying around.
This commit is contained in:
+1
-1
@@ -200,7 +200,7 @@ TESTS=REDIS MEMCACHED STRESS REWRITE LOADTEST PROXY SLURP SHARED_MEM_LOCKS \
|
||||
IPRO_PRESERVE_LOADTEST MEMCACHED_LOADTEST REDIS_LOADTEST \
|
||||
PURGING_LOADTEST SPELING GZIP EXPERIMENT_GA EXPERIMENT_NO_GA HTTPS \
|
||||
ALL_DIRECTIVES PER_VHOST_STATS NO_PER_VHOST_STATS STATS_LOGGING EXTCACHE \
|
||||
PROCESS_SCOPE VALGRIND
|
||||
PROCESS_SCOPE VALGRIND REMOTE_CONFIG
|
||||
|
||||
ifeq ($(REDIS_TEST),1)
|
||||
EXTCACHE_TEST=1
|
||||
|
||||
+24
-36
@@ -51,6 +51,7 @@ apache_vm_system_tests : setup_doc_root
|
||||
$(MAKE) FAST_RESTART=1 apache_debug_speling_test
|
||||
$(MAKE) FAST_RESTART=1 apache_debug_gzip_test
|
||||
$(MAKE) FAST_RESTART=1 apache_debug_process_scope_test
|
||||
$(MAKE) FAST_RESTART=1 apache_debug_remote_config_test
|
||||
$(MAKE) FAST_RESTART=1 apache_debug_experiment_test
|
||||
$(MAKE) FAST_RESTART=1 apache_debug_vhost_only_test
|
||||
$(MAKE) FAST_RESTART=1 apache_debug_global_off_test
|
||||
@@ -98,6 +99,7 @@ EXAMPLE_COMBINE_CSS = $(EXAMPLE)/combine_css.html
|
||||
TEST_ROOT = $(APACHE_SERVER)/mod_pagespeed_test
|
||||
|
||||
APACHE_SYSTEM_TEST = $(PAGESPEED_DIR)/apache/system_test.sh
|
||||
APACHE_REMOTE_CONFIG_TEST = $(PAGESPEED_DIR)/system/remote_config_test.sh
|
||||
|
||||
# Installs debug configuration and runs a smoke test against it.
|
||||
# This will blow away your existing pagespeed.conf,
|
||||
@@ -109,13 +111,6 @@ apache_debug_smoke_test : apache_install_conf apache_debug_restart
|
||||
rm -rf $(MOD_PAGESPEED_CACHE)/*
|
||||
$(MAKE) start
|
||||
CACHE_FLUSH_TEST=on \
|
||||
RCPORT1=$(RCPORT1) \
|
||||
RCPORT2=$(RCPORT2) \
|
||||
RCPORT3=$(RCPORT3) \
|
||||
RCPORT4=$(RCPORT4) \
|
||||
RCPORT5=$(RCPORT5) \
|
||||
RCPORT6=$(RCPORT6) \
|
||||
RCPORT7=$(RCPORT7) \
|
||||
APACHE_SECONDARY_PORT=$(APACHE_SECONDARY_PORT) \
|
||||
APACHE_TERTIARY_PORT=$(APACHE_TERTIARY_PORT) \
|
||||
APACHE_DOC_ROOT=$(APACHE_DOC_ROOT) \
|
||||
@@ -124,13 +119,6 @@ apache_debug_smoke_test : apache_install_conf apache_debug_restart
|
||||
#
|
||||
@echo '***' System-test with warm cache
|
||||
CACHE_FLUSH_TEST=on \
|
||||
RCPORT1=$(RCPORT1) \
|
||||
RCPORT2=$(RCPORT2) \
|
||||
RCPORT3=$(RCPORT3) \
|
||||
RCPORT4=$(RCPORT4) \
|
||||
RCPORT5=$(RCPORT5) \
|
||||
RCPORT6=$(RCPORT6) \
|
||||
RCPORT7=$(RCPORT7) \
|
||||
APACHE_SECONDARY_PORT=$(APACHE_SECONDARY_PORT) \
|
||||
APACHE_TERTIARY_PORT=$(APACHE_TERTIARY_PORT) \
|
||||
APACHE_DOC_ROOT=$(APACHE_DOC_ROOT) \
|
||||
@@ -144,13 +132,6 @@ apache_debug_smoke_test : apache_install_conf apache_debug_restart
|
||||
grep ModPagespeedInheritVHostConfig $(APACHE_DEBUG_PAGESPEED_CONF)
|
||||
$(MAKE) stop
|
||||
$(MAKE) start
|
||||
RCPORT1=$(RCPORT1) \
|
||||
RCPORT2=$(RCPORT2) \
|
||||
RCPORT3=$(RCPORT3) \
|
||||
RCPORT4=$(RCPORT4) \
|
||||
RCPORT5=$(RCPORT5) \
|
||||
RCPORT6=$(RCPORT6) \
|
||||
RCPORT7=$(RCPORT7) \
|
||||
APACHE_SECONDARY_PORT=$(APACHE_SECONDARY_PORT) \
|
||||
APACHE_TERTIARY_PORT=$(APACHE_TERTIARY_PORT) \
|
||||
APACHE_DOC_ROOT=$(APACHE_DOC_ROOT) \
|
||||
@@ -168,6 +149,25 @@ apache_debug_smoke_test : apache_install_conf apache_debug_restart
|
||||
$(MAKE) start
|
||||
CACHE_FLUSH_TEST=on \
|
||||
NO_VHOST_MERGE=on \
|
||||
APACHE_SECONDARY_PORT=$(APACHE_SECONDARY_PORT) \
|
||||
APACHE_TERTIARY_PORT=$(APACHE_TERTIARY_PORT) \
|
||||
APACHE_DOC_ROOT=$(APACHE_DOC_ROOT) \
|
||||
$(APACHE_SYSTEM_TEST) $(APACHE_SERVER) $(APACHE_HTTPS_SERVER)
|
||||
#
|
||||
# Restore config
|
||||
mv $(APACHE_DEBUG_PAGESPEED_CONF).save $(APACHE_DEBUG_PAGESPEED_CONF)
|
||||
$(MAKE) apache_debug_stop
|
||||
[ -z "`grep leaked_rewrite_drivers $(APACHE_LOG)`" ]
|
||||
@echo PASS
|
||||
|
||||
apache_debug_remote_config_test :
|
||||
@echo '***' Remote-config test
|
||||
$(MAKE) stop
|
||||
rm -rf $(MOD_PAGESPEED_CACHE)/*
|
||||
mv $(APACHE_DEBUG_PAGESPEED_CONF) $(APACHE_DEBUG_PAGESPEED_CONF).save
|
||||
$(MAKE) apache_install_conf OPTIONS="$(OPTIONS) REMOTE_CONFIG_TEST=1"
|
||||
$(MAKE) start
|
||||
CACHE_FLUSH_TEST=on \
|
||||
RCPORT1=$(RCPORT1) \
|
||||
RCPORT2=$(RCPORT2) \
|
||||
RCPORT3=$(RCPORT3) \
|
||||
@@ -175,10 +175,12 @@ apache_debug_smoke_test : apache_install_conf apache_debug_restart
|
||||
RCPORT5=$(RCPORT5) \
|
||||
RCPORT6=$(RCPORT6) \
|
||||
RCPORT7=$(RCPORT7) \
|
||||
SECONDARY_HOSTNAME=localhost:$(APACHE_SECONDARY_PORT) \
|
||||
APACHE_SECONDARY_PORT=$(APACHE_SECONDARY_PORT) \
|
||||
APACHE_TERTIARY_PORT=$(APACHE_TERTIARY_PORT) \
|
||||
APACHE_DOC_ROOT=$(APACHE_DOC_ROOT) \
|
||||
$(APACHE_SYSTEM_TEST) $(APACHE_SERVER) $(APACHE_HTTPS_SERVER)
|
||||
FIRST_RUN=true SERVER_NAME=apache \
|
||||
$(APACHE_REMOTE_CONFIG_TEST) $(APACHE_SERVER) $(APACHE_HTTPS_SERVER)
|
||||
#
|
||||
# Restore config
|
||||
mv $(APACHE_DEBUG_PAGESPEED_CONF).save $(APACHE_DEBUG_PAGESPEED_CONF)
|
||||
@@ -252,13 +254,6 @@ apache_debug_memcached_test_run :
|
||||
$(MAKE) apache_debug_restart
|
||||
$(APACHE_SYSTEM_TEST) $(APACHE_SERVER) $(APACHE_HTTPS_SERVER)
|
||||
CACHE_FLUSH_TEST=on \
|
||||
RCPORT1=$(RCPORT1) \
|
||||
RCPORT2=$(RCPORT2) \
|
||||
RCPORT3=$(RCPORT3) \
|
||||
RCPORT4=$(RCPORT4) \
|
||||
RCPORT5=$(RCPORT5) \
|
||||
RCPORT6=$(RCPORT6) \
|
||||
RCPORT7=$(RCPORT7) \
|
||||
APACHE_SECONDARY_PORT=$(APACHE_SECONDARY_PORT) \
|
||||
APACHE_TERTIARY_PORT=$(APACHE_TERTIARY_PORT) \
|
||||
$(APACHE_SYSTEM_TEST) $(APACHE_SERVER) $(APACHE_HTTPS_SERVER)
|
||||
@@ -282,13 +277,6 @@ apache_debug_redis_test_run :
|
||||
$(MAKE) apache_debug_restart
|
||||
$(APACHE_SYSTEM_TEST) $(APACHE_SERVER) $(APACHE_HTTPS_SERVER)
|
||||
CACHE_FLUSH_TEST=on \
|
||||
RCPORT1=$(RCPORT1) \
|
||||
RCPORT2=$(RCPORT2) \
|
||||
RCPORT3=$(RCPORT3) \
|
||||
RCPORT4=$(RCPORT4) \
|
||||
RCPORT5=$(RCPORT5) \
|
||||
RCPORT6=$(RCPORT6) \
|
||||
RCPORT7=$(RCPORT7) \
|
||||
APACHE_SECONDARY_PORT=$(APACHE_SECONDARY_PORT) \
|
||||
APACHE_TERTIARY_PORT=$(APACHE_TERTIARY_PORT) \
|
||||
$(APACHE_SYSTEM_TEST) $(APACHE_SERVER) $(APACHE_HTTPS_SERVER)
|
||||
|
||||
+62
-62
@@ -846,68 +846,68 @@ NameVirtualHost localhost:@@APACHE_SECONDARY_PORT@@
|
||||
ModPagespeedDisableFilters remove_comments,add_instrumentation
|
||||
</VirtualHost>
|
||||
|
||||
<VirtualHost localhost:@@APACHE_SECONDARY_PORT@@>
|
||||
ServerName remote-config.example.com
|
||||
DocumentRoot "@@APACHE_DOC_ROOT@@"
|
||||
ModPagespeedFileCachePath "@@MOD_PAGESPEED_CACHE@@"
|
||||
ModPagespeedRemoteConfigurationUrl "http://127.0.0.1:@@RCPORT1@@/remote.cfg"
|
||||
ModPagespeedRemoteConfigurationTimeoutMs 1500
|
||||
</VirtualHost>
|
||||
|
||||
<VirtualHost localhost:@@APACHE_SECONDARY_PORT@@>
|
||||
ServerName remote-config-partially-invalid.example.com
|
||||
DocumentRoot "@@APACHE_DOC_ROOT@@"
|
||||
ModPagespeedFileCachePath "@@MOD_PAGESPEED_CACHE@@"
|
||||
ModPagespeedRemoteConfigurationUrl "http://127.0.0.1:@@RCPORT2@@/remote.cfg"
|
||||
ModPagespeedRemoteConfigurationTimeoutMs 1500
|
||||
</VirtualHost>
|
||||
|
||||
<VirtualHost localhost:@@APACHE_SECONDARY_PORT@@>
|
||||
ServerName remote-config-invalid.example.com
|
||||
DocumentRoot "@@APACHE_DOC_ROOT@@"
|
||||
ModPagespeedFileCachePath "@@MOD_PAGESPEED_CACHE@@"
|
||||
ModPagespeedRemoteConfigurationUrl "http://127.0.0.1:@@RCPORT3@@/remote.cfg"
|
||||
ModPagespeedRemoteConfigurationTimeoutMs 1500
|
||||
</VirtualHost>
|
||||
|
||||
<VirtualHost localhost:@@APACHE_SECONDARY_PORT@@>
|
||||
ServerName remote-config-out-of-scope.example.com
|
||||
DocumentRoot "@@APACHE_DOC_ROOT@@"
|
||||
ModPagespeedFileCachePath "@@MOD_PAGESPEED_CACHE@@"
|
||||
ModPagespeedRemoteConfigurationUrl "http://127.0.0.1:@@RCPORT4@@/remote.cfg"
|
||||
ModPagespeedRemoteConfigurationTimeoutMs 1500
|
||||
</VirtualHost>
|
||||
|
||||
<VirtualHost localhost:@@APACHE_SECONDARY_PORT@@>
|
||||
ServerName remote-config-failed-fetch.example.com
|
||||
DocumentRoot "@@APACHE_DOC_ROOT@@"
|
||||
ModPagespeedFileCachePath "@@MOD_PAGESPEED_CACHE@@"
|
||||
ModPagespeedRemoteConfigurationUrl "http://127.0.0.1:@@RCPORT5@@/remote.cfg"
|
||||
ModPagespeedRemoteConfigurationTimeoutMs 1500
|
||||
</VirtualHost>
|
||||
|
||||
<VirtualHost localhost:@@APACHE_SECONDARY_PORT@@>
|
||||
ServerName remote-config-slow-fetch.example.com
|
||||
DocumentRoot "@@APACHE_DOC_ROOT@@"
|
||||
ModPagespeedFileCachePath "@@MOD_PAGESPEED_CACHE@@"
|
||||
ModPagespeedRemoteConfigurationUrl "http://127.0.0.1:@@RCPORT6@@/remote.cfg"
|
||||
ModPagespeedRemoteConfigurationTimeoutMs 1500
|
||||
</VirtualHost>
|
||||
|
||||
<VirtualHost localhost:@@APACHE_SECONDARY_PORT@@>
|
||||
ServerName remote-config-with-htaccess.example.com
|
||||
DocumentRoot "@@APACHE_DOC_ROOT@@"
|
||||
ModPagespeedFileCachePath "@@MOD_PAGESPEED_CACHE@@"
|
||||
ModPagespeedRemoteConfigurationTimeoutMs 1500
|
||||
</VirtualHost>
|
||||
|
||||
<VirtualHost localhost:@@APACHE_SECONDARY_PORT@@>
|
||||
ServerName remote-config-experiment.example.com
|
||||
DocumentRoot "@@APACHE_DOC_ROOT@@"
|
||||
ModPagespeedFileCachePath "@@MOD_PAGESPEED_CACHE@@"
|
||||
ModPagespeedRemoteConfigurationUrl "http://127.0.0.1:@@RCPORT7@@/remote.cfg"
|
||||
ModPagespeedRemoteConfigurationTimeoutMs 1500
|
||||
</VirtualHost>
|
||||
#REMOTE_CONFIG <VirtualHost localhost:@@APACHE_SECONDARY_PORT@@>
|
||||
#REMOTE_CONFIG ServerName remote-config.example.com
|
||||
#REMOTE_CONFIG DocumentRoot "@@APACHE_DOC_ROOT@@"
|
||||
#REMOTE_CONFIG ModPagespeedFileCachePath "@@MOD_PAGESPEED_CACHE@@"
|
||||
#REMOTE_CONFIG ModPagespeedRemoteConfigurationUrl "http://127.0.0.1:@@RCPORT1@@/remote.cfg"
|
||||
#REMOTE_CONFIG ModPagespeedRemoteConfigurationTimeoutMs 1500
|
||||
#REMOTE_CONFIG </VirtualHost>
|
||||
#REMOTE_CONFIG
|
||||
#REMOTE_CONFIG <VirtualHost localhost:@@APACHE_SECONDARY_PORT@@>
|
||||
#REMOTE_CONFIG ServerName remote-config-partially-invalid.example.com
|
||||
#REMOTE_CONFIG DocumentRoot "@@APACHE_DOC_ROOT@@"
|
||||
#REMOTE_CONFIG ModPagespeedFileCachePath "@@MOD_PAGESPEED_CACHE@@"
|
||||
#REMOTE_CONFIG ModPagespeedRemoteConfigurationUrl "http://127.0.0.1:@@RCPORT2@@/remote.cfg"
|
||||
#REMOTE_CONFIG ModPagespeedRemoteConfigurationTimeoutMs 1500
|
||||
#REMOTE_CONFIG </VirtualHost>
|
||||
#REMOTE_CONFIG
|
||||
#REMOTE_CONFIG <VirtualHost localhost:@@APACHE_SECONDARY_PORT@@>
|
||||
#REMOTE_CONFIG ServerName remote-config-invalid.example.com
|
||||
#REMOTE_CONFIG DocumentRoot "@@APACHE_DOC_ROOT@@"
|
||||
#REMOTE_CONFIG ModPagespeedFileCachePath "@@MOD_PAGESPEED_CACHE@@"
|
||||
#REMOTE_CONFIG ModPagespeedRemoteConfigurationUrl "http://127.0.0.1:@@RCPORT3@@/remote.cfg"
|
||||
#REMOTE_CONFIG ModPagespeedRemoteConfigurationTimeoutMs 1500
|
||||
#REMOTE_CONFIG </VirtualHost>
|
||||
#REMOTE_CONFIG
|
||||
#REMOTE_CONFIG <VirtualHost localhost:@@APACHE_SECONDARY_PORT@@>
|
||||
#REMOTE_CONFIG ServerName remote-config-out-of-scope.example.com
|
||||
#REMOTE_CONFIG DocumentRoot "@@APACHE_DOC_ROOT@@"
|
||||
#REMOTE_CONFIG ModPagespeedFileCachePath "@@MOD_PAGESPEED_CACHE@@"
|
||||
#REMOTE_CONFIG ModPagespeedRemoteConfigurationUrl "http://127.0.0.1:@@RCPORT4@@/remote.cfg"
|
||||
#REMOTE_CONFIG ModPagespeedRemoteConfigurationTimeoutMs 1500
|
||||
#REMOTE_CONFIG </VirtualHost>
|
||||
#REMOTE_CONFIG
|
||||
#REMOTE_CONFIG <VirtualHost localhost:@@APACHE_SECONDARY_PORT@@>
|
||||
#REMOTE_CONFIG ServerName remote-config-failed-fetch.example.com
|
||||
#REMOTE_CONFIG DocumentRoot "@@APACHE_DOC_ROOT@@"
|
||||
#REMOTE_CONFIG ModPagespeedFileCachePath "@@MOD_PAGESPEED_CACHE@@"
|
||||
#REMOTE_CONFIG ModPagespeedRemoteConfigurationUrl "http://127.0.0.1:@@RCPORT5@@/remote.cfg"
|
||||
#REMOTE_CONFIG ModPagespeedRemoteConfigurationTimeoutMs 1500
|
||||
#REMOTE_CONFIG </VirtualHost>
|
||||
#REMOTE_CONFIG
|
||||
#REMOTE_CONFIG <VirtualHost localhost:@@APACHE_SECONDARY_PORT@@>
|
||||
#REMOTE_CONFIG ServerName remote-config-slow-fetch.example.com
|
||||
#REMOTE_CONFIG DocumentRoot "@@APACHE_DOC_ROOT@@"
|
||||
#REMOTE_CONFIG ModPagespeedFileCachePath "@@MOD_PAGESPEED_CACHE@@"
|
||||
#REMOTE_CONFIG ModPagespeedRemoteConfigurationUrl "http://127.0.0.1:@@RCPORT6@@/remote.cfg"
|
||||
#REMOTE_CONFIG ModPagespeedRemoteConfigurationTimeoutMs 1500
|
||||
#REMOTE_CONFIG </VirtualHost>
|
||||
#REMOTE_CONFIG
|
||||
#REMOTE_CONFIG <VirtualHost localhost:@@APACHE_SECONDARY_PORT@@>
|
||||
#REMOTE_CONFIG ServerName remote-config-with-htaccess.example.com
|
||||
#REMOTE_CONFIG DocumentRoot "@@APACHE_DOC_ROOT@@"
|
||||
#REMOTE_CONFIG ModPagespeedFileCachePath "@@MOD_PAGESPEED_CACHE@@"
|
||||
#REMOTE_CONFIG ModPagespeedRemoteConfigurationTimeoutMs 1500
|
||||
#REMOTE_CONFIG </VirtualHost>
|
||||
#REMOTE_CONFIG
|
||||
#REMOTE_CONFIG <VirtualHost localhost:@@APACHE_SECONDARY_PORT@@>
|
||||
#REMOTE_CONFIG ServerName remote-config-experiment.example.com
|
||||
#REMOTE_CONFIG DocumentRoot "@@APACHE_DOC_ROOT@@"
|
||||
#REMOTE_CONFIG ModPagespeedFileCachePath "@@MOD_PAGESPEED_CACHE@@"
|
||||
#REMOTE_CONFIG ModPagespeedRemoteConfigurationUrl "http://127.0.0.1:@@RCPORT7@@/remote.cfg"
|
||||
#REMOTE_CONFIG ModPagespeedRemoteConfigurationTimeoutMs 1500
|
||||
#REMOTE_CONFIG </VirtualHost>
|
||||
|
||||
<VirtualHost localhost:@@APACHE_SECONDARY_PORT@@>
|
||||
ServerName uses-sendfile.example.com
|
||||
|
||||
@@ -962,63 +962,6 @@ for admin_path in pagespeed_admin pagespeed_global_admin alt/admin/path; do
|
||||
done
|
||||
|
||||
|
||||
start_test remote config will not apply server scoped options.
|
||||
if ! [ -z ${RCPORT4+x} ] && [ $RCPORT4 -eq "9994" ]; then
|
||||
# These tests can only be done if the port is known ahead of time.
|
||||
# Check that server scoped options are ignored, but directory scoped options
|
||||
# are applied.
|
||||
if [ "$SECONDARY_HOSTNAME" != "" ]; then
|
||||
URL="$(generate_url remote-config-out-of-scope.example.com \
|
||||
/mod_pagespeed_test/forbidden.html)"
|
||||
while true; do
|
||||
echo -e "HTTP/1.1 200 OK\nCache-Control: max-age=5\n\nUrlSigningKey secretkey\nRequestOptionOverride secretkey\nEndRemoteConfig\n" | nc -l -p $RCPORT4 -q 1
|
||||
done&
|
||||
LOOPPID=$!
|
||||
echo wget $URL $SECONDARY_HOSTNAME $WGET_DUMP
|
||||
OUT=$(http_proxy=$SECONDARY_HOSTNAME $WGET_DUMP --save-headers $URL)
|
||||
if [ -s $APACHE_LOG ]; then
|
||||
check_from "$(cat $APACHE_LOG)" grep "Setting option UrlSigningKey with value secretkey failed"
|
||||
check_not_from "$(cat $APACHE_LOG)" grep "Setting option RequestOptionOverride with value secretkey failed"
|
||||
fi
|
||||
kill $LOOPPID
|
||||
kill_port $RCPORT4
|
||||
|
||||
HTA=$APACHE_DOC_ROOT/mod_pagespeed_test/remote_config/withhtaccess/.htaccess
|
||||
start_test htaccess references a remote configuration file.
|
||||
# First, check that the remote configuration is applied via .htaccess files.
|
||||
# PORT isn't known until the test is run, so we must extract it from the
|
||||
# $SECONDARY_HOSTNAME variable.
|
||||
PORT=$(echo $SECONDARY_HOSTNAME | cut -d \: -f 2)
|
||||
HOST="http://localhost"
|
||||
RCPATH="/mod_pagespeed_test/remote_config/remote.cfg"
|
||||
echo "ModPagespeedRemoteConfigurationUrl \"$HOST:$PORT$RCPATH\"" > $HTA
|
||||
URL="$(generate_url remote-config-with-htaccess.example.com \
|
||||
/mod_pagespeed_test/remote_config/withhtaccess/remotecfgtest.html)"
|
||||
echo wget $URL
|
||||
http_proxy=$SECONDARY_HOSTNAME fetch_until -save "$URL" \
|
||||
'fgrep -c <!--' 0
|
||||
|
||||
start_test htaccess is overridded by remote configuration file.
|
||||
RCPATH="/mod_pagespeed_test/remote_config/remote.cfg.enable_comments"
|
||||
PORT=$(echo $SECONDARY_HOSTNAME | cut -d \: -f 2)
|
||||
echo "ModPagespeedEnableFilters remove_comments,collapse_whitespace" > \
|
||||
$APACHE_DOC_ROOT/mod_pagespeed_test/remote_config/withhtaccess/.htaccess
|
||||
URL="$(generate_url remote-config-with-htaccess.example.com \
|
||||
/mod_pagespeed_test/remote_config/withhtaccess/remotecfgtest.html)"
|
||||
echo wget $URL
|
||||
http_proxy=$SECONDARY_HOSTNAME fetch_until -save "$URL" \
|
||||
'fgrep -c <!--' 0
|
||||
echo "ModPagespeedEnableFilters remove_comments,collapse_whitespace" > $HTA
|
||||
echo "ModPagespeedRemoteConfigurationUrl \"$HOST:$PORT$RCPATH\"" >> $HTA
|
||||
URL="$(generate_url remote-config-with-htaccess.example.com \
|
||||
/mod_pagespeed_test/remote_config/withhtaccess/remotecfgtest.html)"
|
||||
echo wget $URL
|
||||
http_proxy=$SECONDARY_HOSTNAME fetch_until -save "$URL" \
|
||||
'fgrep -c <!--' 2
|
||||
rm -f $HTA
|
||||
fi
|
||||
fi
|
||||
|
||||
start_test Fetch gzipped, make sure that we have cache compressed at gzip 9.
|
||||
URL="$PRIMARY_SERVER/mod_pagespeed_test/invalid.css"
|
||||
fetch_until -gzip $URL "wc -c" 27
|
||||
|
||||
@@ -131,6 +131,7 @@ TESTTMP="$TEMPDIR"
|
||||
ORIGINAL_TEMPDIR="$TEMPDIR"
|
||||
unset TEMPDIR
|
||||
|
||||
HELPERS_LOADED=1
|
||||
HOSTNAME=$1
|
||||
PRIMARY_SERVER=http://$HOSTNAME
|
||||
EXAMPLE_ROOT=$PRIMARY_SERVER/mod_pagespeed_example
|
||||
@@ -826,7 +827,7 @@ function generate_url {
|
||||
function kill_port {
|
||||
PORT="$1"
|
||||
PID="$(lsof -i:$PORT -t -s TCP:LISTEN)" || true
|
||||
if [ $PID != "" ]; then
|
||||
if [ "$PID" != "" ]; then
|
||||
kill -9 $PID
|
||||
fi
|
||||
}
|
||||
@@ -837,7 +838,10 @@ function kill_port {
|
||||
function kill_listener_port {
|
||||
CMDLINE="$1"
|
||||
PORT="$2"
|
||||
kill -9 $(lsof -t -i TCP:${PORT} -s TCP:LISTEN -a -c "/^${CMDLINE}$/") || true
|
||||
PIDS="$(lsof -t -i TCP:${PORT} -s TCP:LISTEN -a -c "/^${CMDLINE}$/")" || true
|
||||
if [ "$PIDS" != "" ]; then
|
||||
kill -9 $PIDS
|
||||
fi
|
||||
}
|
||||
|
||||
# Performs timed reads on the output from a command passed via $1. The stream
|
||||
|
||||
@@ -0,0 +1,203 @@
|
||||
#!/bin/bash
|
||||
#
|
||||
# Run the remote config tests.
|
||||
#
|
||||
# We need to know the directory this file is located in. Unfortunately,
|
||||
# if we're 'source'd from a script in a different directory $(dirname $0) gives
|
||||
# us the directory that *that* script is located in
|
||||
this_dir=$(dirname "${BASH_SOURCE[0]}")
|
||||
|
||||
# This script is invoked in two ways:
|
||||
# 1. run from apache_debug_remote_config_test.
|
||||
# 2. sourced from nginx_system_test.sh, after sourcing system/system_test.sh.
|
||||
# In the latter case, system_test_helpers.sh is already loaded, and it doesn't
|
||||
# work to load it twice.
|
||||
if [ "${HELPERS_LOADED:-0}" != 1 ]; then
|
||||
source "$this_dir/../automatic/system_test_helpers.sh" || exit 1
|
||||
fi
|
||||
|
||||
start_test remote config will not apply server scoped options.
|
||||
if ! [ -z ${RCPORT4+x} ] && [ $RCPORT4 -eq "9994" ] && \
|
||||
[ $SERVER_NAME = "apache"] ; then
|
||||
# These tests can only be done if the port is known ahead of time.
|
||||
# Check that server scoped options are ignored, but directory scoped options
|
||||
# are applied.
|
||||
if [ "$SECONDARY_HOSTNAME" != "" ]; then
|
||||
URL="$(generate_url remote-config-out-of-scope.example.com \
|
||||
/mod_pagespeed_test/forbidden.html)"
|
||||
while true; do
|
||||
echo -e "HTTP/1.1 200 OK\nCache-Control: max-age=5\n\nUrlSigningKey secretkey\nRequestOptionOverride secretkey\nEndRemoteConfig\n" | nc -l -p $RCPORT4 -q 1
|
||||
done&
|
||||
LOOPPID=$!
|
||||
echo wget $URL $SECONDARY_HOSTNAME $WGET_DUMP
|
||||
OUT=$(http_proxy=$SECONDARY_HOSTNAME $WGET_DUMP --save-headers $URL)
|
||||
if [ -s $APACHE_LOG ]; then
|
||||
check_from "$(cat $APACHE_LOG)" grep "Setting option UrlSigningKey with value secretkey failed"
|
||||
check_not_from "$(cat $APACHE_LOG)" grep "Setting option RequestOptionOverride with value secretkey failed"
|
||||
fi
|
||||
kill $LOOPPID
|
||||
kill_port $RCPORT4
|
||||
|
||||
HTA=$APACHE_DOC_ROOT/mod_pagespeed_test/remote_config/withhtaccess/.htaccess
|
||||
start_test htaccess references a remote configuration file.
|
||||
# First, check that the remote configuration is applied via .htaccess files.
|
||||
# PORT isn't known until the test is run, so we must extract it from the
|
||||
# $SECONDARY_HOSTNAME variable.
|
||||
PORT=$(echo $SECONDARY_HOSTNAME | cut -d \: -f 2)
|
||||
HOST="http://localhost"
|
||||
RCPATH="/mod_pagespeed_test/remote_config/remote.cfg"
|
||||
echo "ModPagespeedRemoteConfigurationUrl \"$HOST:$PORT$RCPATH\"" > $HTA
|
||||
URL="$(generate_url remote-config-with-htaccess.example.com \
|
||||
/mod_pagespeed_test/remote_config/withhtaccess/remotecfgtest.html)"
|
||||
echo wget $URL
|
||||
http_proxy=$SECONDARY_HOSTNAME fetch_until -save "$URL" \
|
||||
'fgrep -c <!--' 0
|
||||
|
||||
start_test htaccess is overridded by remote configuration file.
|
||||
RCPATH="/mod_pagespeed_test/remote_config/remote.cfg.enable_comments"
|
||||
PORT=$(echo $SECONDARY_HOSTNAME | cut -d \: -f 2)
|
||||
echo "ModPagespeedEnableFilters remove_comments,collapse_whitespace" > \
|
||||
$APACHE_DOC_ROOT/mod_pagespeed_test/remote_config/withhtaccess/.htaccess
|
||||
URL="$(generate_url remote-config-with-htaccess.example.com \
|
||||
/mod_pagespeed_test/remote_config/withhtaccess/remotecfgtest.html)"
|
||||
echo wget $URL
|
||||
http_proxy=$SECONDARY_HOSTNAME fetch_until -save "$URL" \
|
||||
'fgrep -c <!--' 0
|
||||
echo "ModPagespeedEnableFilters remove_comments,collapse_whitespace" > $HTA
|
||||
echo "ModPagespeedRemoteConfigurationUrl \"$HOST:$PORT$RCPATH\"" >> $HTA
|
||||
URL="$(generate_url remote-config-with-htaccess.example.com \
|
||||
/mod_pagespeed_test/remote_config/withhtaccess/remotecfgtest.html)"
|
||||
echo wget $URL
|
||||
http_proxy=$SECONDARY_HOSTNAME fetch_until -save "$URL" \
|
||||
'fgrep -c <!--' 2
|
||||
rm -f $HTA
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ "$SECONDARY_HOSTNAME" != "" ]; then
|
||||
# Tests for remote configuration files.
|
||||
# The remote configuration location is stored in the debug.conf.template.
|
||||
start_test Remote Configuration On: by default comments and whitespace removed
|
||||
URL="$(generate_url remote-config.example.com \
|
||||
/mod_pagespeed_test/forbidden.html)"
|
||||
kill_listener_port nc $RCPORT1
|
||||
while true; do
|
||||
echo -e "HTTP/1.1 200 OK\nCache-Control: max-age=5\n\nEnableFilters remove_comments,collapse_whitespace\nEndRemoteConfig\n" | nc -l -p $RCPORT1 -q 1
|
||||
done &
|
||||
LOOPPID=$!
|
||||
echo wget $URL
|
||||
http_proxy=$SECONDARY_HOSTNAME fetch_until -save "$URL" \
|
||||
'fgrep -c <!--' 0
|
||||
kill $LOOPPID
|
||||
kill_listener_port nc $RCPORT1
|
||||
|
||||
start_test Remote Configuration On: File missing end token.
|
||||
URL="$(generate_url remote-config-invalid.example.com \
|
||||
/mod_pagespeed_test/forbidden.html)"
|
||||
kill_listener_port nc $RCPORT3
|
||||
while true; do
|
||||
echo -e "HTTP/1.1 200 OK\nCache-Control: max-age=5\n\nEnableFilters remove_comments,collapse_whitespace\n" | nc -l -p $RCPORT3 -q 1
|
||||
done &
|
||||
LOOPPID=$!
|
||||
echo wget $URL
|
||||
# Fetch a few times to be satisfied that the configuration should be fetched.
|
||||
OUT=$(http_proxy=$SECONDARY_HOSTNAME $WGET_DUMP --save-headers $URL)
|
||||
check_from "$OUT" grep "<!--"
|
||||
OUT=$(http_proxy=$SECONDARY_HOSTNAME $WGET_DUMP --save-headers $URL)
|
||||
check_from "$OUT" grep "<!--"
|
||||
OUT=$(http_proxy=$SECONDARY_HOSTNAME $WGET_DUMP --save-headers $URL)
|
||||
check_from "$OUT" grep "<!--"
|
||||
kill $LOOPPID
|
||||
kill_listener_port nc $RCPORT3
|
||||
|
||||
start_test Remote Configuration On: Some invalid options.
|
||||
URL="$(generate_url remote-config-partially-invalid.example.com \
|
||||
/mod_pagespeed_test/forbidden.html)"
|
||||
kill_listener_port nc $RCPORT2
|
||||
while true; do
|
||||
echo -e "HTTP/1.1 200 OK\nCache-Control: max-age=5\n\nEnableFilters remove_comments,collapse_whitespace\nEndRemoteConfig\n" | nc -l -p $RCPORT2 -q 1
|
||||
done&
|
||||
LOOPPID=$!
|
||||
# Some options are invalid, check that they are skipped and the rest of the
|
||||
# options get applied.
|
||||
echo wget $URL
|
||||
http_proxy=$SECONDARY_HOSTNAME fetch_until -save "$URL" \
|
||||
'fgrep -c <!--' 0
|
||||
kill $LOOPPID
|
||||
kill_listener_port nc $RCPORT2
|
||||
|
||||
start_test Remote Configuration On: overridden by query parameter.
|
||||
URL="$(generate_url remote-config.example.com \
|
||||
/mod_pagespeed_test/forbidden.html)"
|
||||
kill_listener_port nc $RCPORT1
|
||||
while true; do
|
||||
echo -e "HTTP/1.1 200 OK\nCache-Control: max-age=5\n\nEnableFilters remove_comments,collapse_whitespace\nEndRemoteConfig\n" | nc -l -p $RCPORT1 -q 1
|
||||
done &
|
||||
LOOPPID=$!
|
||||
# First check to see that the remote config is applied.
|
||||
echo wget $URL
|
||||
http_proxy=$SECONDARY_HOSTNAME fetch_until -save "$URL" \
|
||||
'fgrep -c <!--' 0
|
||||
# And now check to see that the query parameters override the remote config.
|
||||
URL="$(generate_url remote-config.example.com \
|
||||
/mod_pagespeed_test/forbidden.html?PageSpeedFilters=-remove_comments)"
|
||||
echo wget $URL
|
||||
http_proxy=$SECONDARY_HOSTNAME fetch_until -save "$URL" \
|
||||
'fgrep -c <!--' 2
|
||||
kill $LOOPPID
|
||||
NCPID="$(lsof -i:$RCPORT1 -t)" || true
|
||||
kill_listener_port nc $RCPORT1
|
||||
|
||||
start_test second remote config fetch fails, cached value still applies.
|
||||
kill_listener_port nc $RCPORT5
|
||||
while true; do
|
||||
echo -e "HTTP/1.1 200 OK\nCache-Control: max-age=1\n\nEnableFilters remove_comments,collapse_whitespace\nEndRemoteConfig\n" | nc -l -p $RCPORT5 -q 1
|
||||
done &
|
||||
LOOPPID=$!
|
||||
URL="$(generate_url remote-config-failed-fetch.example.com \
|
||||
/mod_pagespeed_test/forbidden.html)"
|
||||
http_proxy=$SECONDARY_HOSTNAME fetch_until -save "$URL" \
|
||||
'fgrep -c <!--' 0
|
||||
http_proxy=$SECONDARY_HOSTNAME fetch_until -save "$URL" \
|
||||
'fgrep -c <!--' 0
|
||||
echo "Sleeping so that cache will expire"
|
||||
sleep 2
|
||||
http_proxy=$SECONDARY_HOSTNAME fetch_until -save "$URL" \
|
||||
'fgrep -c <!--' 0
|
||||
kill $LOOPPID
|
||||
kill_listener_port nc $RCPORT5
|
||||
|
||||
start_test config takes too long to fetch, is not applied.
|
||||
URL="$(generate_url remote-config-slow-fetch.example.com \
|
||||
/mod_pagespeed_test/forbidden.html)"
|
||||
kill_listener_port nc $RCPORT6
|
||||
while true; do
|
||||
sleep 4; echo -e "HTTP/1.1 200 OK\nCache-Control: max-age=2\n\nEnableFilters remove_comments,collapse_whitespace\nEndRemoteConfig\n" | nc -l -p $RCPORT6 -q 4
|
||||
done &
|
||||
LOOPPID=$!
|
||||
# Fetch a few times to be satisfied that the configuration should have been
|
||||
# fetched.
|
||||
OUT=$(http_proxy=$SECONDARY_HOSTNAME $WGET_DUMP --save-headers $URL)
|
||||
check_from "$OUT" grep "<!--"
|
||||
OUT=$(http_proxy=$SECONDARY_HOSTNAME $WGET_DUMP --save-headers $URL)
|
||||
check_from "$OUT" grep "<!--"
|
||||
kill $LOOPPID
|
||||
kill_listener_port nc $RCPORT6
|
||||
|
||||
start_test Remote Configuration specify an experiment.
|
||||
URL="$(generate_url remote-config-experiment.example.com \
|
||||
/mod_pagespeed_test/forbidden.html)"
|
||||
kill_listener_port nc $RCPORT7
|
||||
while true; do
|
||||
echo -e "HTTP/1.1 200 OK\nCache-Control: max-age=5\n\nRunExperiment on\nAnalyticsID UA-MyExperimentID-1\nUseAnalyticsJs false\nEndRemoteConfig\n" | nc -l -p $RCPORT7 -q 1
|
||||
done &
|
||||
LOOPPID=$!
|
||||
# Some options are invalid, check that they are skipped and the rest of the
|
||||
# options get applied.
|
||||
http_proxy=$SECONDARY_HOSTNAME fetch_until -save "$URL" \
|
||||
'fgrep -c MyExperimentID' 1
|
||||
kill $LOOPPID
|
||||
kill_listener_port nc $RCPORT7
|
||||
fi
|
||||
|
||||
check_failures_and_exit
|
||||
@@ -868,130 +868,6 @@ if [ "$SECONDARY_HOSTNAME" != "" ]; then
|
||||
$EXP_DEVICES_EXTEND_CACHE?PageSpeedEnrollExperiment=1)
|
||||
check_from "$OUT" grep -q 'Set-Cookie: PageSpeedExperiment=1;'
|
||||
|
||||
# Tests for remote configuration files.
|
||||
# The remote configuration location is stored in the debug.conf.template.
|
||||
start_test Remote Configuration On: by default comments and whitespace removed
|
||||
URL="$(generate_url remote-config.example.com \
|
||||
/mod_pagespeed_test/forbidden.html)"
|
||||
kill_listener_port nc $RCPORT1
|
||||
while true; do
|
||||
echo -e "HTTP/1.1 200 OK\nCache-Control: max-age=5\n\nEnableFilters remove_comments,collapse_whitespace\nEndRemoteConfig\n" | nc -l -p $RCPORT1 -q 1
|
||||
done &
|
||||
LOOPPID=$!
|
||||
echo wget $URL
|
||||
http_proxy=$SECONDARY_HOSTNAME fetch_until -save "$URL" \
|
||||
'fgrep -c <!--' 0
|
||||
kill $LOOPPID
|
||||
kill_listener_port nc $RCPORT1
|
||||
|
||||
start_test Remote Configuration On: File missing end token.
|
||||
URL="$(generate_url remote-config-invalid.example.com \
|
||||
/mod_pagespeed_test/forbidden.html)"
|
||||
kill_listener_port nc $RCPORT3
|
||||
while true; do
|
||||
echo -e "HTTP/1.1 200 OK\nCache-Control: max-age=5\n\nEnableFilters remove_comments,collapse_whitespace\n" | nc -l -p $RCPORT3 -q 1
|
||||
done &
|
||||
LOOPPID=$!
|
||||
echo wget $URL
|
||||
# Fetch a few times to be satisfied that the configuration should be fetched.
|
||||
OUT=$(http_proxy=$SECONDARY_HOSTNAME $WGET_DUMP --save-headers $URL)
|
||||
check_from "$OUT" grep "<!--"
|
||||
OUT=$(http_proxy=$SECONDARY_HOSTNAME $WGET_DUMP --save-headers $URL)
|
||||
check_from "$OUT" grep "<!--"
|
||||
OUT=$(http_proxy=$SECONDARY_HOSTNAME $WGET_DUMP --save-headers $URL)
|
||||
check_from "$OUT" grep "<!--"
|
||||
kill $LOOPPID
|
||||
kill_listener_port nc $RCPORT3
|
||||
|
||||
start_test Remote Configuration On: Some invalid options.
|
||||
URL="$(generate_url remote-config-partially-invalid.example.com \
|
||||
/mod_pagespeed_test/forbidden.html)"
|
||||
kill_listener_port nc $RCPORT2
|
||||
while true; do
|
||||
echo -e "HTTP/1.1 200 OK\nCache-Control: max-age=5\n\nEnableFilters remove_comments,collapse_whitespace\nEndRemoteConfig\n" | nc -l -p $RCPORT2 -q 1
|
||||
done&
|
||||
LOOPPID=$!
|
||||
# Some options are invalid, check that they are skipped and the rest of the
|
||||
# options get applied.
|
||||
echo wget $URL
|
||||
http_proxy=$SECONDARY_HOSTNAME fetch_until -save "$URL" \
|
||||
'fgrep -c <!--' 0
|
||||
kill $LOOPPID
|
||||
kill_listener_port nc $RCPORT2
|
||||
|
||||
start_test Remote Configuration On: overridden by query parameter.
|
||||
URL="$(generate_url remote-config.example.com \
|
||||
/mod_pagespeed_test/forbidden.html)"
|
||||
kill_listener_port nc $RCPORT1
|
||||
while true; do
|
||||
echo -e "HTTP/1.1 200 OK\nCache-Control: max-age=5\n\nEnableFilters remove_comments,collapse_whitespace\nEndRemoteConfig\n" | nc -l -p $RCPORT1 -q 1
|
||||
done &
|
||||
LOOPPID=$!
|
||||
# First check to see that the remote config is applied.
|
||||
echo wget $URL
|
||||
http_proxy=$SECONDARY_HOSTNAME fetch_until -save "$URL" \
|
||||
'fgrep -c <!--' 0
|
||||
# And now check to see that the query parameters override the remote config.
|
||||
URL="$(generate_url remote-config.example.com \
|
||||
/mod_pagespeed_test/forbidden.html?PageSpeedFilters=-remove_comments)"
|
||||
echo wget $URL
|
||||
http_proxy=$SECONDARY_HOSTNAME fetch_until -save "$URL" \
|
||||
'fgrep -c <!--' 2
|
||||
kill $LOOPPID
|
||||
NCPID="$(lsof -i:$RCPORT1 -t)" || true
|
||||
kill_listener_port nc $RCPORT1
|
||||
|
||||
start_test second remote config fetch fails, cached value still applies.
|
||||
kill_listener_port nc $RCPORT5
|
||||
while true; do
|
||||
echo -e "HTTP/1.1 200 OK\nCache-Control: max-age=1\n\nEnableFilters remove_comments,collapse_whitespace\nEndRemoteConfig\n" | nc -l -p $RCPORT5 -q 1
|
||||
done &
|
||||
LOOPPID=$!
|
||||
URL="$(generate_url remote-config-failed-fetch.example.com \
|
||||
/mod_pagespeed_test/forbidden.html)"
|
||||
http_proxy=$SECONDARY_HOSTNAME fetch_until -save "$URL" \
|
||||
'fgrep -c <!--' 0
|
||||
http_proxy=$SECONDARY_HOSTNAME fetch_until -save "$URL" \
|
||||
'fgrep -c <!--' 0
|
||||
echo "Sleeping so that cache will expire"
|
||||
sleep 2
|
||||
http_proxy=$SECONDARY_HOSTNAME fetch_until -save "$URL" \
|
||||
'fgrep -c <!--' 0
|
||||
kill $LOOPPID
|
||||
kill_listener_port nc $RCPORT5
|
||||
|
||||
start_test config takes too long to fetch, is not applied.
|
||||
URL="$(generate_url remote-config-slow-fetch.example.com \
|
||||
/mod_pagespeed_test/forbidden.html)"
|
||||
kill_listener_port nc $RCPORT6
|
||||
while true; do
|
||||
sleep 4; echo -e "HTTP/1.1 200 OK\nCache-Control: max-age=2\n\nEnableFilters remove_comments,collapse_whitespace\nEndRemoteConfig\n" | nc -l -p $RCPORT6 -q 4
|
||||
done &
|
||||
LOOPPID=$!
|
||||
# Fetch a few times to be satisfied that the configuration should have been
|
||||
# fetched.
|
||||
OUT=$(http_proxy=$SECONDARY_HOSTNAME $WGET_DUMP --save-headers $URL)
|
||||
check_from "$OUT" grep "<!--"
|
||||
OUT=$(http_proxy=$SECONDARY_HOSTNAME $WGET_DUMP --save-headers $URL)
|
||||
check_from "$OUT" grep "<!--"
|
||||
kill $LOOPPID
|
||||
kill_listener_port nc $RCPORT6
|
||||
|
||||
start_test Remote Configuration specify an experiment.
|
||||
URL="$(generate_url remote-config-experiment.example.com \
|
||||
/mod_pagespeed_test/forbidden.html)"
|
||||
kill_listener_port nc $RCPORT7
|
||||
while true; do
|
||||
echo -e "HTTP/1.1 200 OK\nCache-Control: max-age=5\n\nRunExperiment on\nAnalyticsID UA-MyExperimentID-1\nUseAnalyticsJs false\nEndRemoteConfig\n" | nc -l -p $RCPORT7 -q 1
|
||||
done &
|
||||
LOOPPID=$!
|
||||
# Some options are invalid, check that they are skipped and the rest of the
|
||||
# options get applied.
|
||||
http_proxy=$SECONDARY_HOSTNAME fetch_until -save "$URL" \
|
||||
'fgrep -c MyExperimentID' 1
|
||||
kill $LOOPPID
|
||||
kill_listener_port nc $RCPORT7
|
||||
|
||||
start_test Downstream cache integration caching headers.
|
||||
URL="http://downstreamcacheresource.example.com/mod_pagespeed_example/images/"
|
||||
URL+="xCuppa.png.pagespeed.ic.0.png"
|
||||
|
||||
Reference in New Issue
Block a user