martin/justfile
Yuri Astrakhan a0a411f088
Consolidate DB init and tests (#463)
* Add justfile to simplify running all the tests
* Save all PBF outputs to the text files
* Consolidate all tests to reuse the same code
* Consolidate database initialization
* updated readme with the new instructions

Note that while this PR creates "expected" files, the CI cannot validate
the generated results because the output is not stable. Eventually we
may try to output just the non-geometry values to have reasonable tests
comparing against the expected results.
2022-10-28 14:52:39 -04:00

55 lines
1.1 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_BACKTRACE := "1"
@_default:
just --list
# Start Martin server and a test database
run: start-db
cargo run
# Perform cargo clean to delete all build files
clean: clean-test
cargo clean
# Delete test output files
clean-test:
rm -rf tests/output
# Start a test database
start-db:
docker-compose up -d db
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: start-db test-unit test-int
# Run Rust unit tests (cargo test)
test-unit: start-db
cargo test
# Run integration tests
test-int: start-db clean-test
tests/test.sh
diff --brief --recursive --new-file tests/output tests/expected
# Run integration tests and save its output as the new expected output
test-bless: start-db clean-test
tests/test.sh
rm -rf tests/expected
mv tests/output tests/expected