decomposer: generate deliverable files for Define the service contract and project architecture for the FastAPI endpoint monitoring service.; Implement the typed monitor CRUD API and concurrency-safe in-memory state according to the service design.; Implement secure on-demand endpoint checks with status updates, latency measurement, robust error handling, and redacted structured logs.; Add operational API endpoints and environment-driven runtime configuration to the monitoring service.; Create automated tests for the monitoring service.; Package the service with Docker and developer documentation.; Validate the complete project.
Some checks failed
ci / validate (push) Has been cancelled
Some checks failed
ci / validate (push) Has been cancelled
This commit is contained in:
31
scripts/verify.sh
Normal file
31
scripts/verify.sh
Normal file
@@ -0,0 +1,31 @@
|
||||
#!/bin/sh
|
||||
set -eu
|
||||
ruff format --check .
|
||||
ruff check .
|
||||
mypy app
|
||||
pytest
|
||||
|
||||
docker build -t endpoint-monitor:verify .
|
||||
container="$(docker run -d -p 127.0.0.1:18000:8000 endpoint-monitor:verify)"
|
||||
trap 'docker rm -f "$container" >/dev/null 2>&1 || true' EXIT
|
||||
tries=0
|
||||
until python -c "import urllib.request; urllib.request.urlopen('http://127.0.0.1:18000/health/ready', timeout=1)"; do
|
||||
tries=$((tries + 1))
|
||||
[ "$tries" -lt 20 ] || exit 1
|
||||
sleep 0.5
|
||||
done
|
||||
python - <<'PY'
|
||||
import json
|
||||
import urllib.request
|
||||
base = "http://127.0.0.1:18000"
|
||||
assert json.load(urllib.request.urlopen(base + "/health/live")) == {"status": "ok"}
|
||||
request = urllib.request.Request(
|
||||
base + "/monitors",
|
||||
data=b'{"name":"smoke","url":"https://example.com"}',
|
||||
headers={"content-type": "application/json"},
|
||||
method="POST",
|
||||
)
|
||||
created = json.load(urllib.request.urlopen(request))
|
||||
assert created["name"] == "smoke"
|
||||
assert len(json.load(urllib.request.urlopen(base + "/monitors"))) == 1
|
||||
PY
|
||||
Reference in New Issue
Block a user