feat: Update testing documentation and introduce comprehensive report for IPSExtractor campaign. Add sections for executive summary, objectives, environment details, and methodology. Enhance README with compilation instructions and data sources for metrics analysis.
This commit is contained in:
@@ -0,0 +1,46 @@
|
||||
#!/usr/bin/env bash
|
||||
# Mide latencia HTTP de count-api vía gateway para cada PDF en docs/plan_pruebas/data/
|
||||
set -euo pipefail
|
||||
|
||||
ROOT="$(cd "$(dirname "$0")/../../.." && pwd)"
|
||||
DATA_DIR="${COUNT_TEST_PDF_DIR:-$ROOT/docs/plan_pruebas/data}"
|
||||
BASE_URL="${BASE_URL:-http://127.0.0.1:8189}"
|
||||
OUT="${COUNT_LATENCY_CSV:-$ROOT/docs/plan_pruebas/informes/count_latency_$(date +%Y%m%d).csv}"
|
||||
|
||||
if [[ ! -d "$DATA_DIR" ]]; then
|
||||
echo "No existe DATA_DIR=$DATA_DIR" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
shopt -s nullglob
|
||||
pdfs=("$DATA_DIR"/*.pdf "$DATA_DIR"/*.PDF)
|
||||
if [[ ${#pdfs[@]} -eq 0 ]]; then
|
||||
echo "No hay PDFs en $DATA_DIR" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
mkdir -p "$(dirname "$OUT")"
|
||||
echo "file,http_time_s,http_code,service_count,status" >"$OUT"
|
||||
echo "BASE_URL=$BASE_URL"
|
||||
echo "DATA_DIR=$DATA_DIR"
|
||||
echo "Writing $OUT"
|
||||
echo
|
||||
|
||||
for pdf in "${pdfs[@]}"; do
|
||||
name="$(basename "$pdf")"
|
||||
tmp="$(mktemp)"
|
||||
# body to file; time_total and http_code on stderr via -w
|
||||
code_time="$(curl -sS -o "$tmp" -w '%{http_code} %{time_total}' \
|
||||
-F "files=@${pdf};type=application/pdf" \
|
||||
"${BASE_URL}/count/v1/count" || echo "000 0")"
|
||||
code="$(echo "$code_time" | awk '{print $1}')"
|
||||
secs="$(echo "$code_time" | awk '{print $2}')"
|
||||
# crude parse
|
||||
scount="$(python3 -c "import json,sys; d=json.load(open(sys.argv[1])); print(d['results'][0].get('service_count','') if d.get('results') else '')" "$tmp" 2>/dev/null || echo "")"
|
||||
status="$(python3 -c "import json,sys; d=json.load(open(sys.argv[1])); print(d['results'][0].get('status','') if d.get('results') else d.get('error','err'))" "$tmp" 2>/dev/null || echo "parse_error")"
|
||||
echo "$name,$secs,$code,$scount,$status" | tee -a "$OUT"
|
||||
rm -f "$tmp"
|
||||
done
|
||||
|
||||
echo
|
||||
echo "Done. CSV: $OUT"
|
||||
Reference in New Issue
Block a user