From fe79756097fe8bcc816ffcca1c293768f37b6acd Mon Sep 17 00:00:00 2001 From: Yuri Astrakhan Date: Sun, 5 Nov 2023 21:19:29 -0500 Subject: [PATCH] Bump lock, improve test.sh --- Cargo.lock | 46 +++++++++++++++++++++++----------------------- tests/test.sh | 50 +++++++++++++++++++++++++++----------------------- 2 files changed, 50 insertions(+), 46 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index eae4c3427..71356d944 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -80,7 +80,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e01ed3140b2f8d422c68afa1ed2e85d996ea619c988ac834d255db32138655cb" dependencies = [ "quote", - "syn 2.0.38", + "syn 2.0.39", ] [[package]] @@ -194,7 +194,7 @@ dependencies = [ "actix-router", "proc-macro2", "quote", - "syn 2.0.38", + "syn 2.0.39", ] [[package]] @@ -351,7 +351,7 @@ checksum = "5fd55a5ba1179988837d24ab4c7cc8ed6efdeff578ede0416b4225a5fca35bd0" dependencies = [ "proc-macro2", "quote", - "syn 2.0.38", + "syn 2.0.39", ] [[package]] @@ -362,7 +362,7 @@ checksum = "a66537f1bb974b254c98ed142ff995236e81b9d0fe4db0575f46612cb15eb0f9" dependencies = [ "proc-macro2", "quote", - "syn 2.0.38", + "syn 2.0.39", ] [[package]] @@ -598,7 +598,7 @@ dependencies = [ "heck", "proc-macro2", "quote", - "syn 2.0.38", + "syn 2.0.39", ] [[package]] @@ -826,7 +826,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "37e366bff8cd32dd8754b0991fb66b279dc48f598c3a18914852a6673deef583" dependencies = [ "quote", - "syn 2.0.38", + "syn 2.0.39", ] [[package]] @@ -978,7 +978,7 @@ dependencies = [ "once_cell", "proc-macro2", "quote", - "syn 2.0.38", + "syn 2.0.39", ] [[package]] @@ -1260,7 +1260,7 @@ checksum = "53b153fd91e4b0147f4aced87be237c98248656bb01050b96bf3ee89220a8ddb" dependencies = [ "proc-macro2", "quote", - "syn 2.0.38", + "syn 2.0.39", ] [[package]] @@ -1644,9 +1644,9 @@ dependencies = [ [[package]] name = "libc" -version = "0.2.149" +version = "0.2.150" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a08173bc88b7955d1b3145aa561539096c421ac8debde8cbc3612ec635fee29b" +checksum = "89d92a4743f9a61002fae18374ed11e7973f530cb3a3255fb354818118b2203c" [[package]] name = "libdeflate-sys" @@ -2065,7 +2065,7 @@ dependencies = [ "regex", "regex-syntax 0.7.5", "structmeta", - "syn 2.0.38", + "syn 2.0.39", ] [[package]] @@ -2658,7 +2658,7 @@ dependencies = [ "regex", "relative-path", "rustc_version", - "syn 2.0.38", + "syn 2.0.39", "unicode-ident", ] @@ -2865,7 +2865,7 @@ checksum = "67c5609f394e5c2bd7fc51efda478004ea80ef42fee983d5c67a65e34f32c0e3" dependencies = [ "proc-macro2", "quote", - "syn 2.0.38", + "syn 2.0.39", ] [[package]] @@ -3320,7 +3320,7 @@ dependencies = [ "proc-macro2", "quote", "structmeta-derive", - "syn 2.0.38", + "syn 2.0.39", ] [[package]] @@ -3331,7 +3331,7 @@ checksum = "a60bcaff7397072dca0017d1db428e30d5002e00b6847703e2e42005c95fbe00" dependencies = [ "proc-macro2", "quote", - "syn 2.0.38", + "syn 2.0.39", ] [[package]] @@ -3375,9 +3375,9 @@ dependencies = [ [[package]] name = "syn" -version = "2.0.38" +version = "2.0.39" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e96b79aaa137db8f61e26363a0c9b47d8b4ec75da28b7d1d614c2303e232408b" +checksum = "23e78b90f2fcf45d3e842032ce32e3f2d1545ba6636271dcbf24fa306d87be7a" dependencies = [ "proc-macro2", "quote", @@ -3429,7 +3429,7 @@ checksum = "266b2e40bc00e5a6c09c3584011e08b06f123c00362c92b975ba9843aaaa14b8" dependencies = [ "proc-macro2", "quote", - "syn 2.0.38", + "syn 2.0.39", ] [[package]] @@ -3550,7 +3550,7 @@ checksum = "630bdcf245f78637c13ec01ffae6187cca34625e8c63150d424b59e55af2675e" dependencies = [ "proc-macro2", "quote", - "syn 2.0.38", + "syn 2.0.39", ] [[package]] @@ -3657,7 +3657,7 @@ checksum = "34704c8d6ebcbc939824180af020566b01a7c01f80641264eba0999f6c2b6be7" dependencies = [ "proc-macro2", "quote", - "syn 2.0.38", + "syn 2.0.39", ] [[package]] @@ -3928,7 +3928,7 @@ dependencies = [ "once_cell", "proc-macro2", "quote", - "syn 2.0.38", + "syn 2.0.39", "wasm-bindgen-shared", ] @@ -3950,7 +3950,7 @@ checksum = "c5353b8dab669f5e10f5bd76df26a9360c748f054f862ff5f3f8aae0c7fb3907" dependencies = [ "proc-macro2", "quote", - "syn 2.0.38", + "syn 2.0.39", "wasm-bindgen-backend", "wasm-bindgen-shared", ] @@ -4215,7 +4215,7 @@ checksum = "c2f140bda219a26ccc0cdb03dba58af72590c53b22642577d88a927bc5c87d6b" dependencies = [ "proc-macro2", "quote", - "syn 2.0.38", + "syn 2.0.39", ] [[package]] diff --git a/tests/test.sh b/tests/test.sh index 83a399716..9e76449d8 100755 --- a/tests/test.sh +++ b/tests/test.sh @@ -16,49 +16,54 @@ MBTILES_BIN="${MBTILES_BIN:-target/debug/mbtiles}" LOG_DIR="${LOG_DIR:-target/test_logs}" mkdir -p "$LOG_DIR" -function wait_for_martin { +function wait_for { # Seems the --retry-all-errors option is not available on older curl versions, but maybe in the future we can just use this: # timeout -k 20s 20s curl --retry 10 --retry-all-errors --retry-delay 1 -sS "$MARTIN_URL/health" PROCESS_ID=$1 - echo "Waiting for Martin ($PROCESS_ID) to start by checking $MARTIN_URL/health to be valid..." + PROC_NAME=$2 + TEST_URL=$3 + echo "Waiting for $PROC_NAME ($PROCESS_ID) to start by checking $TEST_URL to be valid..." for i in {1..60}; do - if $CURL "$MARTIN_URL/health" 2>/dev/null >/dev/null; then - echo "Martin is up!" - $CURL "$MARTIN_URL/health" + if $CURL "$TEST_URL" 2>/dev/null >/dev/null; then + echo "$PROC_NAME is up!" + if [[ "$PROC_NAME" == "Martin" ]]; then + $CURL "$TEST_URL" + fi return fi if ps -p $PROCESS_ID > /dev/null ; then - echo "Martin is not up yet, waiting for $MARTIN_URL/health ..." + echo "$PROC_NAME is not up yet, waiting for $TEST_URL ..." sleep 1 else - echo "Martin died!" + echo "$PROC_NAME died!" ps au - lsof -i || true + lsof -i || true; exit 1 fi done - echo "Martin did not start in time" + echo "$PROC_NAME did not start in time" ps au - lsof -i || true + lsof -i || true; exit 1 } function kill_process { PROCESS_ID=$1 - echo "Waiting for Martin ($PROCESS_ID) to stop..." + PROC_NAME=$2 + echo "Waiting for $PROC_NAME ($PROCESS_ID) to stop..." kill $PROCESS_ID for i in {1..50}; do if ps -p $PROCESS_ID > /dev/null ; then sleep 0.1 else - echo "Martin ($PROCESS_ID) has stopped" + echo "$PROC_NAME ($PROCESS_ID) has stopped" return fi done - echo "Martin did not stop in time, killing it" + echo "$PROC_NAME did not stop in time, killing it" kill -9 $PROCESS_ID # wait for it to die using timeout and wait - timeout -k 1s 1s wait $PROCESS_ID || true + timeout -k 1s 1s wait $PROCESS_ID || true; } test_jsn() @@ -173,11 +178,11 @@ mkdir -p "$TEST_OUT_DIR" ARG=(--default-srid 900913 --auto-bounds calc --save-config "$(dirname "$0")/output/generated_config.yaml" tests/fixtures/mbtiles tests/fixtures/pmtiles --sprite tests/fixtures/sprites/src1 --font tests/fixtures/fonts/overpass-mono-regular.ttf --font tests/fixtures/fonts) set -x $MARTIN_BIN "${ARG[@]}" 2>&1 | tee "${LOG_DIR}/test_log_1.txt" & -PROCESS_ID=`jobs -p` +MARTIN_PROC_ID=`jobs -p | tail -n 1` { set +x; } 2> /dev/null -trap "kill -9 $PROCESS_ID 2> /dev/null || true" EXIT -wait_for_martin $PROCESS_ID +trap "echo 'Stopping Martin server $MARTIN_PROC_ID...'; kill -9 $MARTIN_PROC_ID 2> /dev/null || true; echo 'Stopped Martin server $MARTIN_PROC_ID';" EXIT HUP INT TERM +wait_for $MARTIN_PROC_ID Martin "$MARTIN_URL/health" >&2 echo "Test catalog" test_jsn catalog_auto catalog @@ -246,7 +251,7 @@ test_pbf mb_mvt_2_3_1 world_cities/2/3/1 >&2 echo "***** Test server response for table source with empty SRID *****" test_pbf points_empty_srid_0_0_0 points_empty_srid/0/0/0 -kill_process $PROCESS_ID +kill_process $MARTIN_PROC_ID Martin validate_log "${LOG_DIR}/test_log_1.txt" @@ -258,10 +263,10 @@ mkdir -p "$TEST_OUT_DIR" ARG=(--config tests/config.yaml --max-feature-count 1000 --save-config "$(dirname "$0")/output/given_config.yaml" -W 1) set -x $MARTIN_BIN "${ARG[@]}" 2>&1 | tee "${LOG_DIR}/test_log_2.txt" & -PROCESS_ID=`jobs -p` +MARTIN_PROC_ID=`jobs -p | tail -n 1` { set +x; } 2> /dev/null -trap "kill -9 $PROCESS_ID 2> /dev/null || true" EXIT -wait_for_martin $PROCESS_ID +trap "echo 'Stopping Martin server $MARTIN_PROC_ID...'; kill -9 $MARTIN_PROC_ID 2> /dev/null || true; echo 'Stopped Martin server $MARTIN_PROC_ID';" EXIT HUP INT TERM +wait_for $MARTIN_PROC_ID Martin "$MARTIN_URL/health" >&2 echo "Test catalog" test_jsn catalog_cfg catalog @@ -289,13 +294,12 @@ test_font font_1 font/Overpass%20Mono%20Light/0-255 test_font font_2 font/Overpass%20Mono%20Regular/0-255 test_font font_3 font/Overpass%20Mono%20Regular,Overpass%20Mono%20Light/0-255 -kill_process $PROCESS_ID +kill_process $MARTIN_PROC_ID Martin validate_log "${LOG_DIR}/test_log_2.txt" remove_line "$(dirname "$0")/output/given_config.yaml" " connection_string: " remove_line "$(dirname "$0")/output/generated_config.yaml" " connection_string: " - echo "------------------------------------------------------------------------------------------------------------------------" echo "Test mbtiles utility" if [[ "$MBTILES_BIN" != "-" ]]; then