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