From c44dc5a61cb9033b78bf34195fa8fc0b4d0e26bf Mon Sep 17 00:00:00 2001 From: WorldTeacher Date: Tue, 25 Nov 2025 09:52:51 +0100 Subject: [PATCH] test new validation test --- .gitea/workflows/test_pr.yml | 31 +++++++++++++++++++------------ 1 file changed, 19 insertions(+), 12 deletions(-) diff --git a/.gitea/workflows/test_pr.yml b/.gitea/workflows/test_pr.yml index 19874b3..a762f0b 100644 --- a/.gitea/workflows/test_pr.yml +++ b/.gitea/workflows/test_pr.yml @@ -35,31 +35,38 @@ jobs: - name: Start container (background) run: | # do NOT bind the container port to the host to avoid port conflicts on the runner - docker run -d --name semapform-test semapform-api:test-pr --port 8001:8001 sleep infinity + docker run -d --name semapform-test semapform-api:test-pr sleep infinity - name: Start server in container and smoke test HTTP (in-container) run: | - # start the server inside the container - docker exec -d semapform-test python api_service.py + set -x + # start the server inside the container (detached) + docker exec -d semapform-test python api_service.py || true - # send a POST request to /api/validate-signature with signature="ST 250 U42 (15)" + # show container status to aid debugging + docker ps -a --filter name=semapform-test || true + + # perform an in-container GET request (endpoint is a GET) and print attempts/logs docker exec semapform-test python - << 'PY' import time, urllib.request, sys url = 'http://127.0.0.1:8001/api/validate-signature?signature=ST%20250%20U42%20%2815%29' - for _ in range(20): + for i in range(20): try: - req = urllib.request.Request(url, method='POST') - r = urllib.request.urlopen(req, timeout=3) - print('status', r.status) - print(r.read().decode()) - if 200 <= r.status < 300: - sys.exit(0) - except Exception: + with urllib.request.urlopen(url, timeout=3) as r: + print('attempt', i, 'status', r.status) + print(r.read().decode()) + if 200 <= r.status < 300: + sys.exit(0) + except Exception as e: + print('attempt', i, 'failed:', e) time.sleep(1) print('failed') sys.exit(1) PY + # dump the last 200 lines of logs so this step has visible output + docker logs semapform-test --tail 200 || true + - name: Cleanup container if: always() run: |