12 lines
681 B
Python
12 lines
681 B
Python
from __future__ import annotations
|
|
import argparse, json, urllib.request
|
|
|
|
parser=argparse.ArgumentParser(); parser.add_argument("--url",default="http://127.0.0.1:18927/health"); args=parser.parse_args()
|
|
with urllib.request.urlopen(args.url,timeout=5) as response:
|
|
body=json.loads(response.read())
|
|
assert response.status == 200
|
|
required={"version","commit_oid","artifact_sha256","deployment_state","production_deployed","health_timestamp"}
|
|
assert required <= body.keys()
|
|
assert body["production_deployed"] is (body["deployment_state"] == "ACTIVE")
|
|
print(json.dumps({"status":"PASS","http_status":200,"deployment_state":body["deployment_state"]},sort_keys=True))
|