Compare commits
1
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
4acf683662 |
+18
-20
@@ -74,38 +74,36 @@ jobs:
|
|||||||
echo "container uid: $uid"
|
echo "container uid: $uid"
|
||||||
[ "$uid" = "1000" ] || { echo "::error::image runs as uid $uid, expected 1000"; exit 1; }
|
[ "$uid" = "1000" ] || { echo "::error::image runs as uid $uid, expected 1000"; exit 1; }
|
||||||
|
|
||||||
# 2. Boot the server and probe it from *inside* its own container via
|
# 2. Boot the server and probe it over HTTP. Talk to the container's own
|
||||||
# `docker exec`. On self-hosted runners the job step runs in a container
|
# bridge IP rather than a host-published port (-p): self-hosted runners
|
||||||
# that shares the host's Docker socket but sits on a different network,
|
# commonly execute steps as a sibling container sharing the host's
|
||||||
# so it can reach neither a published host port (-p lands on the runner
|
# Docker socket, in which case -p publishes on the *runner host*, not
|
||||||
# host, not this step's netns) nor the server container's bridge IP
|
# inside this step's container, and 127.0.0.1 never reaches it.
|
||||||
# (different network → connect hangs). `docker exec` goes through the
|
# Container-to-container traffic over the bridge network always works.
|
||||||
# socket and runs the probe in the server's own netns, where
|
docker run -d --name familiar-smoke -e FAMILIAR_HTTP_TOKEN="$TOKEN" -p 18080:8080 "$IMG"
|
||||||
# 127.0.0.1:8080 always works regardless of runner topology. The image
|
ip=$(docker inspect -f '{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' familiar-smoke)
|
||||||
# ships python + httpx, so no curl or extra pull is needed.
|
BASE="http://${ip}:8080"
|
||||||
docker run -d --name familiar-smoke -e FAMILIAR_HTTP_TOKEN="$TOKEN" "$IMG"
|
|
||||||
|
|
||||||
# probe "<httpx call returning a Response>" -> prints the status code
|
|
||||||
probe() { docker exec familiar-smoke python -c "import httpx; print(($1).status_code)"; }
|
|
||||||
|
|
||||||
for i in $(seq 1 30); do
|
for i in $(seq 1 30); do
|
||||||
if docker exec familiar-smoke python -c \
|
if curl -fsS "$BASE/healthz" >/dev/null 2>&1; then break; fi
|
||||||
"import httpx; httpx.get('http://127.0.0.1:8080/healthz', timeout=5)" >/dev/null 2>&1; then
|
|
||||||
break
|
|
||||||
fi
|
|
||||||
sleep 1
|
sleep 1
|
||||||
done
|
done
|
||||||
|
|
||||||
echo "== /healthz (expect 200) =="
|
echo "== /healthz (expect 200) =="
|
||||||
code=$(probe "httpx.get('http://127.0.0.1:8080/healthz', timeout=10)")
|
code=$(curl -s -o /dev/null -w '%{http_code}' "$BASE/healthz")
|
||||||
[ "$code" = "200" ] || { echo "::error::/healthz returned $code"; docker logs familiar-smoke; exit 1; }
|
[ "$code" = "200" ] || { echo "::error::/healthz returned $code"; docker logs familiar-smoke; exit 1; }
|
||||||
|
|
||||||
echo "== MCP without token (expect 401) =="
|
echo "== MCP without token (expect 401) =="
|
||||||
code=$(probe "httpx.post('http://127.0.0.1:8080/mcp', timeout=10, headers={'Accept':'application/json, text/event-stream','Content-Type':'application/json'}, json={'jsonrpc':'2.0','id':1,'method':'initialize','params':{}})")
|
code=$(curl -s -o /dev/null -w '%{http_code}' -X POST "$BASE/mcp" \
|
||||||
|
-H 'Accept: application/json, text/event-stream' -H 'Content-Type: application/json' \
|
||||||
|
-d '{"jsonrpc":"2.0","id":1,"method":"initialize","params":{}}')
|
||||||
[ "$code" = "401" ] || { echo "::error::unauthenticated MCP returned $code"; exit 1; }
|
[ "$code" = "401" ] || { echo "::error::unauthenticated MCP returned $code"; exit 1; }
|
||||||
|
|
||||||
echo "== MCP with valid token (expect 200) =="
|
echo "== MCP with valid token (expect 200) =="
|
||||||
code=$(probe "httpx.post('http://127.0.0.1:8080/mcp', timeout=10, headers={'Authorization':'Bearer $TOKEN','Accept':'application/json, text/event-stream','Content-Type':'application/json'}, json={'jsonrpc':'2.0','id':1,'method':'initialize','params':{'protocolVersion':'2025-06-18','capabilities':{},'clientInfo':{'name':'ci','version':'1'}}})")
|
code=$(curl -s -o /dev/null -w '%{http_code}' -X POST "$BASE/mcp" \
|
||||||
|
-H "Authorization: Bearer $TOKEN" \
|
||||||
|
-H 'Accept: application/json, text/event-stream' -H 'Content-Type: application/json' \
|
||||||
|
-d '{"jsonrpc":"2.0","id":1,"method":"initialize","params":{"protocolVersion":"2025-06-18","capabilities":{},"clientInfo":{"name":"ci","version":"1"}}}')
|
||||||
[ "$code" = "200" ] || { echo "::error::authenticated MCP returned $code"; docker logs familiar-smoke; exit 1; }
|
[ "$code" = "200" ] || { echo "::error::authenticated MCP returned $code"; docker logs familiar-smoke; exit 1; }
|
||||||
|
|
||||||
echo "Image smoke-test passed."
|
echo "Image smoke-test passed."
|
||||||
|
|||||||
Reference in new issue
Block a user