Skip to content

Commit

Permalink
Cleaning up CTest tests (openstreetmap#393)
Browse files Browse the repository at this point in the history
* Improve service startup "tests"
* Address intermittent download test failure
  * Caused by load exceeding threshold
* Add more missing bad HTTPD config tests
* Allow for newer `libpng` with Docker tests
  * Also test more image/file types
  • Loading branch information
hummeltech authored Feb 21, 2024
1 parent 8fea58a commit c31d526
Show file tree
Hide file tree
Showing 10 changed files with 384 additions and 143 deletions.
2 changes: 2 additions & 0 deletions .github/actions/dependencies/install/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ inputs:
jq
lcov
memcached
procps
freebsd-build-dependencies:
default: >-
apache24
Expand Down Expand Up @@ -140,6 +141,7 @@ inputs:
jq
lcov
memcached
procps
rhel-mapnik-build-dependencies:
default: >-
boost-devel
Expand Down
4 changes: 4 additions & 0 deletions .github/workflows/coverage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
19 changes: 17 additions & 2 deletions .github/workflows/docker-image-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions docker/centos/stream/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
3 changes: 2 additions & 1 deletion docker/fedora/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
12 changes: 6 additions & 6 deletions src/mod_tile.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
}
Expand Down Expand Up @@ -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,
Expand All @@ -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,
Expand Down Expand Up @@ -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) {
Expand Down Expand Up @@ -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);
Expand All @@ -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;
Expand Down
Loading

0 comments on commit c31d526

Please sign in to comment.