diff --git a/.github/actions/dependencies/install/action.yml b/.github/actions/dependencies/install/action.yml index e4585392..f5515997 100644 --- a/.github/actions/dependencies/install/action.yml +++ b/.github/actions/dependencies/install/action.yml @@ -50,6 +50,7 @@ inputs: jq lcov memcached + procps freebsd-build-dependencies: default: >- apache24 @@ -140,6 +141,7 @@ inputs: jq lcov memcached + procps rhel-mapnik-build-dependencies: default: >- boost-devel diff --git a/.github/workflows/coverage.yml b/.github/workflows/coverage.yml index b5443135..54a3d5ba 100644 --- a/.github/workflows/coverage.yml +++ b/.github/workflows/coverage.yml @@ -51,6 +51,10 @@ jobs: libwebp-dev libxml2-dev + - name: Stop `memcached` service + run: | + sudo systemctl stop memcached + - name: Build `mod_tile` uses: ./.github/actions/cmake/build diff --git a/.github/workflows/docker-image-build.yml b/.github/workflows/docker-image-build.yml index a2e2ccc4..4d79eafd 100644 --- a/.github/workflows/docker-image-build.yml +++ b/.github/workflows/docker-image-build.yml @@ -43,11 +43,26 @@ jobs: - name: Test run: | - until $(curl --fail --output tile.png --silent http://localhost:8081/tiles/renderd-example/9/297/191.png); do + until $(curl --fail --output tile.jpg.file.0 --silent http://localhost:8081/tiles/renderd-example-jpg/9/297/191.jpg); do echo 'Sleeping 5s'; sleep 5; done - echo 'dbf26531286e844a3a9735cdd193598dca78d22f77cafe5824bcaf17f88cbb08 tile.png' | sha256sum --check + sha256sum --check --ignore-missing tests/tiles.sha256sum | grep tile.jpg.file.0 | grep -q OK + until $(curl --fail --output tile.png256.file.0 --silent http://localhost:8081/tiles/renderd-example-png256/9/297/191.png); do + echo 'Sleeping 5s'; + sleep 5; + done + sha256sum --check --ignore-missing tests/tiles.sha256sum | grep tile.png256.file.0 | grep -q OK + until $(curl --fail --output tile.png32.file.0 --silent http://localhost:8081/tiles/renderd-example-png32/9/297/191.png); do + echo 'Sleeping 5s'; + sleep 5; + done + sha256sum --check --ignore-missing tests/tiles.sha256sum | grep tile.png32.file.0 | grep -q OK + until $(curl --fail --output tile.webp.file.0 --silent http://localhost:8081/tiles/renderd-example-webp/9/297/191.webp); do + echo 'Sleeping 5s'; + sleep 5; + done + sha256sum --check --ignore-missing tests/tiles.sha256sum | grep tile.webp.file.0 | grep -q OK timeout-minutes: 1 - name: Show logs diff --git a/docker/centos/stream/Dockerfile b/docker/centos/stream/Dockerfile index 13f1936f..f05b4e24 100644 --- a/docker/centos/stream/Dockerfile +++ b/docker/centos/stream/Dockerfile @@ -119,6 +119,7 @@ RUN --mount=id=centos:stream${centos_stream_version}-/var/cache/dnf,target=/var/ libtiff \ libwebp \ make \ + procps \ proj ## Copy files from builder(s) diff --git a/docker/fedora/Dockerfile b/docker/fedora/Dockerfile index eecbbe5e..d7cf43ee 100644 --- a/docker/fedora/Dockerfile +++ b/docker/fedora/Dockerfile @@ -22,7 +22,8 @@ RUN --mount=id=fedora:${fedora_version}-/var/cache/dnf,target=/var/cache/dnf,typ libcurl-devel \ libmemcached-devel \ librados-devel \ - mapnik-devel + mapnik-devel \ + procps ## Build, Test & Install `mod_tile` COPY . /tmp/mod_tile_src diff --git a/src/mod_tile.c b/src/mod_tile.c index 3d3a3f6a..ad7b3009 100644 --- a/src/mod_tile.c +++ b/src/mod_tile.c @@ -512,7 +512,7 @@ static int add_cors(request_rec *r, const char * cors) return DONE; } } else { - ap_log_rerror(APLOG_MARK, APLOG_INFO, 0, r, "Origin header (%s)is NOT allowed under the CORS policy(%s). Rejecting request", origin, cors); + ap_log_rerror(APLOG_MARK, APLOG_INFO, 0, r, "Origin header (%s) is NOT allowed under the CORS policy (%s). Rejecting request", origin, cors); return HTTP_FORBIDDEN; } } @@ -1067,7 +1067,7 @@ static int tile_storage_hook(request_rec *r) } else if (avg > scfg->max_load_old) { // Too much load to render it now, mark dirty but return old tile request_tile(r, cmd, 0); - ap_log_rerror(APLOG_MARK, APLOG_DEBUG, 0, r, "Load (%f) larger max_load_old (%d). Mark dirty and deliver from cache.", avg, scfg->max_load_old); + ap_log_rerror(APLOG_MARK, APLOG_DEBUG, 0, r, "Load (%f) greater than max_load_old (%d). Mark dirty and deliver from cache.", avg, scfg->max_load_old); if (!incFreshCounter((state == tileVeryOld) ? VERYOLD : OLD, r)) { ap_log_rerror(APLOG_MARK, APLOG_WARNING, 0, r, @@ -1083,7 +1083,7 @@ static int tile_storage_hook(request_rec *r) case tileMissing: if (avg > scfg->max_load_missing) { request_tile(r, cmd, 0); - ap_log_rerror(APLOG_MARK, APLOG_INFO, 0, r, "Load (%f) larger max_load_missing (%d). Return HTTP_NOT_FOUND.", avg, scfg->max_load_missing); + ap_log_rerror(APLOG_MARK, APLOG_INFO, 0, r, "Load (%f) greater than max_load_missing (%d). Return HTTP_NOT_FOUND.", avg, scfg->max_load_missing); if (!incRespCounter(HTTP_NOT_FOUND, r, cmd, rdata->layerNumber)) { ap_log_rerror(APLOG_MARK, APLOG_WARNING, 0, r, @@ -2180,7 +2180,7 @@ static const char *load_tile_config(cmd_parms *cmd, void *mconfig, const char *c // Load the config if ((hini = fopen(filename, "r")) == NULL) { - return "Unable to open config file"; + return "LoadTileConfigFile error, unable to open config file"; } while (fgets(line, INILINE_MAX, hini) != NULL) { @@ -2531,7 +2531,7 @@ static const char *mod_tile_veryold_threshold_config(cmd_parms *cmd, void *mconf tile_server_conf *scfg; if (sscanf(veryold_threshold_string, "%" SCNd64, &veryold_threshold) != 1) { - return "ModTileVeryoldThreshold needs integer argument"; + return "ModTileVeryOldThreshold needs integer argument"; } scfg = ap_get_module_config(cmd->server->module_config, &tile_module); @@ -2554,7 +2554,7 @@ static const char *mod_tile_renderd_socket_addr_config(cmd_parms *cmd, void *mco strncpy(scfg->renderd_socket_name, renderd_socket_address_string, PATH_MAX - 1); if (sscanf(renderd_socket_port_string, "%d", &port) != 1) { - return "TCP port needs to be an integer argument"; + return "ModTileRenderdSocketAddr TCP port needs to be an integer argument"; } scfg->renderd_socket_port = port; diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index 61ebf151..8bf48d05 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -30,7 +30,9 @@ find_program(JQ_EXECUTABLE NAMES jq) find_program(KILL_EXECUTABLE NAMES kill REQUIRED) find_program(MEMCACHED_EXECUTABLE NAMES memcached) find_program(MKDIR_EXECUTABLE NAMES mkdir REQUIRED) +find_program(PS_EXECUTABLE NAMES ps REQUIRED) find_program(SHA256SUM_EXECUTABLE NAMES gsha256sum sha256sum REQUIRED) +find_program(SLEEP_EXECUTABLE NAMES sleep REQUIRED) find_program(TOUCH_EXECUTABLE NAMES gtouch touch REQUIRED) # Sets the host to be used for CTest test services @@ -53,6 +55,8 @@ set(HTTPD0_HOST "${CTEST_HOST}") set(HTTPD0_PORT_BASE "59000") set(HTTPD1_HOST "${CTEST_HOST}") set(HTTPD1_PORT_BASE "59100") +set(HTTPD2_HOST "${CTEST_HOST}") +set(HTTPD2_PORT_BASE "59200") set(MEMCACHED_HOST "${CTEST_HOST}") set(MEMCACHED_PORT_BASE "60000") set(RENDERD1_HOST "${CTEST_HOST}") @@ -101,8 +105,7 @@ math(EXPR STORAGE_BACKENDS_LENGTH "${STORAGE_BACKENDS_LENGTH} - 1") #----------------------------------------------------------------------------- function(add_bad_tile_download_test TEST_NAME TEST_URL REQUIRED_FIXTURE_NAME) - add_test( - NAME bad_download_tile_${TEST_NAME} + add_test(NAME bad_download_tile_${TEST_NAME} COMMAND ${BASH} -c " echo 'Downloading ${TEST_URL}' while true; do @@ -112,7 +115,7 @@ function(add_bad_tile_download_test TEST_NAME TEST_URL REQUIRED_FIXTURE_NAME) exit 0; fi echo 'Sleeping 1s'; - sleep 1; + ${SLEEP_EXECUTABLE} 1; done " WORKING_DIRECTORY tests @@ -124,13 +127,12 @@ function(add_bad_tile_download_test TEST_NAME TEST_URL REQUIRED_FIXTURE_NAME) endfunction() function(add_good_tile_download_test TEST_NAME TEST_URL FILE_NAME FIXTURE_NAME REQUIRED_FIXTURE_NAME) - add_test( - NAME download_tile_${TEST_NAME} + add_test(NAME download_tile_${TEST_NAME} COMMAND ${BASH} -c " echo 'Downloading ${TEST_URL}' until $(${CURL_CMD} ${TEST_URL} --output ${FILE_NAME}); do echo 'Sleeping 1s'; - sleep 1; + ${SLEEP_EXECUTABLE} 1; done " WORKING_DIRECTORY tests @@ -140,8 +142,7 @@ function(add_good_tile_download_test TEST_NAME TEST_URL FILE_NAME FIXTURE_NAME R FIXTURES_SETUP ${FIXTURE_NAME} TIMEOUT 10 ) - add_test( - NAME check_tile_${TEST_NAME} + add_test(NAME check_tile_${TEST_NAME} COMMAND ${BASH} -c " ${SHA256SUM_EXECUTABLE} -c tiles.sha256sum | ${GREP_EXECUTABLE} ${FILE_NAME} | ${GREP_EXECUTABLE} -q OK " @@ -152,8 +153,7 @@ function(add_good_tile_download_test TEST_NAME TEST_URL FILE_NAME FIXTURE_NAME R FIXTURES_REQUIRED ${FIXTURE_NAME} REQUIRED_FILES ${FILE_NAME} ) - add_test( - NAME remove_tile_${TEST_NAME} + add_test(NAME remove_tile_${TEST_NAME} COMMAND ${RM} -v ${FILE_NAME} WORKING_DIRECTORY tests ) @@ -170,8 +170,7 @@ endfunction() # #----------------------------------------------------------------------------- -add_test( - NAME gen_tile_test +add_test(NAME gen_tile_test COMMAND gen_tile_test WORKING_DIRECTORY src ) @@ -183,6 +182,7 @@ foreach(STORAGE_BACKEND_INDEX RANGE ${STORAGE_BACKENDS_LENGTH}) # Increment Ports math(EXPR HTTPD0_PORT "${HTTPD0_PORT_BASE} + ${STORAGE_BACKEND_INDEX}") math(EXPR HTTPD1_PORT "${HTTPD1_PORT_BASE} + ${STORAGE_BACKEND_INDEX}") + math(EXPR HTTPD2_PORT "${HTTPD2_PORT_BASE} + ${STORAGE_BACKEND_INDEX}") math(EXPR RENDERD1_PORT "${RENDERD1_PORT_BASE} + ${STORAGE_BACKEND_INDEX}") if(STORAGE_BACKEND STREQUAL memcached_custom) math(EXPR MEMCACHED_PORT "${MEMCACHED_PORT_BASE} + ${STORAGE_BACKEND_INDEX}") @@ -234,23 +234,23 @@ foreach(STORAGE_BACKEND_INDEX RANGE ${STORAGE_BACKENDS_LENGTH}) endif() # Generate renderd.conf file - configure_file( - renderd.conf.in - ${RENDERD_CONF} - ) + configure_file(renderd.conf.in ${RENDERD_CONF}) # Generate httpd.conf filelogs - configure_file( - httpd.conf.in - ${HTTPD_CONF} - ) + configure_file(httpd.conf.in ${HTTPD_CONF}) # Set list of service start commands set(SERVICES_START_CMDS - "$ --config ${RENDERD_CONF} --foreground --slave 0 > ${RENDERD0_LOG} 2>&1 &" - "printf \${!} > ${RENDERD0_PID}" - "$ --config ${RENDERD_CONF} --foreground --slave 1 > ${RENDERD1_LOG} 2>&1 &" - "printf \${!} > ${RENDERD1_PID}" + "$ --config ${RENDERD_CONF} --slave 0 --foreground > ${RENDERD0_LOG} 2>&1 & + PID=\${!}\; + ${SLEEP_EXECUTABLE} 1\; + ${PS_EXECUTABLE} -p \${PID} || exit 1\; + echo \${PID} > ${RENDERD0_PID}" + "$ --config ${RENDERD_CONF} --slave 1 --foreground > ${RENDERD1_LOG} 2>&1 & + PID=\${!}\; + ${SLEEP_EXECUTABLE} 1\; + ${PS_EXECUTABLE} -p \${PID} || exit 1\; + echo \${PID} > ${RENDERD1_PID}" "$ --config ${RENDERD_CONF} --slave 2" "${HTTPD_EXECUTABLE} -e debug -f ${HTTPD_CONF} -k start > ${HTTPD_LOG} 2>&1" ) @@ -258,18 +258,15 @@ foreach(STORAGE_BACKEND_INDEX RANGE ${STORAGE_BACKENDS_LENGTH}) # Conditionally append memcached start commands to SERVICES_START_CMDS based on STORAGE_BACKEND value if(STORAGE_BACKEND MATCHES "memcached_.+") list(APPEND SERVICES_START_CMDS - "${MEMCACHED_EXECUTABLE} -l ${MEMCACHED_HOST} -p ${MEMCACHED_PORT} -u ${USER_NAME} -vvv > ${MEMCACHED_LOG} 2>&1 &" - "printf \${!} > ${MEMCACHED_PID}" + "${MEMCACHED_EXECUTABLE} -l ${MEMCACHED_HOST} -p ${MEMCACHED_PORT} -u ${USER_NAME} -vvv > ${MEMCACHED_LOG} 2>&1 & + PID=\${!}\; + ${SLEEP_EXECUTABLE} 1\; + ${PS_EXECUTABLE} -p \${PID} || exit 1\; + echo \${PID} > ${MEMCACHED_PID}" ) endif() - # Join MAP_NAMES with spaces into MAP_NAMES_STR (to support bash for loop) - string(REPLACE ";" " " MAP_NAMES_STR "${MAP_NAMES}") - # Join SERVICES_START_CMDS with newlines into SERVICES_START_CMDS_STR - string(REPLACE ";" "\n" SERVICES_START_CMDS_STR "${SERVICES_START_CMDS}") - - add_test( - NAME create_dirs_${STORAGE_BACKEND} + add_test(NAME create_dirs_${STORAGE_BACKEND} COMMAND ${MKDIR_EXECUTABLE} -p -v ${TEST_LOGS_DIR} ${TEST_RUN_DIR} @@ -279,15 +276,22 @@ foreach(STORAGE_BACKEND_INDEX RANGE ${STORAGE_BACKENDS_LENGTH}) set_tests_properties(create_dirs_${STORAGE_BACKEND} PROPERTIES FIXTURES_SETUP services_started_${STORAGE_BACKEND} ) - add_test( - NAME start_services_${STORAGE_BACKEND} - COMMAND ${BASH} -c "${SERVICES_START_CMDS_STR}" - WORKING_DIRECTORY tests - ) - set_tests_properties(start_services_${STORAGE_BACKEND} PROPERTIES - DEPENDS create_dirs - FIXTURES_SETUP services_started_${STORAGE_BACKEND} - ) + + list(LENGTH SERVICES_START_CMDS SERVICES_START_CMDS_LENGTH) + math(EXPR SERVICES_START_CMDS_LENGTH "${SERVICES_START_CMDS_LENGTH} - 1") + + foreach(SERVICES_START_CMDS_INDEX RANGE ${SERVICES_START_CMDS_LENGTH}) + # Get SERVICES_START_CMD from SERVICES_START_CMDS list + list(GET SERVICES_START_CMDS ${SERVICES_START_CMDS_INDEX} SERVICES_START_CMD) + add_test(NAME start_services_${STORAGE_BACKEND}_${SERVICES_START_CMDS_INDEX} + COMMAND ${BASH} -c "${SERVICES_START_CMD}" + WORKING_DIRECTORY tests + ) + set_tests_properties(start_services_${STORAGE_BACKEND}_${SERVICES_START_CMDS_INDEX} PROPERTIES + DEPENDS create_dirs_${STORAGE_BACKEND} + FIXTURES_SETUP services_started_${STORAGE_BACKEND} + ) + endforeach() foreach(SOCKET_TYPE sock tcp) # Use socket file as --socket value for communicating with renderd process @@ -299,8 +303,7 @@ foreach(STORAGE_BACKEND_INDEX RANGE ${STORAGE_BACKENDS_LENGTH}) set(SOCKET ${RENDERD1_HOST}:${RENDERD1_PORT}) endif() - add_test( - NAME render_expired_${SOCKET_TYPE}_${STORAGE_BACKEND} + add_test(NAME render_expired_${SOCKET_TYPE}_${STORAGE_BACKEND} COMMAND ${BASH} -c " echo '0/0/0' | $ \ --map ${DEFAULT_MAP_NAME} \ @@ -319,8 +322,7 @@ foreach(STORAGE_BACKEND_INDEX RANGE ${STORAGE_BACKENDS_LENGTH}) FIXTURES_REQUIRED services_started_${STORAGE_BACKEND} TIMEOUT 60 ) - add_test( - NAME render_expired_delete_${SOCKET_TYPE}_${STORAGE_BACKEND} + add_test(NAME render_expired_delete_${SOCKET_TYPE}_${STORAGE_BACKEND} COMMAND ${BASH} -c " echo '0/0/0' | $ \ --delete-from 0 \ @@ -340,8 +342,7 @@ foreach(STORAGE_BACKEND_INDEX RANGE ${STORAGE_BACKENDS_LENGTH}) FIXTURES_REQUIRED services_started_${STORAGE_BACKEND} TIMEOUT 60 ) - add_test( - NAME render_expired_touch_${SOCKET_TYPE}_${STORAGE_BACKEND} + add_test(NAME render_expired_touch_${SOCKET_TYPE}_${STORAGE_BACKEND} COMMAND ${BASH} -c " echo '0/0/0' | $ \ --map ${DEFAULT_MAP_NAME} \ @@ -361,8 +362,7 @@ foreach(STORAGE_BACKEND_INDEX RANGE ${STORAGE_BACKENDS_LENGTH}) FIXTURES_REQUIRED services_started_${STORAGE_BACKEND} TIMEOUT 60 ) - add_test( - NAME render_list_${SOCKET_TYPE}_${STORAGE_BACKEND} + add_test(NAME render_list_${SOCKET_TYPE}_${STORAGE_BACKEND} COMMAND ${BASH} -c " $ \ --all \ @@ -382,8 +382,7 @@ foreach(STORAGE_BACKEND_INDEX RANGE ${STORAGE_BACKENDS_LENGTH}) FIXTURES_REQUIRED services_started_${STORAGE_BACKEND} TIMEOUT 60 ) - add_test( - NAME render_list_stdin_${SOCKET_TYPE}_${STORAGE_BACKEND} + add_test(NAME render_list_stdin_${SOCKET_TYPE}_${STORAGE_BACKEND} COMMAND ${BASH} -c " echo '0 0 0' | $ \ --force \ @@ -402,8 +401,7 @@ foreach(STORAGE_BACKEND_INDEX RANGE ${STORAGE_BACKENDS_LENGTH}) FIXTURES_REQUIRED services_started_${STORAGE_BACKEND} TIMEOUT 60 ) - add_test( - NAME render_old_${SOCKET_TYPE}_${STORAGE_BACKEND} + add_test(NAME render_old_${SOCKET_TYPE}_${STORAGE_BACKEND} COMMAND ${BASH} -c " ${TOUCH_EXECUTABLE} -d '+1 month' ${TEST_TILES_DIR}/planet-import-complete $ \ @@ -423,8 +421,7 @@ foreach(STORAGE_BACKEND_INDEX RANGE ${STORAGE_BACKENDS_LENGTH}) FIXTURES_REQUIRED services_started_${STORAGE_BACKEND} TIMEOUT 60 ) - add_test( - NAME render_speedtest_${SOCKET_TYPE}_${STORAGE_BACKEND} + add_test(NAME render_speedtest_${SOCKET_TYPE}_${STORAGE_BACKEND} COMMAND ${BASH} -c " $ \ --map ${DEFAULT_MAP_NAME} \ @@ -439,8 +436,7 @@ foreach(STORAGE_BACKEND_INDEX RANGE ${STORAGE_BACKENDS_LENGTH}) FIXTURES_REQUIRED "services_started_${STORAGE_BACKEND};tiles_downloaded_${STORAGE_BACKEND}" TIMEOUT 60 ) - add_test( - NAME add_tile_config_${SOCKET_TYPE}_${STORAGE_BACKEND} + add_test(NAME add_tile_config_${SOCKET_TYPE}_${STORAGE_BACKEND} COMMAND ${BASH} -c " CONFIG_NAME=\"add_tile_config_${SOCKET_TYPE}\" SEARCH_LINE=\$(${GREP_EXECUTABLE} -m1 \"Loading tile config \${CONFIG_NAME}\" ${HTTPD_LOG}) @@ -462,8 +458,7 @@ foreach(STORAGE_BACKEND_INDEX RANGE ${STORAGE_BACKENDS_LENGTH}) set_tests_properties(add_tile_config_${SOCKET_TYPE}_${STORAGE_BACKEND} PROPERTIES FIXTURES_REQUIRED services_started_${STORAGE_BACKEND} ) - add_test( - NAME add_tile_mime_config_${SOCKET_TYPE}_${STORAGE_BACKEND} + add_test(NAME add_tile_mime_config_${SOCKET_TYPE}_${STORAGE_BACKEND} COMMAND ${BASH} -c " for SEARCH_CONFIG in js png; do CONFIG_NAME=\"add_tile_mime_config_\${SEARCH_CONFIG}_${SOCKET_TYPE}\" @@ -505,14 +500,16 @@ foreach(STORAGE_BACKEND_INDEX RANGE ${STORAGE_BACKENDS_LENGTH}) elseif(BAD_ADD_CONFIG STREQUAL add_tile_mime_config_png) set(EXTENSION png) endif() + # Generate URL path for tiles set(TILE_URL_PATH "/${BAD_ADD_CONFIG}_${SOCKET_TYPE}/${TILE_ZXY}.${EXTENSION}") + # Generate tile URLs set(HTTPD0_URL "http://${HTTPD0_HOST}:${HTTPD0_PORT}${TILE_URL_PATH}") + set(HTTPD1_URL "http://${HTTPD1_HOST}:${HTTPD1_PORT}${TILE_URL_PATH}") add_bad_tile_download_test( ${BAD_ADD_CONFIG}_${SOCKET_TYPE}_${STORAGE_BACKEND}_0 ${HTTPD0_URL} services_started_${STORAGE_BACKEND} ) - set(HTTPD1_URL "http://${HTTPD1_HOST}:${HTTPD1_PORT}${TILE_URL_PATH}") add_bad_tile_download_test( ${BAD_ADD_CONFIG}_${SOCKET_TYPE}_${STORAGE_BACKEND}_1 ${HTTPD1_URL} @@ -524,9 +521,22 @@ foreach(STORAGE_BACKEND_INDEX RANGE ${STORAGE_BACKENDS_LENGTH}) foreach(MAP_NAME IN LISTS MAP_NAMES) # Set EXTENSION from MAP_NAME (only works for map names containing an actual extension) string(REGEX REPLACE "[0-9]+" "" EXTENSION ${MAP_NAME}) + # Set count for stats to 0 + set(STATS_COUNTER 0) + # Generate file and URL paths for tiles set(TILE_FILE_NAME "tile.${MAP_NAME}.${STORAGE_BACKEND}") set(TILE_URL_PATH "/tiles/${MAP_NAME}/${TILE_ZXY}.${EXTENSION}") + # Generate tile URLs set(HTTPD0_URL "http://${HTTPD0_HOST}:${HTTPD0_PORT}${TILE_URL_PATH}") + set(HTTPD1_URL "http://${HTTPD1_HOST}:${HTTPD1_PORT}${TILE_URL_PATH}") + # Generate tile dirty and status URLs + set(DIRTY_OFF_URL "${HTTPD1_URL}/dirty") + set(DIRTY_ON_URL "${HTTPD0_URL}/dirty") + set(STATUS_OFF_URL "${HTTPD1_URL}/status") + set(STATUS_ON_URL "${HTTPD0_URL}/status") + # Increment count for stats (only counted by requests to HTTPD0_URL, HTTPD1_URL has stats disabled) + math(EXPR STATS_COUNTER "${STATS_COUNTER} + 1") + add_good_tile_download_test( ${MAP_NAME}_${STORAGE_BACKEND}_0 ${HTTPD0_URL} @@ -534,7 +544,6 @@ foreach(STORAGE_BACKEND_INDEX RANGE ${STORAGE_BACKENDS_LENGTH}) tiles_downloaded_${STORAGE_BACKEND} services_started_${STORAGE_BACKEND} ) - set(HTTPD1_URL "http://${HTTPD1_HOST}:${HTTPD1_PORT}${TILE_URL_PATH}") add_good_tile_download_test( ${MAP_NAME}_${STORAGE_BACKEND}_1 ${HTTPD1_URL} @@ -542,14 +551,14 @@ foreach(STORAGE_BACKEND_INDEX RANGE ${STORAGE_BACKENDS_LENGTH}) tiles_downloaded_${STORAGE_BACKEND} services_started_${STORAGE_BACKEND} ) - add_test( - NAME status_and_dirty_${MAP_NAME}_${STORAGE_BACKEND} + + add_test(NAME dirty_and_status_${MAP_NAME}_${STORAGE_BACKEND} COMMAND ${BASH} -c " - TILE_DIRTY_ON_CMD=\"${CURL_CMD} ${HTTPD0_URL}/dirty\" - TILE_STATUS_ON_CMD=\"${CURL_CMD} ${HTTPD0_URL}/status\" + TILE_DIRTY_ON_CMD=\"${CURL_CMD} ${DIRTY_ON_URL}\" + TILE_STATUS_ON_CMD=\"${CURL_CMD} ${STATUS_ON_URL}\" TILE_LAST_RENDERED_AT_OLD=$(\${TILE_STATUS_ON_CMD} | ${GREP_EXECUTABLE} -o 'Last rendered at [^\\.]*.') echo \"Tile Last Rendered At (Old): \${TILE_LAST_RENDERED_AT_OLD}\" - sleep 1 + ${SLEEP_EXECUTABLE} 1 TILE_DIRTY_ON_OUTPUT=$(\${TILE_DIRTY_ON_CMD}) echo \"Dirty: \${TILE_DIRTY_ON_OUTPUT}\" if [ \"\${TILE_DIRTY_ON_OUTPUT}\" != \"Tile submitted for rendering\" ]; then @@ -559,16 +568,16 @@ foreach(STORAGE_BACKEND_INDEX RANGE ${STORAGE_BACKENDS_LENGTH}) echo \"Tile Last Rendered At (New): \${TILE_LAST_RENDERED_AT_NEW}\" until [ \"\${TILE_LAST_RENDERED_AT_OLD}\" != \"\${TILE_LAST_RENDERED_AT_NEW}\" ]; do echo 'Sleeping 1s'; - sleep 1; + ${SLEEP_EXECUTABLE} 1; TILE_LAST_RENDERED_AT_NEW=$(\${TILE_STATUS_ON_CMD} | ${GREP_EXECUTABLE} -o 'Last rendered at [^\\.]*.'); echo \"Tile Last Rendered At (New): \${TILE_LAST_RENDERED_AT_NEW}\"; done - TILE_DIRTY_OFF_CODE=$(${CURL_CMD} --write-out '%{http_code}' ${HTTPD1_URL}/dirty) + TILE_DIRTY_OFF_CODE=$(${CURL_CMD} --write-out '%{http_code}' ${DIRTY_OFF_URL}) echo \"Dirty Off code: '\${TILE_DIRTY_OFF_CODE}'\" if [ \"\${TILE_DIRTY_OFF_CODE}\" != \"404\" ]; then exit 1; fi - TILE_STATUS_OFF_CODE=$(${CURL_CMD} --write-out '%{http_code}' ${HTTPD1_URL}/status) + TILE_STATUS_OFF_CODE=$(${CURL_CMD} --write-out '%{http_code}' ${STATUS_OFF_URL}) echo \"Status Off code: '\${TILE_STATUS_OFF_CODE}'\" if [ \"\${TILE_STATUS_OFF_CODE}\" != \"404\" ]; then exit 1; @@ -576,15 +585,53 @@ foreach(STORAGE_BACKEND_INDEX RANGE ${STORAGE_BACKENDS_LENGTH}) " WORKING_DIRECTORY tests ) - set_tests_properties(status_and_dirty_${MAP_NAME}_${STORAGE_BACKEND} PROPERTIES + set_tests_properties(dirty_and_status_${MAP_NAME}_${STORAGE_BACKEND} PROPERTIES FIXTURES_REQUIRED "services_started_${STORAGE_BACKEND};tiles_downloaded_${STORAGE_BACKEND}" TIMEOUT 20 ) + add_test(NAME stats_urls_${MAP_NAME}_${STORAGE_BACKEND} + COMMAND ${BASH} -c " + METRICS_ON_CMD=\"${CURL_CMD} ${METRICS_ON_URL}\" + METRICS_ON_OUTPUT=$(\${METRICS_ON_CMD}) + echo \"Metrics On output: \${METRICS_ON_OUTPUT}\" + METRICS_200=\"modtile_layer_responses_total{layer=\\\"/tiles/${MAP_NAME}/\\\",status=\\\"200\\\"} ${STATS_COUNTER}\" + echo \"\${METRICS_200}\"; + if [[ \"\${METRICS_ON_OUTPUT}\" != *\"\${METRICS_200}\"* ]]; then + exit 1; + fi + METRICS_OFF_OUTPUT=$(${CURL_CMD} ${METRICS_OFF_URL}) + echo \"Metrics Off output: '\${METRICS_OFF_OUTPUT}'\"; + if [ \"\${METRICS_OFF_OUTPUT}\" != \"Stats are not enabled for this server\" ]; then + exit 1; + fi + + MOD_TILE_ON_CMD=\"${CURL_CMD} ${MOD_TILE_ON_URL}\" + MOD_TILE_ON_OUTPUT=$(\${MOD_TILE_ON_CMD}) + echo \"Mod_tile On output: \${MOD_TILE_ON_OUTPUT}\" + MOD_TILE_200=\"NoRes200Layer/tiles/${MAP_NAME}/: ${STATS_COUNTER}\" + echo \"\${MOD_TILE_200}\"; + if [[ \"\${MOD_TILE_ON_OUTPUT}\" != *\"\${MOD_TILE_200}\"* ]]; then + exit 1; + fi + MOD_TILE_OFF_OUTPUT=$(${CURL_CMD} ${MOD_TILE_OFF_URL}) + echo \"Mod_tile Off output: '\${MOD_TILE_OFF_OUTPUT}'\"; + if [ \"\${MOD_TILE_OFF_OUTPUT}\" != \"Stats are not enabled for this server\" ]; then + exit 1; + fi + " + WORKING_DIRECTORY tests + ) + set_tests_properties(stats_urls_${MAP_NAME}_${STORAGE_BACKEND} PROPERTIES + FIXTURES_REQUIRED "services_started_${STORAGE_BACKEND};tiles_downloaded_${STORAGE_BACKEND}" + ) endforeach() + # Generate file and URL paths for tiles set(TILE_FILE_NAME "tile.add_tile_config.${STORAGE_BACKEND}") set(TILE_URL_PATH "/download_add_tile_config/${TILE_ZXY}.png") + # Generate tile URLs set(HTTPD0_URL "http://${HTTPD0_HOST}:${HTTPD0_PORT}${TILE_URL_PATH}") + set(HTTPD1_URL "http://${HTTPD1_HOST}:${HTTPD1_PORT}${TILE_URL_PATH}") add_good_tile_download_test( add_tile_config_${STORAGE_BACKEND}_0 ${HTTPD0_URL} @@ -592,7 +639,6 @@ foreach(STORAGE_BACKEND_INDEX RANGE ${STORAGE_BACKENDS_LENGTH}) tiles_downloaded_${STORAGE_BACKEND} services_started_${STORAGE_BACKEND} ) - set(HTTPD1_URL "http://${HTTPD1_HOST}:${HTTPD1_PORT}${TILE_URL_PATH}") add_good_tile_download_test( add_tile_config_${STORAGE_BACKEND}_1 ${HTTPD1_URL} @@ -601,48 +647,10 @@ foreach(STORAGE_BACKEND_INDEX RANGE ${STORAGE_BACKENDS_LENGTH}) services_started_${STORAGE_BACKEND} ) - add_test( - NAME stats_urls_${STORAGE_BACKEND} - COMMAND ${BASH} -c " - METRICS_ON_CMD=\"${CURL_CMD} ${METRICS_ON_URL}\" - METRICS_ON_OUTPUT=$(\${METRICS_ON_CMD}) - echo \"Metrics On output: \${METRICS_ON_OUTPUT}\" - MOD_TILE_ON_CMD=\"${CURL_CMD} ${MOD_TILE_ON_URL}\" - MOD_TILE_ON_OUTPUT=$(\${MOD_TILE_ON_CMD}) - echo \"Mod_tile On output: \${MOD_TILE_ON_OUTPUT}\" - for LAYER in ${MAP_NAMES_STR}; do - METRICS_LAYER_200=\"modtile_layer_responses_total{layer=\\\"/tiles/\${LAYER}/\\\",status=\\\"200\\\"} 1\" - echo \"\${METRICS_LAYER_200}\"; - if [[ \"\${METRICS_ON_OUTPUT}\" != *\"\${METRICS_LAYER_200}\"* ]]; then - exit 1; - fi - MOD_TILE_LAYER_200=\"NoRes200Layer/tiles/\${LAYER}/: 1\" - echo \"\${MOD_TILE_LAYER_200}\"; - if [[ \"\${MOD_TILE_ON_OUTPUT}\" != *\"\${MOD_TILE_LAYER_200}\"* ]]; then - exit 1; - fi - done - METRICS_OFF_OUTPUT=$(${CURL_CMD} ${METRICS_OFF_URL}) - echo \"Metrics Off output: '\${METRICS_OFF_OUTPUT}'\"; - if [ \"\${METRICS_OFF_OUTPUT}\" != \"Stats are not enabled for this server\" ]; then - exit 1; - fi - MOD_TILE_OFF_OUTPUT=$(${CURL_CMD} ${MOD_TILE_OFF_URL}) - echo \"Mod_tile Off output: '\${MOD_TILE_OFF_OUTPUT}'\"; - if [ \"\${MOD_TILE_OFF_OUTPUT}\" != \"Stats are not enabled for this server\" ]; then - exit 1; - fi - " - WORKING_DIRECTORY tests - ) - set_tests_properties(stats_urls_${STORAGE_BACKEND} PROPERTIES - FIXTURES_REQUIRED "services_started_${STORAGE_BACKEND};tiles_downloaded_${STORAGE_BACKEND}" - ) if(NOT PROCESSOR_COUNT EQUAL 0) # Set CTEST_NUM_SLAVE_THREADS to 5 (renderd1 = 1, renderd2 = 4 [NUM_THREADS]) set(CTEST_NUM_SLAVE_THREADS 5) - add_test( - NAME renderd_num_threads_${STORAGE_BACKEND} + add_test(NAME renderd_num_threads_${STORAGE_BACKEND} COMMAND ${BASH} -c " if ! ${GREP_EXECUTABLE} -q \"renderd: num_threads = '${PROCESSOR_COUNT}'\" \"${RENDERD0_LOG}\"; then ${GREP_EXECUTABLE} \"renderd: num_threads = \" \"${RENDERD0_LOG}\" @@ -660,13 +668,12 @@ foreach(STORAGE_BACKEND_INDEX RANGE ${STORAGE_BACKENDS_LENGTH}) REQUIRED_FILES ${RENDERD0_LOG} ) endif() - add_test( - NAME stop_services_${STORAGE_BACKEND} + add_test(NAME stop_services_${STORAGE_BACKEND} COMMAND ${BASH} -c " for SERVICE_PID_FILE in ${TEST_RUN_DIR}/*.pid; do ${KILL_EXECUTABLE} $(${CAT_EXECUTABLE} \${SERVICE_PID_FILE}); ${RM} \${SERVICE_PID_FILE}; - sleep 1; + ${SLEEP_EXECUTABLE} 1; done " WORKING_DIRECTORY tests @@ -674,8 +681,7 @@ foreach(STORAGE_BACKEND_INDEX RANGE ${STORAGE_BACKENDS_LENGTH}) set_tests_properties(stop_services_${STORAGE_BACKEND} PROPERTIES FIXTURES_CLEANUP services_started_${STORAGE_BACKEND} ) - add_test( - NAME clear_dirs_${STORAGE_BACKEND} + add_test(NAME clear_dirs_${STORAGE_BACKEND} COMMAND ${BASH} -c " ${RM} -f -r -v \ ${TEST_LOGS_DIR}/* \ @@ -691,9 +697,12 @@ foreach(STORAGE_BACKEND_INDEX RANGE ${STORAGE_BACKENDS_LENGTH}) ) if(STORAGE_BACKEND STREQUAL file) + # Generate file and URL paths for tiles set(TILE_FILE_NAME "tile.parameterization.${STORAGE_BACKEND}") set(TILE_URL_PATH "/tiles/parameterization/en,de,_/${TILE_ZXY}.png") + # Generate tile URLs set(HTTPD0_URL "http://${HTTPD0_HOST}:${HTTPD0_PORT}${TILE_URL_PATH}") + set(HTTPD1_URL "http://${HTTPD1_HOST}:${HTTPD1_PORT}${TILE_URL_PATH}") add_good_tile_download_test( parameterization_${STORAGE_BACKEND}_0 ${HTTPD0_URL} @@ -701,7 +710,6 @@ foreach(STORAGE_BACKEND_INDEX RANGE ${STORAGE_BACKENDS_LENGTH}) tiles_downloaded_${STORAGE_BACKEND} services_started_${STORAGE_BACKEND} ) - set(HTTPD1_URL "http://${HTTPD1_HOST}:${HTTPD1_PORT}${TILE_URL_PATH}") add_good_tile_download_test( parameterization_${STORAGE_BACKEND}_1 ${HTTPD1_URL} @@ -709,11 +717,117 @@ foreach(STORAGE_BACKEND_INDEX RANGE ${STORAGE_BACKENDS_LENGTH}) tiles_downloaded_${STORAGE_BACKEND} services_started_${STORAGE_BACKEND} ) + + # Generate file and URL paths for tiles + set(TILE_FILE_NAME "tile.htcp.${STORAGE_BACKEND}") + set(TILE_URL_PATH "/tiles/htcp/${TILE_ZXY}.png") + # Generate tile URLs + set(HTTPD0_URL "http://${HTTPD0_HOST}:${HTTPD0_PORT}${TILE_URL_PATH}") + set(HTTPD1_URL "http://${HTTPD1_HOST}:${HTTPD1_PORT}${TILE_URL_PATH}") + add_good_tile_download_test( + htcp_${STORAGE_BACKEND}_0 + ${HTTPD0_URL} + ${TILE_FILE_NAME}.0 + tiles_downloaded_${STORAGE_BACKEND} + services_started_${STORAGE_BACKEND} + ) + add_good_tile_download_test( + htcp_${STORAGE_BACKEND}_1 + ${HTTPD1_URL} + ${TILE_FILE_NAME}.1 + tiles_downloaded_${STORAGE_BACKEND} + services_started_${STORAGE_BACKEND} + ) + + # Generate URL path for tiles + set(TILE_URL_PATH "/tiles/cors_all/${TILE_ZXY}.png") + # Generate tile URLs + set(HTTPD0_URL "http://${HTTPD0_HOST}:${HTTPD0_PORT}${TILE_URL_PATH}") + set(HTTPD1_URL "http://${HTTPD1_HOST}:${HTTPD1_PORT}${TILE_URL_PATH}") + add_test(NAME cors_all_${STORAGE_BACKEND} + COMMAND ${BASH} -c " + RESPONSE_CODE_CMD=\"${CURL_CMD} --write-out %{http_code} --output /dev/null\" + RESPONSE_CODE=$(\${RESPONSE_CODE_CMD} ${HTTPD0_URL}) + echo \"Response code: '\${RESPONSE_CODE}'\" + if [ \"\${RESPONSE_CODE}\" != \"200\" ]; then + exit 1; + fi + RESPONSE_CODE=$(\${RESPONSE_CODE_CMD} ${HTTPD1_URL}) + echo \"Response code: '\${RESPONSE_CODE}'\" + if [ \"\${RESPONSE_CODE}\" != \"200\" ]; then + exit 1; + fi + RESPONSE_CODE=$(\${RESPONSE_CODE_CMD} --header \"Origin: example.com\" ${HTTPD0_URL}) + echo \"Response code: '\${RESPONSE_CODE}'\" + if [ \"\${RESPONSE_CODE}\" != \"200\" ]; then + exit 1; + fi + RESPONSE_CODE=$(\${RESPONSE_CODE_CMD} --header \"Origin: example.com\" ${HTTPD1_URL}) + echo \"Response code: '\${RESPONSE_CODE}'\" + if [ \"\${RESPONSE_CODE}\" != \"200\" ]; then + exit 1; + fi + " + ) + set_tests_properties(cors_all_${STORAGE_BACKEND} PROPERTIES + FIXTURES_REQUIRED services_started_${STORAGE_BACKEND} + ) + + # Generate URL path for tiles + set(TILE_URL_PATH "/tiles/cors_localhost/${TILE_ZXY}.png") + # Generate tile URLs + set(HTTPD0_URL "http://${HTTPD0_HOST}:${HTTPD0_PORT}${TILE_URL_PATH}") + set(HTTPD1_URL "http://${HTTPD1_HOST}:${HTTPD1_PORT}${TILE_URL_PATH}") + add_test(NAME cors_localhost_${STORAGE_BACKEND} + COMMAND ${BASH} -c " + RESPONSE_CODE_CMD=\"${CURL_CMD} --write-out %{http_code}\" + RESPONSE_CODE=$(\${RESPONSE_CODE_CMD} --header \"Origin: notlocalhost\" ${HTTPD0_URL}) + echo \"Response code: '\${RESPONSE_CODE}'\" + if [ \"\${RESPONSE_CODE}\" != \"403\" ]; then + exit 1; + fi + RESPONSE_CODE=$(\${RESPONSE_CODE_CMD} --header \"Origin: notlocalhost\" ${HTTPD1_URL}) + echo \"Response code: '\${RESPONSE_CODE}'\" + if [ \"\${RESPONSE_CODE}\" != \"403\" ]; then + exit 1; + fi + RESPONSE_CODE=$(\${RESPONSE_CODE_CMD} --header \"Origin: localhost\" ${HTTPD0_URL}) + echo \"Response code: '\${RESPONSE_CODE}'\" + if [ \"\${RESPONSE_CODE}\" = \"403\" ]; then + exit 1; + fi + RESPONSE_CODE=$(\${RESPONSE_CODE_CMD} --header \"Origin: localhost\" ${HTTPD1_URL}) + echo \"Response code: '\${RESPONSE_CODE}'\" + if [ \"\${RESPONSE_CODE}\" = \"403\" ]; then + exit 1; + fi + " + ) + set_tests_properties(cors_localhost_${STORAGE_BACKEND} PROPERTIES + FIXTURES_REQUIRED services_started_${STORAGE_BACKEND} + ) + + # Generate URL path for tiles + set(TILE_URL_PATH "/tiles/png256/18/16125/115188.png") + # Generate tile URL + set(HTTPD2_URL "http://${HTTPD2_HOST}:${HTTPD2_PORT}${TILE_URL_PATH}") + add_test(NAME max_load_missing_${STORAGE_BACKEND} + COMMAND ${BASH} -c " + RESPONSE_CODE_CMD=\"${CURL_CMD} --write-out %{http_code}\" + RESPONSE_CODE=$(\${RESPONSE_CODE_CMD} ${HTTPD2_URL}) + echo \"Response code: '\${RESPONSE_CODE}'\" + if [ \"\${RESPONSE_CODE}\" != \"404\" ]; then + exit 1; + fi + " + ) + set_tests_properties(max_load_missing_${STORAGE_BACKEND} PROPERTIES + FIXTURES_REQUIRED services_started_${STORAGE_BACKEND} + ) endif() if(JQ_EXECUTABLE) - add_test( - NAME tilejson_url_${STORAGE_BACKEND} + add_test(NAME tilejson_url_${STORAGE_BACKEND} COMMAND ${BASH} -c " TILE_DEFAULT_TILEJSON_CMD=\"${CURL_CMD} ${TILE_DEFAULT_TILEJSON_URL}\" TILE_DEFAULT_TILEJSON_OUTPUT=$(\${TILE_DEFAULT_TILEJSON_CMD}) @@ -745,15 +859,63 @@ endforeach() # Test mal-formed HTTPD configuration directives set(DIRECTIVES "AddTileConfig" - "AddTileConfig /bad/" + "AddTileConfig string" + "AddTileConfig string string maxzoom=100" "LoadTileConfigFile" "LoadTileConfigFile /tmp/bad/file/name" + "ModTileCacheDurationDirty string" + "ModTileCacheDurationLowZoom 1 string" + "ModTileCacheDurationLowZoom string 1" + "ModTileCacheDurationMax string" + "ModTileCacheDurationMediumZoom 1 string" + "ModTileCacheDurationMediumZoom string 1" + "ModTileCacheDurationMinimum string" + "ModTileCacheExtendedDuration string" + "ModTileCacheLastModifiedFactor string" + "ModTileEnableTileThrottlingXForward -1" + "ModTileEnableTileThrottlingXForward 3" + "ModTileEnableTileThrottlingXForward string" + "ModTileMaxLoadMissing string" + "ModTileMaxLoadOld string" + "ModTileMissingRequestTimeout string" + "ModTileRenderdSocketAddr string string" + "ModTileRequestTimeout string" + "ModTileThrottlingRenders 1 string" + "ModTileThrottlingRenders string 1" + "ModTileThrottlingTiles 1 string" + "ModTileThrottlingTiles string 1" + "ModTileVeryOldThreshold string" ) set(DIRECTIVE_ERRORS "AddTileConfig error, URL path not defined" "AddTileConfig error, name of renderd config not defined" + "The configured zoom level lies outside of the range supported by this server" "LoadTileConfigFile takes one argument, load an entire renderd config file" - "Unable to open config file" + "LoadTileConfigFile error, unable to open config file" + "ModTileCacheDurationDirty needs integer argument" + "ModTileCacheDurationLowZoom needs integer argument" + "ModTileCacheDurationLowZoom needs integer argument" + "ModTileCacheDurationMax needs integer argument" + "ModTileCacheDurationMediumZoom needs integer argument" + "ModTileCacheDurationMediumZoom needs integer argument" + "ModTileCacheDurationMinimum needs integer argument" + "ModTileCacheExtendedDuration needs integer argument" + "ModTileCacheLastModifiedFactor needs float argument" + "ModTileEnableTileThrottlingXForward needs integer argument between 0 and 2 (0 => off\; + 1 => use client\; 2 => use last entry in chain" + "ModTileEnableTileThrottlingXForward needs integer argument between 0 and 2 (0 => off\; + 1 => use client\; 2 => use last entry in chain" + "ModTileEnableTileThrottlingXForward needs integer argument between 0 and 2" + "ModTileMaxLoadMissing needs integer argument" + "ModTileMaxLoadOld needs integer argument" + "ModTileMissingRequestTimeout needs integer argument" + "ModTileRenderdSocketAddr TCP port needs to be an integer argument" + "ModTileRequestTimeout needs integer argument" + "ModTileThrottlingRenders needs two numerical arguments, the first one must be integer" + "ModTileThrottlingRenders needs two numerical arguments, the first one must be integer" + "ModTileThrottlingTiles needs two numerical arguments, the first one must be integer" + "ModTileThrottlingTiles needs two numerical arguments, the first one must be integer" + "ModTileVeryOldThreshold needs integer argument" ) list(LENGTH DIRECTIVES DIRECTIVES_LENGTH) math(EXPR DIRECTIVES_LENGTH "${DIRECTIVES_LENGTH} - 1") @@ -766,13 +928,9 @@ foreach(DIRECTIVE_INDEX RANGE ${DIRECTIVES_LENGTH}) list(GET DIRECTIVE_ERRORS ${DIRECTIVE_INDEX} DIRECTIVE_ERROR) # Generate httpd.conf file - configure_file( - httpd.conf.in - ${HTTPD_CONF} - ) + configure_file(httpd.conf.in ${HTTPD_CONF}) - add_test( - NAME bad_httpd_config_${DIRECTIVE_INDEX} + add_test(NAME bad_httpd_config_${DIRECTIVE_INDEX} COMMAND ${BASH} -c " HTTPD_OUTPUT=$(${HTTPD_EXECUTABLE} -e debug -f ${HTTPD_CONF} -t 2>&1) if [ \"\${?}\" -eq \"0\" ]; then diff --git a/tests/httpd.conf.in b/tests/httpd.conf.in index f65dffc0..1b9ee013 100644 --- a/tests/httpd.conf.in +++ b/tests/httpd.conf.in @@ -32,8 +32,6 @@ Redirect /renderd-example-map/leaflet/leaflet.min.js https://unpkg.com/leaflet/d ModTileEnableStatusURL On ModTileEnableTileThrottling Off ModTileEnableTileThrottlingXForward 0 - ModTileMaxLoadMissing 5 - ModTileMaxLoadOld 2 ModTileMissingRequestTimeout 2 ModTileRenderdSocketName @RENDERD0_SOCKET@ ModTileRequestTimeout 3 @@ -60,8 +58,6 @@ Redirect /renderd-example-map/leaflet/leaflet.min.js https://unpkg.com/leaflet/d ModTileEnableStatusURL Off ModTileEnableTileThrottling Off ModTileEnableTileThrottlingXForward 0 - ModTileMaxLoadMissing 5 - ModTileMaxLoadOld 2 ModTileMissingRequestTimeout 3 ModTileRenderdSocketAddr @RENDERD1_HOST@ @RENDERD1_PORT@ ModTileRequestTimeout 3 @@ -70,11 +66,36 @@ Redirect /renderd-example-map/leaflet/leaflet.min.js https://unpkg.com/leaflet/d ModTileTileDir @TILE_DIR@ + + LoadTileConfigFile @RENDERD_CONF@ + ModTileBulkMode Off + ModTileCacheDurationDirty 900 + ModTileCacheDurationLowZoom 9 518400 + ModTileCacheDurationMax 604800 + ModTileCacheDurationMediumZoom 13 86400 + ModTileCacheDurationMinimum 10800 + ModTileCacheLastModifiedFactor 0.20 + ModTileEnableDirtyURL Off + ModTileEnableStats Off + ModTileEnableStatusURL Off + ModTileEnableTileThrottling Off + ModTileEnableTileThrottlingXForward 0 + ModTileMaxLoadMissing 0 + ModTileMaxLoadOld 0 + ModTileMissingRequestTimeout 3 + ModTileRenderdSocketName @RENDERD2_SOCKET@ + ModTileRequestTimeout 3 + ModTileThrottlingRenders 128 0.2 + ModTileThrottlingTiles 10000 1 + ModTileTileDir @TILE_DIR@ + + CustomLog @HTTPD_LOG_ACCESS@ "%A:%p %t \"%r\" %>s %b" ErrorLog @HTTPD_LOG_ERROR@ Group @WWW_GROUP_NAME@ Listen @HTTPD0_HOST@:@HTTPD0_PORT@ Listen @HTTPD1_HOST@:@HTTPD1_PORT@ +Listen @HTTPD2_HOST@:@HTTPD2_PORT@ LogLevel debug PidFile @HTTPD_PID@ ServerName localhost diff --git a/tests/renderd.conf.in b/tests/renderd.conf.in index 5531b676..d1e774c9 100644 --- a/tests/renderd.conf.in +++ b/tests/renderd.conf.in @@ -1,10 +1,12 @@ -# Test comment 1 -; Test comment 2 +# Test Comment: Mapnik Section +; Test Comment: Mapnik Section [mapnik] font_dir=@MAPNIK_FONTS_DIR@ font_dir_recurse=@MAPNIK_FONTS_DIR_RECURSE@ plugins_dir=@MAPNIK_PLUGINS_DIR@ +# Test Comment: Default Map Section +; Test Comment: Default Map Section [@DEFAULT_MAP_NAME@] ATTRIBUTION=Attribution for @DEFAULT_MAP_NAME@ DESCRIPTION=Description for @DEFAULT_MAP_NAME@ @@ -14,10 +16,27 @@ TILEDIR=@TILE_DIR@ URI=/tiles/@DEFAULT_MAP_NAME@/ XML=@PROJECT_SOURCE_DIR@/utils/example-map/mapnik.xml +# Test Comment: CORS all (*) Map Section +; Test Comment: CORS all (*) Map Section +[@DEFAULT_MAP_NAME@_cors_all] +CORS=* +TILEDIR=@TILE_DIR@ +URI=/tiles/cors_all/ +XML=@PROJECT_SOURCE_DIR@/utils/example-map/mapnik.xml + +# Test Comment: CORS localhost Map Section +; Test Comment: CORS localhost Map Section +[@DEFAULT_MAP_NAME@_cors_localhost] +CORS=localhost +TILEDIR=@TILE_DIR@ +URI=/tiles/cors_localhost/ +XML=@PROJECT_SOURCE_DIR@/utils/example-map/mapnik.xml + +# Test Comment: HTCP/etc Map Section +; Test Comment: HTCP/etc Map Section [@DEFAULT_MAP_NAME@_htcp] ASPECTX=1 ASPECTY=1 -CORS=* HOST=@HTTPD0_HOST@ HTCPHOST=@HTTPD1_HOST@ MAXZOOM=20 @@ -29,36 +48,48 @@ TILESIZE=256 URI=/tiles/htcp/ XML=@PROJECT_SOURCE_DIR@/utils/example-map/mapnik.xml +# Test Comment: Parameterization Map Section +; Test Comment: Parameterization Map Section [@DEFAULT_MAP_NAME@_parameterization] PARAMETERIZE_STYLE=language TILEDIR=@TILE_DIR@ URI=/tiles/parameterization/ XML=@PROJECT_SOURCE_DIR@/utils/example-map/mapnik.xml +# Test Comment: JPEG Map Section +; Test Comment: JPEG Map Section [jpg] TILEDIR=@TILE_DIR@ TYPE=jpg image/jpeg jpeg URI=/tiles/jpg/ XML=@PROJECT_SOURCE_DIR@/utils/example-map/mapnik.xml +# Test Comment: PNG8/PNG256 Map Section +; Test Comment: PNG8/PNG256 Map Section [png256] TILEDIR=@TILE_DIR@ TYPE=png image/png png256 URI=/tiles/png256/ XML=@PROJECT_SOURCE_DIR@/utils/example-map/mapnik.xml +# Test Comment: PNG32 Map Section +; Test Comment: PNG32 Map Section [png32] TILEDIR=@TILE_DIR@ TYPE=png image/png png32 URI=/tiles/png32/ XML=@PROJECT_SOURCE_DIR@/utils/example-map/mapnik.xml +# Test Comment: WEBP Map Section +; Test Comment: WEBP Map Section [webp] TILEDIR=@TILE_DIR@ TYPE=webp image/webp webp URI=/tiles/webp/ XML=@PROJECT_SOURCE_DIR@/utils/example-map/mapnik.xml +# Test Comment: Renderd Section 1 +; Test Comment: Renderd Section 1 [renderd1] iphostname=@RENDERD1_HOST@ ipport=@RENDERD1_PORT@ @@ -67,6 +98,8 @@ pid_file=@RENDERD1_PID@ stats_file=@TEST_RUN_DIR@/renderd1_@STORAGE_BACKEND@.stats tile_dir=@TILE_DIR@ +# Test Comment: Renderd Section 0 +; Test Comment: Renderd Section 0 [renderd] num_threads=-1 pid_file=@RENDERD0_PID@ @@ -74,6 +107,8 @@ socketname=@RENDERD0_SOCKET@ stats_file=@TEST_RUN_DIR@/renderd0_@STORAGE_BACKEND@.stats tile_dir=@TILE_DIR@ +# Test Comment: Renderd Section 2 +; Test Comment: Renderd Section 2 [renderd2] pid_file=@RENDERD2_PID@ socketname=@RENDERD2_SOCKET@ diff --git a/tests/tiles.sha256sum b/tests/tiles.sha256sum index c1557752..3f9905fc 100644 --- a/tests/tiles.sha256sum +++ b/tests/tiles.sha256sum @@ -5,6 +5,8 @@ 1006d92152f1e18896e0016fb43201b14bbcf7655955b74495ad3610541d325b tile.png32.memcached_custom.1 1006d92152f1e18896e0016fb43201b14bbcf7655955b74495ad3610541d325b tile.png32.memcached_default.0 1006d92152f1e18896e0016fb43201b14bbcf7655955b74495ad3610541d325b tile.png32.memcached_default.1 +dbf26531286e844a3a9735cdd193598dca78d22f77cafe5824bcaf17f88cbb08 tile.htcp.file.0 +dbf26531286e844a3a9735cdd193598dca78d22f77cafe5824bcaf17f88cbb08 tile.htcp.file.1 dbf26531286e844a3a9735cdd193598dca78d22f77cafe5824bcaf17f88cbb08 tile.add_tile_config.file.0 dbf26531286e844a3a9735cdd193598dca78d22f77cafe5824bcaf17f88cbb08 tile.add_tile_config.file.1 dbf26531286e844a3a9735cdd193598dca78d22f77cafe5824bcaf17f88cbb08 tile.add_tile_config.memcached_custom.0 @@ -26,6 +28,8 @@ dbf26531286e844a3a9735cdd193598dca78d22f77cafe5824bcaf17f88cbb08 tile.png256.me 0831784a1bf32917d10763efaca9a1ebb3af55180ff9a5d6a99731bbc9c9b591 tile.png32.memcached_custom.1 0831784a1bf32917d10763efaca9a1ebb3af55180ff9a5d6a99731bbc9c9b591 tile.png32.memcached_default.0 0831784a1bf32917d10763efaca9a1ebb3af55180ff9a5d6a99731bbc9c9b591 tile.png32.memcached_default.1 +f3e505417c5ab18a7dae0827a0c915905c412bad486497b2a0fb4efffd19d420 tile.htcp.file.0 +f3e505417c5ab18a7dae0827a0c915905c412bad486497b2a0fb4efffd19d420 tile.htcp.file.1 f3e505417c5ab18a7dae0827a0c915905c412bad486497b2a0fb4efffd19d420 tile.add_tile_config.file.0 f3e505417c5ab18a7dae0827a0c915905c412bad486497b2a0fb4efffd19d420 tile.add_tile_config.file.1 f3e505417c5ab18a7dae0827a0c915905c412bad486497b2a0fb4efffd19d420 tile.add_tile_config.memcached_custom.0