dev [release-patch] #6
@@ -37,9 +37,28 @@ jobs:
|
||||
# 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 sleep infinity
|
||||
|
||||
- name: Verify python module imports
|
||||
- name: Start server in container and smoke test HTTP (in-container)
|
||||
run: |
|
||||
docker exec semapform-test python -c "import api_service; print('import ok')"
|
||||
# start the server inside the container
|
||||
docker exec -d semapform-test uv run uvicorn api_service:app --host 0.0.0.0 --port 8001
|
||||
|
||||
# send a POST request to /api/validate-signature with signature="ST 250 U42 (15)"
|
||||
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):
|
||||
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:
|
||||
time.sleep(1)
|
||||
print('failed')
|
||||
sys.exit(1)
|
||||
PY
|
||||
|
||||
- name: Start server in container and smoke test HTTP (in-container)
|
||||
run: |
|
||||
|
||||
@@ -30,6 +30,7 @@ def _get_catalogue():
|
||||
if cat is None:
|
||||
# import inside function to avoid expensive work during module import
|
||||
from bibapi import catalogue as _catalogue
|
||||
|
||||
cat = _catalogue.Catalogue()
|
||||
return cat
|
||||
|
||||
|
||||
Reference in New Issue
Block a user