23 lines
1.0 KiB
Bash
Executable File
23 lines
1.0 KiB
Bash
Executable File
#!/bin/bash
|
|
# JSON validator verification check
|
|
# Exit code 0 = all tests pass
|
|
|
|
# Test 1: Validator exists and is executable
|
|
[ -f /root/.hermes/wizard-outputs/spark/json-validator.py ] || exit 1
|
|
|
|
# Test 2: Run validator on valid JSON - should exit 0
|
|
python3 /root/.hermes/wizard-outputs/spark/json-validator.py /root/.hermes/wizard-outputs/spark/test_valid.json >/dev/null 2>&1 || exit 2
|
|
|
|
# Test 3: Run validator on invalid JSON - should exit non-zero
|
|
python3 /root/.hermes/wizard-outputs/spark/json-validator.py /root/.hermes/wizard-outputs/spark/test_invalid.json >/dev/null 2>&1 && exit 3
|
|
|
|
# Test 4: Validator reports correctly for valid file
|
|
output="$(python3 /root/.hermes/wizard-outputs/spark/json-validator.py /root/.hermes/wizard-outputs/spark/test_valid.json 2>&1)"
|
|
echo "$output" | grep -q "VALID" || exit 4
|
|
|
|
# Test 5: Validator reports correctly for invalid file
|
|
output="$(python3 /root/.hermes/wizard-outputs/spark/json-validator.py /root/.hermes/wizard-outputs/spark/test_invalid.json 2>&1)"
|
|
echo "$output" | grep -q "INVALID" || exit 5
|
|
|
|
echo "VERIFIED"
|
|
exit 0 |