From 7f531c1dbb7e2e64d1b5b26194423a319b5f548f Mon Sep 17 00:00:00 2001 From: zstadler Date: Tue, 16 Nov 2021 08:58:16 +0200 Subject: [PATCH] Update "Verifying that updates still work" (#1290) Convert the instructions into a single script that anyone can copy-paste to a terminal. Add `make destroy-db` to the initialization part. --- CONTRIBUTING.md | 39 ++++++++++++++++++++++++++------------- 1 file changed, 26 insertions(+), 13 deletions(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 15d3844a..3c4b31f4 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -46,30 +46,43 @@ When you are making PR that adds new spatial features to OpenMapTiles schema, pl It is recommended that you create a [unit test](TESTING.md) when modifying the behavior of the SQL layer. This will ensure that your changes are working as expected when importing or updating OSM data into an OpenMapTiles database. -To run the unit tests, run `make clean destroy-db && make test-sql` - # Verifying that updates still work -When testing a PR, you shoud also verify that the update process completes without error. The following procedure will run the update process. +When testing a PR, you should also verify that the update process completes without an error. Please modify, if necessary, and run the script below. -1. Change .env to set `DIFF_MODE=true`. In addition, if you're testing changes that impact zooms higher than the default zoom of 7, you should also change `MAX_ZOOM` to be up to 14. -2. Set the test area to the appropriate geofabrik extract, for example: +**Note:** + +The verification requires the script to append temporary changes to the `.env` file. Please restore the original version from git using `git checkout .env` or remove these changes before submitting a PR. ``` +( +set -e + +cat >> .env << EOM + +# temporary changes for verifying that updates still work +# Ensure DIFF_MODE is active +DIFF_MODE=true +# Ensure all zoom levels are tested +MAX_ZOOM=14 +EOM + +# Set the test area to the appropriate geofabrik extract export area=north-america/us/indiana -``` -3. Build 1-month-old tiles: - -``` +# Build 1-month-old tiles rm -fr data build cache +make destroy-db make download-geofabrik area=$area -docker-compose run --rm --user=$(id -u):$(id -g) openmaptiles-tools sh -c "wget -O data/$area.osm.pbf http://download.geofabrik.de/$area-$(date --date="$(date +%Y-%m-15) -1 month" +'%y%m01').osm.pbf" +docker-compose run --rm --user=$(id -u):$(id -g) openmaptiles-tools sh -c "wget -nv -O data/$area.osm.pbf http://download.geofabrik.de/$area-$(date --date="$(date +%Y-%m-15) -1 month" +'%y%m01').osm.pbf" ./quickstart.sh $area -``` -4. Update with the changes since then: -``` +cat << EOM + +# Update with the changes since a month+ ago + +EOM docker-compose run --rm --user=$(id -u):$(id -g) openmaptiles-tools sh -c "osmupdate --base-url=$(sed -n 's/ *\"replication_url\": //p' data/$area.repl.json) data/$area.osm.pbf data/changes.osc.gz" make import-diff make generate-tiles-pg +) < /dev/null ```