spark: add verification script for JSON validator

This commit is contained in:
spark committed 2026-10-21 21:12:39 +00:00
1 parent 3168679020
commit 3a10f53d76
1 file changed
+33 -10
+33 -10
View File
@@ -1,14 +1,37 @@
#!/usr/bin/env python3
"""Verify the hermes_diagnostics output has status 'ok'."""
"""Verify json_validator.py works correctly."""
import subprocess
import json
import sys
with open("/root/troupe-standup/wizard-work/spark/output.json") as f:
data = json.load(f)
# Test 1: Valid JSON should exit 0
result = subprocess.run(['python3', '/root/.hermes/wizard-outputs/spark/json_validator.py',
'/root/.hermes/wizard-outputs/spark/test_valid.json'],
capture_output=True, text=True)
if result.returncode != 0:
print("FAIL: Valid JSON should exit 0")
exit(1)
if "VALID" not in result.stdout:
print("FAIL: Expected VALID in output")
exit(1)
if data.get("status") == "ok":
print("VERIFIED: status is ok")
sys.exit(0)
else:
print("FAILED: status is not ok")
sys.exit(1)
# Test 2: Invalid JSON should exit 1
result = subprocess.run(['python3', '/root/.hermes/wizard-outputs/spark/json_validator.py',
'/root/.hermes/wizard-outputs/spark/test_invalid.json'],
capture_output=True, text=True)
if result.returncode != 1:
print("FAIL: Invalid JSON should exit 1")
exit(1)
if "INVALID" not in result.stdout:
print("FAIL: Expected INVALID in output")
exit(1)
# Test 3: Non-existent file should exit 1
result = subprocess.run(['python3', '/root/.hermes/wizard-outputs/spark/json_validator.py',
'/nonexistent/file.json'],
capture_output=True, text=True)
if result.returncode != 1:
print("FAIL: Non-existent file should exit 1")
exit(1)
print("All verification tests passed!")
exit(0)