Files
duckbrain-toolbox/tests/compat/http/assert.sh
T

22 lines
762 B
Bash
Executable File

#!/usr/bin/env bash
# Smoke del paquete http. Recibe BASE, PKG, RESULTS.
set -u
check() {
local comp="$1" path="$2" expect="$3" body
if ! body="$(curl -fsS "$BASE$path" 2>/dev/null)"; then
echo "$PKG:$comp|fail" >> "$RESULTS"; return
fi
if printf '%s' "$body" | grep -qF "$expect"; then
echo "$PKG:$comp|ok" >> "$RESULTS"
else
echo " inesperado en $path: $(printf '%s' "$body" | head -c 200)" >&2
echo "$PKG:$comp|fail" >> "$RESULTS"
fi
}
check curlRequest /compat/http/curl 'CURL_OK'
check aria2 '/compat/http/load?class=Aria2' 'LOAD_OK:Libs\Aria2'
check proxy '/compat/http/load?class=Proxy' 'LOAD_OK:Libs\Proxy'
check compreFace '/compat/http/load?class=CompreFace' 'LOAD_OK:Libs\CompreFace'