check
All checks were successful
PR tests / build-and-smoke (pull_request) Successful in 1m4s
/ build (pull_request) Successful in 16m56s

This commit is contained in:
2025-11-25 10:03:13 +01:00
parent 811313d1ef
commit 36f5dd14b5

View File

@@ -46,24 +46,26 @@ jobs:
# show container status to aid debugging # show container status to aid debugging
docker ps -a --filter name=semapform-test || true docker ps -a --filter name=semapform-test || true
# perform a readiness loop and then run the repo test script to exercise the API # perform a readiness loop (try container-local /health) using small execs
docker exec semapform-test python - << 'PY' echo "waiting for service to become ready inside container"
import time, urllib.request, sys set -e
url = 'http://127.0.0.1:8001/health' READY=0
for i in range(20): for i in $(seq 1 20); do
try: echo "ready attempt $i"
with urllib.request.urlopen(url, timeout=2) as r: if docker exec semapform-test python -c 'import urllib.request,sys; urllib.request.urlopen("http://127.0.0.1:8001/health", timeout=1); print("ok")' ; then
print('ready', i, 'status', r.status) READY=1
if 200 <= r.status < 300: break
sys.exit(0) fi
except Exception as e: sleep 1
print('ready attempt', i, 'failed:', e) done
time.sleep(1) if [ "$READY" -ne 1 ]; then
print('service did not become ready') echo "service did not become ready"
sys.exit(1) docker logs semapform-test --tail 200 || true
PY exit 1
fi
# Run the repository smoke-test script inside the container and surface its output # Run the repository smoke-test script inside the container and surface its output
echo "running test_api.py inside container"
docker exec semapform-test python test_api.py || true docker exec semapform-test python test_api.py || true
# dump the last 200 lines of logs so this step always displays useful output # dump the last 200 lines of logs so this step always displays useful output