sync: auto-sync from HOWARD-HOME at 2026-07-06 16:41:20
Author: Howard Enos Machine: HOWARD-HOME Timestamp: 2026-07-06 16:41:20
This commit is contained in:
@@ -27,31 +27,40 @@ def run(args):
|
||||
return p.returncode, p.stdout, p.stderr
|
||||
|
||||
|
||||
def check(name, args, *, want_rc=None, out_has=None, out_json_ok=False):
|
||||
def check(name, args, *, want_rc=None, out_has=None, out_json_ok=False, out_json_min_len=None):
|
||||
rc, out, err = run(args)
|
||||
problems = []
|
||||
if want_rc is not None and rc != want_rc:
|
||||
problems.append(f"rc={rc} want {want_rc}")
|
||||
if out_has and out_has not in out:
|
||||
problems.append(f"stdout missing {out_has!r}")
|
||||
if out_json_ok:
|
||||
if out_json_ok or out_json_min_len is not None:
|
||||
try:
|
||||
json.loads(out)
|
||||
parsed = json.loads(out)
|
||||
if out_json_min_len is not None and len(parsed) < out_json_min_len:
|
||||
problems.append(f"json len {len(parsed)} < {out_json_min_len}")
|
||||
except Exception as e:
|
||||
problems.append(f"stdout not JSON: {e}")
|
||||
results.append(("PASS" if not problems else "FAIL", name, "; ".join(problems)))
|
||||
|
||||
|
||||
# --- reads: succeed (rc 0) [hit the live instance] ---
|
||||
check("status", ["status"], want_rc=0, out_has="fleet:")
|
||||
check("status", ["status"], want_rc=0, out_has="Authenticated")
|
||||
check("status shows fleet", ["status"], want_rc=0, out_has="fleet:")
|
||||
check("sessions (full fleet)", ["sessions"], want_rc=0, out_has="Sessions:")
|
||||
check("sessions json", ["sessions", "--json"], want_rc=0, out_json_ok=True)
|
||||
check("sessions --limit", ["sessions", "--limit", "5"], want_rc=0, out_has="Sessions:")
|
||||
check("sessions --like", ["sessions", "--like", "DELL", "--json"], want_rc=0, out_json_ok=True)
|
||||
check("sessions --type all", ["sessions", "--type", "all", "--json"], want_rc=0, out_json_ok=True)
|
||||
check("sessions --filter", ["sessions", "--filter", "SessionType = 'Access'", "--json"],
|
||||
want_rc=0, out_json_ok=True)
|
||||
check("sessions --company", ["sessions", "--company", "Safesite", "--json"],
|
||||
want_rc=0, out_json_ok=True)
|
||||
# --limit must NOT truncate --json (documented "--json is always full" contract):
|
||||
# Safesite has 62 machines; even with --limit 1 the JSON must return them all.
|
||||
check("sessions --limit does not truncate json",
|
||||
["sessions", "--company", "Safesite", "--limit", "1", "--json"],
|
||||
want_rc=0, out_json_min_len=10)
|
||||
|
||||
# --- build-installer: pure URL build (no network) ---
|
||||
check("build-installer", ["build-installer", "--name", "HOST", "--company", "AZ Computer Guru",
|
||||
|
||||
Reference in New Issue
Block a user