mirror of
https://github.com/maplibre/martin.git
synced 2024-12-20 21:31:49 +03:00
2ee517d135
Can now handle several additional Postgres functions to get a tile, plus tons of small fixes ### Multiple result variants * `getmvt(z,x,y) -> [bytea,md5]` (single row with two columns) * `getmvt(z,x,y) -> [bytea]` (single row with a single column) * `getmvt(z,x,y) -> bytea` (value) ### Multiple input parameter variants * `getmvt(z, x, y)` or `getmvt(zoom, x, y)` (all 3 vars must be integers) * `getmvt(z, x, y, url_query)`, where instead of `url_query` it could be any other name, but must be of type JSON ### Breaking * srid is now the same type as PG -- `i32` * renamed config vals `table_sources` and `function_sources` into `tables` and `functions` ### Features and fixes * if postgis is v3.1+, uses margin parameter to extend the search box by the size of the buffer. I think we should make 3.1 minimal required. * fixes feature ID issue from #466 * fixes mixed case names for schemas, tables and columns, functions and parameter names per #389 ### Notes * More dynamic SQL generation in code instead of using external SQL files. Those should only be used when they are not parametrized. * The new function/table discovery mechanism: query for all functions in the database, and match up those functions with the ones configured (if any), plus adds all the rest of the un-declared ones if discovery mode is on. * During table and function discovery, the code generates a map of `(PgSqlInfo, FunctionInfo)` (or table) tupples containing SQL needed to get the tile. * Auto-discovery mode is currently hidden - the discovery is on only when no tables or functions are configured. TBD - how to configure it in the future * The new system allows for an easy way to auto-discover for the specific schemas only, solving #47 * predictable order of table/function instantiation * bounding boxes computed in parallel for all tables (when not configured) * proper identifier escaping * test cleanup fixes #378 fixes #466 fixes #65 fixes #389
107 lines
2.9 KiB
Makefile
107 lines
2.9 KiB
Makefile
#!/usr/bin/env just --justfile
|
|
set shell := ["bash", "-c"]
|
|
|
|
export DATABASE_URL := "postgres://postgres@localhost/db"
|
|
export CARGO_TERM_COLOR := "always"
|
|
# export RUST_LOG := "debug"
|
|
# export RUST_BACKTRACE := "1"
|
|
|
|
@_default:
|
|
just --list --unsorted
|
|
|
|
# Start Martin server and a test database
|
|
run *ARGS: start-db
|
|
cargo run -- {{ARGS}}
|
|
|
|
# Start Martin server and open a test page
|
|
debug-page *ARGS: start-db
|
|
open tests/debug.html # run will not exit, so open debug page first
|
|
just run {{ARGS}}
|
|
|
|
# Run PSQL utility against the test database
|
|
psql *ARGS: start-db
|
|
psql {{ARGS}} {{DATABASE_URL}}
|
|
|
|
# Perform cargo clean to delete all build files
|
|
clean: clean-test stop
|
|
cargo clean
|
|
|
|
# Delete test output files
|
|
clean-test:
|
|
rm -rf tests/output
|
|
|
|
# Start a test database
|
|
start-db: (docker-up "db")
|
|
|
|
# Start a legacy test database
|
|
start-legacy: (docker-up "db-legacy")
|
|
|
|
# Start a specific test database, e.g. db or db-legacy
|
|
@docker-up name:
|
|
docker-compose up -d {{name}}
|
|
|
|
alias _down := stop
|
|
alias _stop-db := stop
|
|
|
|
# Stop the test database
|
|
stop:
|
|
docker-compose down
|
|
|
|
# Run benchmark tests
|
|
bench: start-db
|
|
cargo bench
|
|
|
|
# Run all tests using a test database
|
|
test: test-unit test-int
|
|
|
|
# Run Rust unit and doc tests (cargo test)
|
|
test-unit *ARGS: start-db
|
|
cargo test --all-targets {{ARGS}}
|
|
cargo test --all-targets --all-features {{ARGS}}
|
|
cargo test --doc
|
|
|
|
# Run integration tests
|
|
test-int: (test-integration "db")
|
|
|
|
# Run integration tests using legacy database
|
|
test-int-legacy: (test-integration "db-legacy")
|
|
|
|
# Run integration tests with the given docker compose target
|
|
@test-integration name: (docker-up name) clean-test
|
|
#!/usr/bin/env sh
|
|
tests/test.sh
|
|
# echo "** Skipping comparison with the expected values - not yet stable"
|
|
# if ( ! diff --brief --recursive --new-file tests/output tests/expected ); then
|
|
# echo "** Expected output does not match actual output"
|
|
# echo "** If this is expected, run 'just bless' to update expected output"
|
|
# echo "** Note that this error is not fatal because we don't have a stable output yet"
|
|
# fi
|
|
|
|
# # Run integration tests and save its output as the new expected output
|
|
# bless: start-db clean-test
|
|
# tests/test.sh
|
|
# rm -rf tests/expected
|
|
# mv tests/output tests/expected
|
|
|
|
# Build martin docker image
|
|
docker-build:
|
|
docker build -t martin .
|
|
|
|
# Build and run martin docker image
|
|
docker-run *ARGS:
|
|
docker run -it --rm --net host -e DATABASE_URL -v $PWD/tests:/tests martin {{ARGS}}
|
|
|
|
# Do any git command, ensuring that the testing environment is set up. Accepts the same arguments as git.
|
|
[no-exit-message]
|
|
git *ARGS: start-db
|
|
git {{ARGS}}
|
|
|
|
# These steps automatically run before git push via a git hook
|
|
git-pre-push: stop start-db
|
|
echo '+cargo clippy --all -- -D warnings'
|
|
cargo clippy --all -- -D warnings
|
|
echo '+cargo fmt --all -- --check'
|
|
cargo fmt --all -- --check
|
|
echo 'Running all tests'
|
|
just test
|