[AZ-284] Autodev baseline + testability refactor

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>
This commit is contained in:
Oleksandr Bezdieniezhnykh
2026-05-10 04:44:08 +03:00
parent 25a644a9bf
commit b0fffa6d42
68 changed files with 4192 additions and 11 deletions
+76
View File
@@ -0,0 +1,76 @@
#!/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
+39
View File
@@ -0,0 +1,39 @@
#!/usr/bin/env bash
set -euo pipefail
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
PROJECT_ROOT="$(dirname "$SCRIPT_DIR")"
cleanup() {
docker compose -f "$PROJECT_ROOT/docker-compose.yml" -f "$PROJECT_ROOT/docker-compose.tests.yml" down --remove-orphans 2>/dev/null || true
}
trap cleanup EXIT
echo "=== Satellite Provider Test Suite ==="
echo ""
if [[ "${1:-}" == "--unit-only" ]]; then
echo "Running unit tests only..."
docker run --rm -v "$PROJECT_ROOT:/src" -w /src mcr.microsoft.com/dotnet/sdk:8.0 \
dotnet test SatelliteProvider.Tests/SatelliteProvider.Tests.csproj \
--no-restore --configuration Release \
--logger "console;verbosity=normal"
echo ""
echo "=== Unit tests complete ==="
exit 0
fi
echo "Running full test suite (unit + integration)..."
echo ""
echo "Step 1: Unit tests"
docker run --rm -v "$PROJECT_ROOT:/src" -w /src mcr.microsoft.com/dotnet/sdk:8.0 \
sh -c "dotnet restore SatelliteProvider.sln && dotnet test SatelliteProvider.Tests/SatelliteProvider.Tests.csproj --no-restore --configuration Release --logger 'console;verbosity=normal'"
echo ""
echo "Step 2: Integration tests (Docker Compose)"
docker compose -f "$PROJECT_ROOT/docker-compose.yml" -f "$PROJECT_ROOT/docker-compose.tests.yml" \
up --build --abort-on-container-exit --exit-code-from integration-tests
echo ""
echo "=== All tests passed ==="