Files
omar c69299c810
ci / static (push) Successful in 1m0s
ci / test-3.12 (push) Successful in 1m42s
ci / test-3.13 (push) Successful in 1m50s
ci / image (push) Successful in 9s
ci / smoke (push) Successful in 10s
ci / publish (push) Failing after 5s
ci: hold stdin open for the last smoke reply
2026-11-28 20:55:01 +03:00

49 lines
1.2 KiB
Python

"""Drive a built image over stdio: initialize, list tools, one safe call, EOF.
Only the standard library is used, so it runs outside the project venv.
Prints the JSON-RPC traffic to stdout for the CI log; asserts exit cleanliness
in the caller, not here.
"""
import json
import sys
import time
HOLD = 1.5
CALL = {
"jsonrpc": "2.0",
"id": 3,
"method": "tools/call",
"params": {"name": "reports", "arguments": {"status": "open"}},
}
MESSAGES = [
{
"jsonrpc": "2.0",
"id": 1,
"method": "initialize",
"params": {
"protocolVersion": "2025-06-18",
"capabilities": {},
"clientInfo": {"name": "ci-smoke", "version": "1"},
},
},
{"jsonrpc": "2.0", "method": "notifications/initialized"},
{"jsonrpc": "2.0", "id": 2, "method": "tools/list"},
CALL,
]
def main() -> int:
for message in MESSAGES:
sys.stdout.write(json.dumps(message) + "\n")
sys.stdout.flush()
time.sleep(0.2)
# Keep stdin open until the last reply lands, then signal EOF by exiting.
time.sleep(HOLD)
return 0
if __name__ == "__main__":
raise SystemExit(main())