mirror of
https://github.com/azaion/satellite-provider.git
synced 2026-06-21 16:01:14 +00:00
b0fffa6d42
Phase A baseline outputs from /autodev (Steps 1-5): - Problem & solution docs (_docs/00_problem, _docs/01_solution) - Codebase documentation (_docs/02_document) incl. architecture, module-layout, glossary, system-flows, baseline compliance scan - Test specs (blackbox, performance, resilience, security, resource, traceability matrix) - Test task decomposition (_docs/02_tasks/todo): AZ-285..AZ-290 - Testability refactor (_docs/04_refactoring/01-testability-refactoring): - TC-01 Move DownloadedTileInfoV2 + new ExistingTileInfo to Common.DTO - TC-02 Replace dead ISatelliteDownloader API with real signatures - TC-03 GoogleMapsDownloaderV2 implements ISatelliteDownloader - TC-04 TileService depends on ISatelliteDownloader (mockable) - TC-05 DI + endpoints use ISatelliteDownloader - Test runner scripts (scripts/run-tests.sh, run-performance-tests.sh) - Autodev state pointer (_docs/_autodev_state.md) Prepares the codebase for AZ-285..AZ-290 unit/integration test work. Co-authored-by: Cursor <cursoragent@cursor.com>
77 lines
2.1 KiB
Bash
Executable File
77 lines
2.1 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
set -euo pipefail
|
|
|
|
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
|
PROJECT_ROOT="$(dirname "$SCRIPT_DIR")"
|
|
API_URL="${API_URL:-http://localhost:18980}"
|
|
|
|
cleanup() {
|
|
echo "Cleaning up..."
|
|
}
|
|
trap cleanup EXIT
|
|
|
|
echo "=== Satellite Provider Performance Tests ==="
|
|
echo "API URL: $API_URL"
|
|
echo ""
|
|
|
|
PASS=0
|
|
FAIL=0
|
|
|
|
check_threshold() {
|
|
local test_name="$1"
|
|
local actual_ms="$2"
|
|
local threshold_ms="$3"
|
|
|
|
if (( actual_ms <= threshold_ms )); then
|
|
echo " ✓ $test_name: ${actual_ms}ms (threshold: ${threshold_ms}ms)"
|
|
PASS=$((PASS + 1))
|
|
else
|
|
echo " ✗ $test_name: ${actual_ms}ms EXCEEDS threshold ${threshold_ms}ms"
|
|
FAIL=$((FAIL + 1))
|
|
fi
|
|
}
|
|
|
|
echo "PT-02: Cached Tile Retrieval Latency (threshold: 500ms)"
|
|
START=$(date +%s%N)
|
|
HTTP_CODE=$(curl -s -o /dev/null -w "%{http_code}" "$API_URL/api/satellite/tiles/latlon?Latitude=47.461747&Longitude=37.647063&ZoomLevel=18")
|
|
END=$(date +%s%N)
|
|
ELAPSED_MS=$(( (END - START) / 1000000 ))
|
|
|
|
if [[ "$HTTP_CODE" == "200" ]]; then
|
|
check_threshold "Cached tile retrieval" "$ELAPSED_MS" 500
|
|
else
|
|
echo " ✗ PT-02: HTTP $HTTP_CODE (expected 200) - tile may not be cached yet"
|
|
FAIL=$((FAIL + 1))
|
|
fi
|
|
|
|
echo ""
|
|
echo "PT-06: Route Point Interpolation Speed (threshold: 5000ms)"
|
|
ROUTE_ID=$(uuidgen | tr '[:upper:]' '[:lower:]')
|
|
BODY="{\"id\":\"$ROUTE_ID\",\"name\":\"Perf Test\",\"regionSizeMeters\":300,\"zoomLevel\":18,\"points\":[{\"lat\":48.276067,\"lon\":37.384458},{\"lat\":48.270740,\"lon\":37.374029}]}"
|
|
|
|
START=$(date +%s%N)
|
|
HTTP_CODE=$(curl -s -o /dev/null -w "%{http_code}" -X POST -H "Content-Type: application/json" -d "$BODY" "$API_URL/api/satellite/route")
|
|
END=$(date +%s%N)
|
|
ELAPSED_MS=$(( (END - START) / 1000000 ))
|
|
|
|
if [[ "$HTTP_CODE" == "200" ]]; then
|
|
check_threshold "Route creation (2 points)" "$ELAPSED_MS" 5000
|
|
else
|
|
echo " ✗ PT-06: HTTP $HTTP_CODE (expected 200)"
|
|
FAIL=$((FAIL + 1))
|
|
fi
|
|
|
|
echo ""
|
|
echo "=== Performance Test Summary ==="
|
|
echo " Passed: $PASS"
|
|
echo " Failed: $FAIL"
|
|
echo ""
|
|
|
|
if [[ $FAIL -gt 0 ]]; then
|
|
echo "FAILED: $FAIL performance threshold(s) exceeded"
|
|
exit 1
|
|
fi
|
|
|
|
echo "ALL PERFORMANCE TESTS PASSED"
|
|
exit 0
|